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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 短信明细信息查询
    /// 短信明细信息查询
    /// </summary>
    public class QuerySMSList : 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 KHZKH { get; set; }

            /// <summary>
            /// 柜员
            /// </summary>
            public string GY { get; set; }

            /// <summary>
            /// 交易日期
            /// </summary>
            public string JYRQ { get; set; }

            /// <summary>
            /// 交易时间
            /// </summary>
            public string JYSJ { get; set; }

            /// <summary>
            /// 流水号
            /// </summary>
            public string LSH { get; set; }

            /// <summary>
            /// 手机号码
            /// </summary>
            public string SJHM { get; set; }

            /// <summary>
            /// 发送标志
            /// </summary>
            public string FSBZ { get; set; }

            /// <summary>
            /// 信息内容(发生额)
            /// </summary>
            public string XXNRFSE { get; set; }

            /// <summary>
            /// 信息内容(余额)
            /// </summary>
            public string XXNRYE { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 客户账号 0370
            ///  
            /// </summary>
            public string KHZH { get; set; }

            /// <summary>
            /// 手机号码 0620
            ///  
            /// </summary>
            public string SJHM { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QuerySMSList();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "CXCL";
                MessageData.Fd37 = KHZH;
                MessageData.Fd62 = SJHM;
                MessageData.Fd128 = "0066";

                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
                                                {
                                                    KHZKH = x["客户帐/卡号"],
                                                    GY = x["柜员"],
                                                    JYRQ = x["交易日期"],
                                                    JYSJ = x["交易时间"],
                                                    LSH = x["流水号"],
                                                    SJHM = x["手机号码"],
                                                    FSBZ = x["发送标志"],
                                                    XXNRFSE = x["信息内容(发生额)"],
                                                    XXNRYE = x["信息内容(余额)"]
                                                };
                                            });
                output.WJ = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
