Exemple #1
0
        /// <summary>
        /// 银企业直连完整报文
        /// </summary>
        /// <param name="parmaKeyDict"></param>
        /// <param name="hServType">服务类型 01:请求02:应答</param>
        /// <param name="IsSpecialLine">是否为专线 默认为false</param>
        /// <returns></returns>
        private List <string> GetBankEnterpriseMessage(ExHashTable parmaKeyDict, string hServType, bool IsSpecialLine = false)
        {
            //业务报文体
            string bankEnterpriseMessageBody = GetTranMessageBody(parmaKeyDict, hServType);

            parmaKeyDict.Add("MessageBody", bankEnterpriseMessageBody);
            parmaKeyDict.Add("ServType", hServType);
            //通讯报文头
            string bankEnterpriseNetHead = IsSpecialLine ? "" : GetBankEnterpriseNetHead(parmaKeyDict);
            //附件报文头
            string bankEnterpriseAttachNetHead = GetBankEnterpriseAttachNetHead(parmaKeyDict);
            //完整请求报文
            var list = new List <string>();

            list.Add(bankEnterpriseNetHead);
            list.Add(bankEnterpriseMessageBody);
            list.Add(bankEnterpriseAttachNetHead);
            return(list);
        }
Exemple #2
0
        /// <summary>
        /// 生成现货接口请求响应的完整报文
        /// </summary>
        /// <param name="parmaKeyDict"></param>
        /// <param name="hServType">服务类型 01:请求02:应答</param>
        /// <param name="IsSpecialLine">是否为专线 默认为false</param>
        /// <returns></returns>
        public string GetTranMessage(ExHashTable parmaKeyDict, string hServType, bool IsSpecialLine = false)
        {
            //业务报文体
            string tranMessageBody = GetTranMessageBody(parmaKeyDict, hServType);

            parmaKeyDict.Add("MessageBody", tranMessageBody);
            parmaKeyDict.Add("ServType", hServType);
            //业务报文头
            string tranMessageHead = GetTranMessageHead(parmaKeyDict);
            //通讯报文头
            string tranMessageNetHead = IsSpecialLine ? "" : GetTranMessageNetHead(parmaKeyDict);
            //完整请求报文
            string tranMessage = string.Format("{0}{1}{2}",
                                               tranMessageNetHead,
                                               tranMessageHead,
                                               tranMessageBody
                                               );

            return(tranMessage);
        }
Exemple #3
0
        /// <summary>
        /// 将对象映射到hashTable
        /// </summary>
        /// <typeparam name="T">实例对象类型</typeparam>
        /// <param name="model">实例对象</param>
        /// <param name="hashTable">hashTable</param>
        /// <returns></returns>
        public static void ModelToHashTable <T>(T model, ExHashTable hashTable)
        {
            Type type  = model.GetType();
            var  props = type.GetProperties(BindingFlags.Instance | BindingFlags.Public);

            foreach (PropertyInfo property in props)
            {
                var name = property.Name;
                var val  = Convert.ChangeType(property.GetValue(model), property.PropertyType);
                if (val == null)
                {
                    val = "";
                }
                if (!hashTable.ContainsKey(name))
                {
                    hashTable.Add(name, val.ToString());
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// 初始化返回结果的结构
        /// </summary>
        /// <param name="rspMsg">初始化描述</param>
        /// <returns></returns>
        public static ExHashTable InitRetDict(string rspMsg)
        {
            ExHashTable retKeyDict = new ExHashTable();

            retKeyDict.Add("Data", "");          //接收到的原始数据
            retKeyDict.Add("TranFunc", "");      //交易码
            retKeyDict.Add("TargetSystem", "");  //接入系统
            retKeyDict.Add("BodyMsg", "");       //响应内容
            retKeyDict.Add("RspCode", "INT000"); //响应码 INT000初始码
            retKeyDict.Add("RspMsg", rspMsg);    //响应描述
            retKeyDict.Add("TrandateTime", "");  //交易日期
            retKeyDict.Add("RspMsgLength", "0"); //响应数据长度
            retKeyDict.Add("Qydm", "");          //企业标识代码
            retKeyDict.Add("ThirdLogNo", "");    //请求流水号
            retKeyDict.Add("CounterId", "");     //操作员
            return(retKeyDict);
        }