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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 柜员钱箱信息查询
    /// 根据相关要素，返回相应机构下所有柜员钱箱信息列表
    /// </summary>
    public class QueryTellerCashBox : TFOutput
    {
        #region Output
        /// <summary>
        /// 柜员钱箱信息列表
        /// 柜员号|柜员名称|启用状态|币种|余额|节假日限额 |日常限额|
        /// </summary>
        public string GYQXXXLB { get; internal set; }

        /// <summary>
        /// 柜员钱箱信息列表
        /// 柜员号|柜员名称|启用状态|币种|余额|节假日限额 |日常限额|
        /// </summary>
        public List<E_GYQXXXLB> GYQXXXLBData { get; internal set; }

        /// <summary>
        /// 柜员钱箱信息列表
        /// 柜员号|柜员名称|启用状态|币种|余额|节假日限额 |日常限额|
        /// </summary>
        public class E_GYQXXXLB
        {
            /// <summary>
            /// 柜员号
            /// </summary>
            public string GYH { get; set; }

            /// <summary>
            /// 柜员名称
            /// </summary>
            public string GYMC { get; set; }

            /// <summary>
            /// 启用状态
            /// </summary>
            public string QYZT { get; set; }

            /// <summary>
            /// 币种
            /// </summary>
            public string BZ { get; set; }

            /// <summary>
            /// 余额
            /// </summary>
            public string YE { get; set; }

            /// <summary>
            /// 节假日限额 
            /// </summary>
            public string JJRXE { get; set; }

            /// <summary>
            /// 日常限额
            /// </summary>
            public string RCXE { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 启用状态 0670
            /// 0-正常 1-锁定 
            /// </summary>
            public string QYZT { get; set; }

            /// <summary>
            /// 机构号 0910
            /// (null) 
            /// </summary>
            public string JGH { get; set; }

            /// <summary>
            /// 柜员号 0920
            /// (null) 
            /// </summary>
            public string GYH { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryTellerCashBox();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "CXCL";
                MessageData.Fd67 = QYZT;
                MessageData.Fd91 = JGH;
                MessageData.Fd92 = GYH;
                MessageData.Fd128 = "0020";

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.GYQXXXLBData = AnilyzeFileData<E_GYQXXXLB>(MessageData.FileData,
                                            "柜员号|柜员名称|启用状态|币种|余额|节假日限额 |日常限额|",
                                            x =>
                                            {
                                                return new E_GYQXXXLB
                                                {
                                                    GYH = x["柜员号"],
                                                    GYMC = x["柜员名称"],
                                                    QYZT = x["启用状态"],
                                                    BZ = x["币种"],
                                                    YE = x["余额"],
                                                    JJRXE = x["节假日限额 "],
                                                    RCXE = x["日常限额"]
                                                };
                                            });
                output.GYQXXXLB = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
