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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 收费业务费用编号查询
    /// 收费业务费用编号查询
    /// </summary>
    public class QueryFeeNumberList : TFOutput
    {
        #region Output
        /// <summary>
        /// 收费列表
        /// 文件附件:费用编号|费用名| 
        /// </summary>
        public string SFLB { get; internal set; }

        /// <summary>
        /// 收费列表
        /// 文件附件:费用编号|费用名| 
        /// </summary>
        public List<E_SFLB> SFLBData { get; internal set; }

        /// <summary>
        /// 收费列表
        /// 文件附件:费用编号|费用名| 
        /// </summary>
        public class E_SFLB
        {
            /// <summary>
            /// 费用编号
            /// </summary>
            public string FYBH { get; set; }

            /// <summary>
            /// 费用名
            /// </summary>
            public string FYM { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 一级收费类型 0490
            /// 1:结算业务手续费收入 2:工本费费收入 3:代理业务手续费收入 4:顾问及咨询业务收入 5:担保业务手续费收入 6:应付邮寄费 
            /// </summary>
            public string YJSFLX { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryFeeNumberList();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "CXCL";
                MessageData.Fd49 = YJSFLX;
                MessageData.Fd128 = "0041";

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.SFLBData = AnilyzeFileData<E_SFLB>(MessageData.FileData,
                                            "费用编号|费用名| ",
                                            x =>
                                            {
                                                return new E_SFLB
                                                {
                                                    FYBH = x["费用编号"],
                                                    FYM = x["费用名"]
                                                };
                                            });
                output.SFLB = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
