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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 9598查询-799701-查询凭证密码是否打印
    /// 799701-查询活期明细
    /// </summary>
    public class QueryPZMMDY : TFOutput
    {
        #region Output
        /// <summary>
        /// 查询结果
        /// 账户ID|凭证类型|凭证号码|密码打印次数|
        /// </summary>
        public string CXJG { get; internal set; }

        /// <summary>
        /// 查询结果
        /// 账户ID|凭证类型|凭证号码|密码打印次数|
        /// </summary>
        public List<E_CXJG> CXJGData { get; internal set; }

        /// <summary>
        /// 查询结果
        /// 账户ID|凭证类型|凭证号码|密码打印次数|
        /// </summary>
        public class E_CXJG
        {
            /// <summary>
            /// 账户ID
            /// </summary>
            public string ZHID { get; set; }

            /// <summary>
            /// 凭证类型
            /// </summary>
            public string PZLX { get; set; }

            /// <summary>
            /// 凭证号码
            /// </summary>
            public string PZHM { get; set; }

            /// <summary>
            /// 密码打印次数
            /// </summary>
            public string MMDYCS { get; set; }

        }

        #endregion

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

            /// <summary>
            /// 查询条件 
            /// 凭证类型
            /// </summary>
            public string PZLX { get; set; }

            /// <summary>
            /// 查询条件 
            /// 凭证号码起始
            /// </summary>
            public string PZHMQS { get; set; }

            /// <summary>
            /// 查询条件 
            /// 凭证号码终止
            /// </summary>
            public string PZHMZZ { get; set; }


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

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.CXJGData = AnilyzeFileData<E_CXJG>(MessageData.FileData,
                                            "账户ID|凭证类型|凭证号码|密码打印次数|",
                                            x =>
                                            {
                                                return new E_CXJG
                                                {
                                                    ZHID = x["账户ID"],
                                                    PZLX = x["凭证类型"],
                                                    PZHM = x["凭证号码"],
                                                    MMDYCS = x["密码打印次数"]
                                                };
                                            });
                output.CXJG = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
