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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 9598查询-540201-查询小额附加域主表
    /// 540201-查询小额附加域主表
    /// </summary>
    public class QueryMicroPaymentAttachList : 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 FJSJ { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 查询条件 
            /// 交易日期
            /// </summary>
            public string JYRQ { get; set; }

            /// <summary>
            /// 查询条件 
            /// 委托日期
            /// </summary>
            public string WTRQ { get; set; }

            /// <summary>
            /// 查询条件 
            /// 附加数据
            /// </summary>
            public string FJSJ { get; set; }


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

                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
                                                {
                                                    FJSJ = x["附加数据"]
                                                };
                                            });
                output.CXJG = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
