using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询职业类型
    /// 根据介质代码查询支持的定期产品存期类型
    /// </summary>
    public class QueryJobTypeList : TFOutput
    {
        #region Output
        /// <summary>
        /// 职业类型列表
        /// 职业类型|职业名称|
        /// </summary>
        public string ZYLB { get; internal set; }

        /// <summary>
        /// 职业类型列表
        /// 职业类型|职业名称|
        /// </summary>
        public List<E_ZYLB> ZYLBData { get; internal set; }

        /// <summary>
        /// 职业
        /// 一级职业编码
        /// </summary>
        public string ZYBM_1 { get; internal set; }

        /// <summary>
        /// 职业
        /// 二级职业编码
        /// </summary>
        public string ZYBM_2 { get; internal set; }

        /// <summary>
        /// 职业类型列表
        /// 职业类型|职业名称|
        /// </summary>
        public class E_ZYLB
        {
            /// <summary>
            /// 职业类型
            /// </summary>
            public string ZYLX { get; set; }

            /// <summary>
            /// 职业名称
            /// </summary>
            public string ZYMC { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 查询类型 0670
            ///  
            /// </summary>
            public string CXLX { get; set; }

            /// <summary>
            /// 职业编码 1264
            ///  
            /// </summary>
            public string ZYBM { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryJobTypeList();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				//MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K121";
                MessageData.Fd67 = CXLX;
                MessageData.Fd126_4 = ZYBM;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }
                output.ZYLBData = AnilyzeFileData<E_ZYLB>(MessageData.FileData,
                                            "职业类型|职业名称|",
                                            x =>
                                            {
                                                return new E_ZYLB
                                                {
                                                    ZYLX = x["职业类型"],
                                                    ZYMC = x["职业名称"]
                                                };
                                            });
                output.ZYLB = MessageData.FileData;
                output.ZYBM_1 = MessageData.Fd126_5;
                output.ZYBM_2 = MessageData.Fd128;
                return output;
            }
        }
        #endregion
    }
}
