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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 批量查询柜员状态
    /// 批量查询柜员状态
    /// </summary>
    public class QueryTellerStatusBatch : TFOutput
    {
        #region Output
        /// <summary>
        /// 文件
        /// 文件格式:柜员号|柜员姓名|状态|状态描述|所属机构|
        /// </summary>
        public string WJ { get; internal set; }

        /// <summary>
        /// 文件
        /// 文件格式:柜员号|柜员姓名|状态|状态描述|所属机构|
        /// </summary>
        public List<E_WJ> WJData { get; internal set; }

        /// <summary>
        /// 文件
        /// 文件格式:柜员号|柜员姓名|状态|状态描述|所属机构|
        /// </summary>
        public class E_WJ
        {
            /// <summary>
            /// 柜员号
            /// </summary>
            public string GYH { get; set; }

            /// <summary>
            /// 柜员姓名
            /// </summary>
            public string GYXM { get; set; }

            /// <summary>
            /// 状态
            /// </summary>
            public string ZT { get; set; }

            /// <summary>
            /// 状态描述
            /// </summary>
            public string ZTMS { get; set; }

            /// <summary>
            /// 所属机构
            /// </summary>
            public string SSJG { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 柜员号 1230
            /// 柜员号|柜员号|...| 
            /// </summary>
            public string GYH { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryTellerStatusBatch();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K064";
                MessageData.Fd123 = GYH;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.WJData = AnilyzeFileData<E_WJ>(MessageData.FileData,
                                            "柜员号|柜员姓名|状态|状态描述|所属机构|",
                                            x =>
                                            {
                                                return new E_WJ
                                                {
                                                    GYH = x["柜员号"],
                                                    GYXM = x["柜员姓名"],
                                                    ZT = x["状态"],
                                                    ZTMS = x["状态描述"],
                                                    SSJG = x["所属机构"]
                                                };
                                            });
                output.WJ = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
