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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 9598查询-210201-查询存款证明登记簿
    /// 210201-查询存款证明登记簿
    /// </summary>
    public class QueryDepositProveList_210201 : TFOutput
    {
        #region Output
        /// <summary>
        /// 查询结果
        /// 文件格式:签发份数|冻结账号|冻结日期|到期日期
        /// </summary>
        public string CXJG { get; internal set; }

        /// <summary>
        /// 查询结果
        /// 文件格式:签发份数|冻结账号|冻结日期|到期日期
        /// </summary>
        public List<E_CXJG> CXJGData { get; internal set; }

        /// <summary>
        /// 查询结果
        /// 文件格式:签发份数|冻结账号|冻结日期|到期日期
        /// </summary>
        public class E_CXJG
        {
            /// <summary>
            /// 签发份数
            /// </summary>
            public string QFFS { get; set; }

            /// <summary>
            /// 冻结账号
            /// </summary>
            public string DJZH { get; set; }

            /// <summary>
            /// 冻结日期
            /// </summary>
            public string DJRQ { get; set; }

            /// <summary>
            /// 到期日期
            /// </summary>
            public string DQRQ { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 查询条件 
            /// 冻结流水号
            /// </summary>
            public string DJLSH { get; set; }

            /// <summary>
            /// 查询条件 
            /// 冻结日期
            /// </summary>
            public string DJRQ { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryDepositProveList_210201();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "9598";
                MessageData.Fd123 = string.Format("1,210201,{0},{1},",DJLSH,DJRQ);

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.CXJGData = AnilyzeFileData<E_CXJG>(MessageData.FileData,
                                            "签发份数|冻结账号|冻结日期|到期日期",
                                            x =>
                                            {
                                                return new E_CXJG
                                                {
                                                    QFFS = x["签发份数"],
                                                    DJZH = x["冻结账号"],
                                                    DJRQ = x["冻结日期"],
                                                    DQRQ = x["到期日期"]
                                                };
                                            });
                output.CXJG = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
