using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using TellerSystem.ServiceProxy.Ext.ServiceHelper;

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 与平台通讯，查询账户黑白名单状态
    /// 黑名单-阻断，灰名单-提示，白名单-通过
    /// </summary>
    public class CheckAccountStat:TFOutput
    {
        #region Output
        /// <summary>
        /// 账户状态 0350
        /// 0-通过，1-阻断，2-提示
        /// </summary>
        public string ZHZT { get; internal set; }

        /// <summary>
        /// 描述 0760
        /// null
        /// </summary>
        public string MS { get; internal set; }

        /// <summary>
        /// 返回信息 0130
        /// null
        /// </summary>
        public string FHXX { get; internal set; }


        #endregion

        #region Input
        /// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 业务种类 0900
            /// A-取现,B-存现,C-转账,D-汇款,E-介质更换
            /// </summary>
            public string YWZL { get; set; }

            /// <summary>
            /// 账号 0300
            /// (null) 
            /// </summary>
            public string ZH { get; set; }

            /// <summary>
            /// 户名 0250
            /// (null) 
            /// </summary>
            public string ZHHM { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new CheckAccountStat();
                MessageData.BitMapType = TellerSystem.Communication.Message.BitMap.Agn;
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
                MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "0701";
                MessageData.Fd28 = "100701";
                MessageData.Fd18 = "GJFC";
                MessageData.Fd89 = "01";
                MessageData.Fd90 = YWZL;
                MessageData.Fd30 = ZH;
                MessageData.Fd25 = ZHHM;
                if (TradeManagerHandle.TT_SYSCONFIG_GetConfigValueByConfigID("488aafd20ec440a988fe4b8e3d71a641") != "1")
                {
                    output.ZHZT = "0";
                    return output;
                }
                PageData.TradeAPIs.CallAgn(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }
                output.ZHZT = (MessageData.Fd35);
                output.MS = (MessageData.Fd76);
                output.FHXX = (MessageData.Fd13);
                return output;
            }
        }
        #endregion
    }
}
