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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 9598查询-700101-查询凭证柜员权限表
    /// 700101-查询凭证柜员权限表
    /// </summary>
    public class QueryCertificateTellerPowerList : TFOutput
    {
        #region Output
        /// <summary>
        /// 查询结果
        /// 文件格式:机构编码|柜员编号|柜员凭证|权限|凭证种类|启用标志
        /// </summary>
        public string CXJG { get; internal set; }

        /// <summary>
        /// 查询结果
        /// 文件格式:机构编码|柜员编号|柜员凭证|权限|凭证种类|启用标志
        /// </summary>
        public List<E_CXJG> CXJGData { get; internal set; }

        /// <summary>
        /// 查询结果
        /// 文件格式:机构编码|柜员编号|柜员凭证|权限|凭证种类|启用标志
        /// </summary>
        public class E_CXJG
        {
            /// <summary>
            /// 机构编码
            /// </summary>
            public string JGBM { get; set; }

            /// <summary>
            /// 柜员编号
            /// </summary>
            public string GYBH { get; set; }

            /// <summary>
            /// 柜员凭证
            /// </summary>
            public string GYPZ { get; set; }

            /// <summary>
            /// 权限
            /// </summary>
            public string QX { get; set; }

            /// <summary>
            /// 凭证种类
            /// </summary>
            public string PZZL { get; set; }

            /// <summary>
            /// 启用标志
            /// </summary>
            public string QYBZ { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 查询条件 
            /// 柜员号
            /// </summary>
            public string GYH { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryCertificateTellerPowerList();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "9598";
                MessageData.Fd123 = string.Format("1,700101,{0},",GYH);

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.CXJGData = AnilyzeFileData<E_CXJG>(MessageData.FileData,
                                            "机构编码|柜员编号|柜员凭证|权限|凭证种类|启用标志|",
                                            x =>
                                            {
                                                return new E_CXJG
                                                {
                                                    JGBM = x["机构编码"],
                                                    GYBH = x["柜员编号"],
                                                    GYPZ = x["柜员凭证"],
                                                    QX = x["权限"],
                                                    PZZL = x["凭证种类"],
                                                    QYBZ = x["启用标志"]
                                                };
                                            });
                output.CXJG = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
