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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询定期存期类型
    /// 根据介质代码查询支持的定期产品存期类型
    /// </summary>
    public class QueryFixedDepositDateType : TFOutput
    {
        #region Output
        /// <summary>
        /// 定期存期类型列表
        /// 存期类型|类型名称|
        /// </summary>
        public string DQCQLXLB { get; internal set; }

        /// <summary>
        /// 定期存期类型列表
        /// 存期类型|类型名称|
        /// </summary>
        public List<E_DQCQLXLB> DQCQLXLBData { get; internal set; }

        /// <summary>
        /// 定期存期类型列表
        /// 存期类型|类型名称|
        /// </summary>
        public class E_DQCQLXLB
        {
            /// <summary>
            /// 存期类型
            /// </summary>
            public string CQLX { get; set; }

            /// <summary>
            /// 类型名称
            /// </summary>
            public string LXMC { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 介质代码 1161
            ///  
            /// </summary>
            public string JZDM { get; set; }


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

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.DQCQLXLBData = AnilyzeFileData<E_DQCQLXLB>(MessageData.FileData,
                                            "存期类型|类型名称|",
                                            x =>
                                            {
                                                return new E_DQCQLXLB
                                                {
                                                    CQLX = x["存期类型"],
                                                    LXMC = x["类型名称"]
                                                };
                                            });
                output.DQCQLXLB = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
