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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 9598查询-210202-查询存款证明登记簿
    /// 210202-查询存款证明登记簿
    /// </summary>
    public class QueryDepositProveList_210202 : 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 ZJLX { get; set; }

            /// <summary>
            /// 证件号
            /// </summary>
            public string ZJH { get; set; }

            /// <summary>
            /// 摘要
            /// </summary>
            public string ZY { get; set; }

            /// <summary>
            /// 交易机构
            /// </summary>
            public string JYJG { get; set; }

        }

        #endregion

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


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

                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
                                                {
                                                    ZJLX = x["证件类型"],
                                                    ZJH = x["证件号"],
                                                    ZY = x["摘要"],
                                                    JYJG = x["交易机构"]
                                                };
                                            });
                output.CXJG = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
