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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询挂失登记簿列表
    /// 通过账号查询挂失登记簿列表
    /// </summary>
    public class QueryLostRecords : TFOutput
    {
        #region Output
        /// <summary>
        /// 挂失列表
        /// 挂失标志|解挂失标志|挂失编号|挂失日期|到期日期|申请书挂失标志|挂失机构|
        /// </summary>
        public string GSLB { get; internal set; }

        /// <summary>
        /// 挂失列表
        /// 挂失标志|解挂失标志|挂失编号|挂失日期|到期日期|申请书挂失标志|挂失机构|
        /// </summary>
        public List<E_GSLB> GSLBData { get; internal set; }

        /// <summary>
        /// 挂失列表
        /// 挂失标志|解挂失标志|挂失编号|挂失日期|到期日期|申请书挂失标志|挂失机构|
        /// </summary>
        public class E_GSLB
        {
            /// <summary>
            /// 挂失标志
            /// </summary>
            public string GSBZ { get; set; }

            /// <summary>
            /// 解挂失标志
            /// </summary>
            public string JGSBZ { get; set; }

            /// <summary>
            /// 挂失编号
            /// </summary>
            public string GSBH { get; set; }

            /// <summary>
            /// 挂失日期
            /// </summary>
            public string GSRQ { get; set; }

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

            /// <summary>
            /// 申请书挂失标志
            /// </summary>
            public string SQSGSBZ { get; set; }

            /// <summary>
            /// 挂失机构
            /// </summary>
            public string GSJG { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 帐号 0300
            ///  
            /// </summary>
            public string ZH { get; set; }


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

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.GSLBData = AnilyzeFileData<E_GSLB>(MessageData.FileData,
                                            "挂失标志|解挂失标志|挂失编号|挂失日期|到期日期|申请书挂失标志|挂失机构|",
                                            x =>
                                            {
                                                return new E_GSLB
                                                {
                                                    GSBZ = x["挂失标志"],
                                                    JGSBZ = x["解挂失标志"],
                                                    GSBH = x["挂失编号"],
                                                    GSRQ = x["挂失日期"],
                                                    DQRQ = x["到期日期"],
                                                    SQSGSBZ = x["申请书挂失标志"],
                                                    GSJG = x["挂失机构"]
                                                };
                                            });
                output.GSLB = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
