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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询委托贷款关系及可用余额
    /// 查询委托贷款基金户与收息户关系及基金户可用余额
    /// </summary>
    public class QueryRelationEntrustedLoanAndavailableBalance : TFOutput
    {
        #region Output
        /// <summary>
        /// 可用余额 0400
        /// 
        /// </summary>
        public string KYYE { get; internal set; }

        /// <summary>
        /// 关联是否正常 0670
        /// Y:正常；N:不正常
        /// </summary>
        public string GLSFZC { get; internal set; }

        /// <summary>
        /// 基金户 0300
        /// 由收息户查询基金户
        /// </summary>
        public string JJH { get; internal set; }


        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 基金户 0300
            ///  
            /// </summary>
            public string JJH { get; set; }

            /// <summary>
            /// 贷款户 0310
            ///  
            /// </summary>
            public string DKH { get; set; }

            /// <summary>
            /// 收息户 0320
            ///  
            /// </summary>
            public string SXH { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryRelationEntrustedLoanAndavailableBalance();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K017";
                MessageData.Fd30 = JJH;
                MessageData.Fd31 = DKH;
                MessageData.Fd32 = SXH;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.KYYE = (MessageData.Fd40);
                output.GLSFZC = (MessageData.Fd67);
                output.JJH = (MessageData.Fd30);

                return output;
            }
        }
        #endregion
    }
}
