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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 冻结登记簿查询
    /// 根据账号、序号查询冻结登记簿
    /// </summary>
    public class QueryFreezeList : TFOutput
    {
        #region Output
        /// <summary>
        /// 冻结登记簿信息
        /// 文件格式：冻结止付序号|冻结止付类型|计划冻结金额|起始日期|解除日期|机构号|操作员|说明|冻结止付标志|止付种类|冻结执法机关|冻结法律文书编号| 
        /// </summary>
        public string DJXX { get; internal set; }

        /// <summary>
        /// 冻结登记簿信息
        /// 文件格式：冻结止付序号|冻结止付类型|计划冻结金额|起始日期|解除日期|机构号|操作员|说明|冻结止付标志|止付种类|冻结执法机关|冻结法律文书编号| 
        /// </summary>
        public List<E_DJXX> DJXXData { get; internal set; }

        /// <summary>
        /// 冻结登记簿信息
        /// 文件格式：冻结止付序号|冻结止付类型|计划冻结金额|起始日期|解除日期|机构号|操作员|说明|冻结止付标志|止付种类|冻结执法机关|冻结法律文书编号| 
        /// </summary>
        public class E_DJXX
        {
            /// <summary>
            /// 冻结止付序号
            /// </summary>
            public string DJZFXH { get; set; }

            /// <summary>
            /// 冻结止付类型
            /// </summary>
            public string DJZFLX { get; set; }

            /// <summary>
            /// 计划冻结金额
            /// </summary>
            public string JHDJJE { get; set; }

            /// <summary>
            /// 起始日期
            /// </summary>
            public string QSRQ { get; set; }

            /// <summary>
            /// 解除日期
            /// </summary>
            public string JCRQ { get; set; }

            /// <summary>
            /// 机构号
            /// </summary>
            public string JGH { get; set; }

            /// <summary>
            /// 操作员
            /// </summary>
            public string CZY { get; set; }

            /// <summary>
            /// 说明
            /// </summary>
            public string SM { get; set; }

            /// <summary>
            /// 冻结止付标志
            /// </summary>
            public string DJZFBZ { get; set; }

            /// <summary>
            /// 止付种类
            /// </summary>
            public string ZFZL { get; set; }

            /// <summary>
            /// 冻结执法机关
            /// </summary>
            public string DJZFJG { get; set; }

            /// <summary>
            /// 冻结法律文书编号
            /// </summary>
            public string DJFLWSBH { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 账号 0310
            ///  
            /// </summary>
            public string ZH { get; set; }

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

            /// <summary>
            /// 标志 0660
            /// 2:冻结扣划只显示冻结记录 4:止付扣划时只显示止付记录,空值返回全部记录 
            /// </summary>
            public string BZ { get; set; }

            /// <summary>
            /// 状态 0670
            /// 0:未解除；1:解除，空值返回所有状态 
            /// </summary>
            public string ZT { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryFreezeList();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "CXCL";
                MessageData.Fd31 = ZH;
                MessageData.Fd34 = ZHXH;
                MessageData.Fd66 = BZ;
                MessageData.Fd128 = "0043";
                MessageData.Fd67 = ZT;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.DJXXData = AnilyzeFileData<E_DJXX>(MessageData.FileData,
                                            "冻结止付序号|冻结止付类型|计划冻结金额|起始日期|解除日期|机构号|操作员|说明|冻结止付标志|止付种类|冻结执法机关|冻结法律文书编号| ",
                                            x =>
                                            {
                                                return new E_DJXX
                                                {
                                                    DJZFXH = x["冻结止付序号"],
                                                    DJZFLX = x["冻结止付类型"],
                                                    JHDJJE = x["计划冻结金额"],
                                                    QSRQ = x["起始日期"],
                                                    JCRQ = x["解除日期"],
                                                    JGH = x["机构号"],
                                                    CZY = x["操作员"],
                                                    SM = x["说明"],
                                                    DJZFBZ = x["冻结止付标志"],
                                                    ZFZL = x["止付种类"],
                                                    DJZFJG = x["冻结执法机关"],
                                                    DJFLWSBH = x["冻结法律文书编号"]
                                                };
                                            });
                output.DJXX = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
