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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询贷款信息列表
    /// 根据贷款账号返回相关列表信息
    /// </summary>
    public class QueryLoanList : TFOutput
    {
        #region Output
        /// <summary>
        /// 以文件形式查询贷款账号相关信息列表
        /// 序号|开户日期|产品名称|余额|账户状态|
        /// </summary>
        public string YWJXSCXDKZHXGXXLB { get; internal set; }

        /// <summary>
        /// 以文件形式查询贷款账号相关信息列表
        /// 序号|开户日期|产品名称|余额|账户状态|
        /// </summary>
        public List<E_YWJXSCXDKZHXGXXLB> YWJXSCXDKZHXGXXLBData { get; internal set; }

        /// <summary>
        /// 以文件形式查询贷款账号相关信息列表
        /// 序号|开户日期|产品名称|余额|账户状态|
        /// </summary>
        public class E_YWJXSCXDKZHXGXXLB
        {
            /// <summary>
            /// 序号
            /// </summary>
            public string XH { get; set; }

            /// <summary>
            /// 开户日期
            /// </summary>
            public string KHRQ { get; set; }

            /// <summary>
            /// 产品名称
            /// </summary>
            public string CPMC { get; set; }

            /// <summary>
            /// 余额
            /// </summary>
            public string YE { get; set; }

            /// <summary>
            /// 账户状态
            /// </summary>
            public string ZHZT { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 贷款账号 0300
            ///  
            /// </summary>
            public string DKZH { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryLoanList();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "CXCL";
                MessageData.Fd30 = DKZH;
                MessageData.Fd128 = "0022";

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.YWJXSCXDKZHXGXXLBData = AnilyzeFileData<E_YWJXSCXDKZHXGXXLB>(MessageData.FileData,
                                            "序号|开户日期|产品名称|余额|账户状态|",
                                            x =>
                                            {
                                                return new E_YWJXSCXDKZHXGXXLB
                                                {
                                                    XH = x["序号"],
                                                    KHRQ = x["开户日期"],
                                                    CPMC = x["产品名称"],
                                                    YE = x["余额"],
                                                    ZHZT = x["账户状态"]
                                                };
                                            });
                output.YWJXSCXDKZHXGXXLB = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
