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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 9598查询-282901-特殊协定利息计算登记簿
    /// 282901-特殊协定利息计算登记簿
    /// </summary>
    public class QuerySpecialAgreedRateList : 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 ZH { get; set; }

            /// <summary>
            /// 利息金额
            /// </summary>
            public string LXJE { get; set; }

            /// <summary>
            /// 总计利息金额
            /// </summary>
            public string ZJLXJE { get; set; }

        }

        #endregion

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


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

                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
                                                {
                                                    ZH = x["账号"],
                                                    LXJE = x["利息金额"],
                                                    ZJLXJE = x["总计利息金额"]
                                                };
                                            });
                output.CXJG = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
