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 CheckBlackList_DQS:TFOutput
    {
        #region Output
        /// <summary>
        /// 1黑名单  0 不是黑名单
        /// null
        /// </summary>
        public string Result { get; internal set; }
        #endregion

        #region Input
        /// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {

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

            /// <summary>
            /// 账户序号
            /// (null) 
            /// </summary>
            public string ZHXH { get; set; }

            /// <summary>
            /// 证件类型
            /// 
            /// </summary>>
            public string ZJLX { get; set; }

            /// <summary>
            /// 证件号码
            /// (null)
            /// </summary>
            public string ZJHM { get; set; }

            /// <summary>
            /// 客户号
            /// (null)
            /// </summary>>
            public string KHH { get; set; }

            /// <summary>
            /// 是否行内客户报错标志
            /// (null)
            /// </summary>>
            public string SFHNKHBCBZ { get; set; }//核心建议Fd126_5传6255时，8855接口查不到客户时不报错。

            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new CheckBlackList_DQS();               
                MessageData.BitMapType = TellerSystem.Communication.Message.BitMap.Server;
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
                MessageData.Fd16 = "8855";
                MessageData.Fd28 = KHH;
                MessageData.Fd30 = ZH;
                MessageData.Fd116_4 = ZJLX;
                MessageData.Fd116_5 = ZJHM;

                if (!string.IsNullOrEmpty(SFHNKHBCBZ))
                    MessageData.Fd126_5 = SFHNKHBCBZ;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    this.TradeAPIs.ShowTip(PageData.TradeAPIs.GetError(MessageData));
                    this.TradeAPIs.SetFocus();
                    return output;
                }
                if (MessageData.Fd70.Substring(0, 1) == "1")//1黑名单  0 不是黑名单
                {
                    this.TradeAPIs.ShowTip("该客户为黑名单！");
                    if (!string.IsNullOrEmpty(SFHNKHBCBZ))
                    {
                        output.IsFailed = true;
                        output.FailureCause = "该客户为黑名单！";
                    }
                    this.TradeAPIs.SetFocus();
                    return output;
                }
                output.Result = MessageData.Fd70.Substring(0, 1); 
                return output;
            }
        }
        #endregion
    }
}
