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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 客户凭证汇总查询
    /// 根据帐号或证件，返回客户所有的凭证信息
    /// </summary>
    public class QueryCustomerCertificateList : TFOutput
    {
        #region Output
        /// <summary>
        /// 客户凭证信息
        /// 帐号|凭证名称|种类|出售未使用|挂失|回收|作废|使用|
        /// </summary>
        public string KHPZXX { get; internal set; }

        /// <summary>
        /// 客户凭证信息
        /// 帐号|凭证名称|种类|出售未使用|挂失|回收|作废|使用|
        /// </summary>
        public List<E_KHPZXX> KHPZXXData { get; internal set; }

        /// <summary>
        /// 客户凭证信息
        /// 帐号|凭证名称|种类|出售未使用|挂失|回收|作废|使用|
        /// </summary>
        public class E_KHPZXX
        {
            /// <summary>
            /// 帐号
            /// </summary>
            public string ZH { get; set; }

            /// <summary>
            /// 凭证名称
            /// </summary>
            public string PZMC { get; set; }

            /// <summary>
            /// 种类
            /// </summary>
            public string ZL { get; set; }

            /// <summary>
            /// 出售未使用
            /// </summary>
            public string CSWSY { get; set; }

            /// <summary>
            /// 挂失
            /// </summary>
            public string GS { get; set; }

            /// <summary>
            /// 回收
            /// </summary>
            public string HS { get; set; }

            /// <summary>
            /// 作废
            /// </summary>
            public string ZF { get; set; }

            /// <summary>
            /// 使用
            /// </summary>
            public string SY { get; set; }

        }

        #endregion

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

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

            /// <summary>
            /// 操作标志 0670
            ///  
            /// </summary>
            public string CZBZ { get; set; }

            /// <summary>
            /// 证件类型 0700
            ///  
            /// </summary>
            public string ZJLX { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryCustomerCertificateList();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K057";
                MessageData.Fd30 = ZH;
                MessageData.Fd62 = ZJHM;
                MessageData.Fd67 = CZBZ;
                MessageData.Fd70 = ZJLX;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.KHPZXXData = AnilyzeFileData<E_KHPZXX>(MessageData.FileData,
                                            "帐号|凭证名称|种类|出售未使用|挂失|回收|作废|使用|",
                                            x =>
                                            {
                                                return new E_KHPZXX
                                                {
                                                    ZH = x["帐号"],
                                                    PZMC = x["凭证名称"],
                                                    ZL = x["种类"],
                                                    CSWSY = x["出售未使用"],
                                                    GS = x["挂失"],
                                                    HS = x["回收"],
                                                    ZF = x["作废"],
                                                    SY = x["使用"]
                                                };
                                            });
                output.KHPZXX = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
