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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 9598查询-501801-查询大额支付表
    /// 501801-查询大额支付表
    /// </summary>
    public class QueryLargePaymentList : TFOutput
    {
        #region Output
        /// <summary>
        /// 查询结果
        /// 文件格式:委托日期|CMT编号|交易金额|人行交易序号|发起清算行行号(账号) |付款人姓名|接收行清算行号|收款人账号|收款人姓名|交易行行号|记账账号
        /// </summary>
        public string CXJG { get; internal set; }

        /// <summary>
        /// 查询结果
        /// 文件格式:委托日期|CMT编号|交易金额|人行交易序号|发起清算行行号(账号) |付款人姓名|接收行清算行号|收款人账号|收款人姓名|交易行行号|记账账号
        /// </summary>
        public List<E_CXJG> CXJGData { get; internal set; }

        /// <summary>
        /// 查询结果
        /// 文件格式:委托日期|CMT编号|交易金额|人行交易序号|发起清算行行号(账号) |付款人姓名|接收行清算行号|收款人账号|收款人姓名|交易行行号|记账账号
        /// </summary>
        public class E_CXJG
        {
            /// <summary>
            /// 委托日期
            /// </summary>
            public string WTRQ { get; set; }

            /// <summary>
            /// CMT编号
            /// </summary>
            public string CMTBH { get; set; }

            /// <summary>
            /// 交易金额
            /// </summary>
            public string JYJE { get; set; }

            /// <summary>
            /// 人行交易序号
            /// </summary>
            public string RXJYXH { get; set; }

            /// <summary>
            /// 发起清算行行号(账号) 
            /// </summary>
            public string FQQSXXHZH { get; set; }

            /// <summary>
            /// 付款人姓名
            /// </summary>
            public string FKRXM { get; set; }

            /// <summary>
            /// 接收行清算行号
            /// </summary>
            public string JSXQSXH { get; set; }

            /// <summary>
            /// 收款人账号
            /// </summary>
            public string SKRZH { get; set; }

            /// <summary>
            /// 收款人姓名
            /// </summary>
            public string SKRXM { get; set; }

            /// <summary>
            /// 交易行行号
            /// </summary>
            public string JYXXH { get; set; }

            /// <summary>
            /// 记账账号
            /// </summary>
            public string JZZH { get; set; }

        }

        #endregion

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


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

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.CXJGData = AnilyzeFileData<E_CXJG>(MessageData.FileData,
                                            "委托日期|CMT编号|交易金额|人行交易序号|发起清算行行号(账号) |付款人姓名|接收行清算行号|收款人账号|收款人姓名|交易行行号|记账账号|",
                                            x =>
                                            {
                                                return new E_CXJG
                                                {
                                                    WTRQ = x["委托日期"],
                                                    CMTBH = x["CMT编号"],
                                                    JYJE = x["交易金额"],
                                                    RXJYXH = x["人行交易序号"],
                                                    FQQSXXHZH = x["发起清算行行号(账号) "],
                                                    FKRXM = x["付款人姓名"],
                                                    JSXQSXH = x["接收行清算行号"],
                                                    SKRZH = x["收款人账号"],
                                                    SKRXM = x["收款人姓名"],
                                                    JYXXH = x["交易行行号"],
                                                    JZZH = x["记账账号"]
                                                };
                                            });
                output.CXJG = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
