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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 客户经理信息查询
    /// 客户经理信息查询
    /// </summary>
    public class QueryCustomerManagerInfo : TFOutput
    {
        #region Output
        /// <summary>
        /// 文件
        /// 客户经理编号|客户经理名称|客户经理证件号码|
        /// </summary>
        public string WJ { get; internal set; }

        /// <summary>
        /// 文件
        /// 客户经理编号|客户经理名称|客户经理证件号码|
        /// </summary>
        public List<E_WJ> WJData { get; internal set; }

        /// <summary>
        /// 文件
        /// 客户经理编号|客户经理名称|客户经理证件号码|
        /// </summary>
        public class E_WJ
        {
            /// <summary>
            /// 客户经理编号
            /// </summary>
            public string KHJLBH { get; set; }

            /// <summary>
            /// 客户经理名称
            /// </summary>
            public string KHJLMC { get; set; }

            /// <summary>
            /// 客户经理证件号码
            /// </summary>
            public string KHJLZJHM { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 客户经理名称 0250
            ///  
            /// </summary>
            public string KHJLMC { get; set; }

            /// <summary>
            /// 生效日期 0440
            ///  
            /// </summary>
            public string RQStart { get; set; }

            /// <summary>
            /// 失效日期 0450
            ///  
            /// </summary>
            public string RQEnd { get; set; }

            /// <summary>
            /// 证件号码 0620
            ///  
            /// </summary>
            public string ZJHM { get; set; }

            /// <summary>
            /// 经理类型 0670
            /// 1.揽存经理 
            /// </summary>
            public string JLLX { get; set; }

            /// <summary>
            /// 客户经理编号 0920
            ///  
            /// </summary>
            public string KHJLBH { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryCustomerManagerInfo();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "CXCL";
                MessageData.Fd25 = KHJLMC;
                MessageData.Fd44 = RQStart;
                MessageData.Fd45 = RQEnd;
                MessageData.Fd62 = ZJHM;
                MessageData.Fd67 = JLLX;
                MessageData.Fd92 = KHJLBH;
                MessageData.Fd64 = KHJLBH;//2712中客户经理长度变更
                MessageData.Fd128 = "0064";

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.WJData = AnilyzeFileData<E_WJ>(MessageData.FileData,
                                            "客户经理编号|客户经理名称|客户经理证件号码|",
                                            x =>
                                            {
                                                return new E_WJ
                                                {
                                                    KHJLBH = x["客户经理编号"],
                                                    KHJLMC = x["客户经理名称"],
                                                    KHJLZJHM = x["客户经理证件号码"]
                                                };
                                            });
                output.WJ = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
