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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 获取利率
    /// 根据输入的币种、计息类型获取利率
    /// </summary>
    public class GetRates : TFOutput
    {
        #region Output
        /// <summary>
        /// 利率 0840
        /// (null)
        /// </summary>
        public string LL { get; internal set; }


        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 币种 0210
            /// (null) 
            /// </summary>
            public string BZ { get; set; }

            /// <summary>
            /// 利率编号 0230
            /// (null) 
            /// </summary>
            public string LLBH { get; set; }

            /// <summary>
            /// 利率日期 0440
            /// 如果为当前挂牌利率可输入当前日期 
            /// </summary>
            public string LLRQ { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new GetRates();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K011";
                MessageData.Fd21 = BZ;
                MessageData.Fd23 = LLBH;
                MessageData.Fd44 = LLRQ;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.LL = DelSpace(MessageData.Fd84);

                return output;
            }
        }
        #endregion
    }
}
