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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 根据凭证类别查询凭证类型
    /// 查询介质属性表返回相关信息列表
    /// </summary>
    public class QueryVoucherTypeByClass : TFOutput
    {
        #region Output
        /// <summary>
        /// 凭证种类信息
        /// 后台返回文件，内容包括：凭证种类|凭证名称|
        /// </summary>
        public string PZZLXX { get; internal set; }

        /// <summary>
        /// 凭证种类信息
        /// 后台返回文件，内容包括：凭证种类|凭证名称|
        /// </summary>
        public List<E_PZZLXX> PZZLXXData { get; internal set; }

        /// <summary>
        /// 凭证种类信息
        /// 后台返回文件，内容包括：凭证种类|凭证名称|
        /// </summary>
        public class E_PZZLXX
        {
            /// <summary>
            /// 凭证种类
            /// </summary>
            public string PZZL { get; set; }

            /// <summary>
            /// 凭证名称
            /// </summary>
            public string PZMC { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 介质种类 0670
            ///  
            /// </summary>
            public string JZZL { get; set; }


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

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.PZZLXXData = AnilyzeFileData<E_PZZLXX>(MessageData.FileData,
                                            "凭证种类|凭证名称|",
                                            x =>
                                            {
                                                return new E_PZZLXX
                                                {
                                                    PZZL = x["凭证种类"],
                                                    PZMC = x["凭证名称"]
                                                };
                                            });
                output.PZZLXX = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
