private void TestForReturn(CoreBizMsgDataBase rData, StringBuilder result)
 {
     if (rData == null)
     {
         result.AppendFormat("The Core's result object is null!");
     }
     else
     {
         result.AppendFormat("Core Status:{0}", rData.RPhdrHandler.STATUS);
         if (rData.SyserrHandler.Message != null)
         {
             result.AppendLine();
             result.AppendFormat("SYSERROR:{0};", rData.SyserrHandler.Message);
         }
         if (rData.OmsgHandler.OMSGItemList != null && rData.OmsgHandler.OMSGItemList.Count > 0)
         {
             result.AppendLine();
             result.AppendFormat("OMSG:{0};", rData.OmsgHandler.OMSGItemList[0].MSG_TEXT);
         }
     }
 }
        private void TestForMulti2One(StringBuilder result, CoreBizMsgDataBase respData)
        {
            AcctRecordMulti2OneData recorddata = respData as AcctRecordMulti2OneData;

            if (!String.IsNullOrEmpty(recorddata.RPhdrHandler.SEQ_NO))
            {
                result.AppendFormat("此交易流水号:{0}", recorddata.RPhdrHandler.SEQ_NO);
                result.AppendLine();
            }

            if (recorddata.OmsgHandler.NUM_ENT > 0)
            {
                result.AppendFormat("OMSG:{0} item(s)", recorddata.OmsgHandler.NUM_ENT);
                result.AppendLine();
                foreach (OMSG_Item_Handler omsgItem in recorddata.OmsgHandler.OMSGItemList)
                {
                    result.AppendFormat("MOD_ID:{0};MSG_NO:{1};MSG_TYPE:{2};MSG_TEXT:{3};", omsgItem.MOD_ID, omsgItem.MSG_NO, omsgItem.MSG_TYPE, omsgItem.MSG_TEXT);
                    result.AppendLine();
                }
            }
            if (recorddata.OData.OdataItemList.Count > 0)
            {
                result.Append("返回的分录:");
                result.AppendLine();
                foreach (AcctRecordMulti2OneODATA_Item item in recorddata.OData.OdataItemList)
                {
                    result.AppendFormat("账号:{0};科目号:{1};币种:{2};借贷标志:{3};金额{4};分录序号:{5}.", item.ACCT, item.GL_NO, item.CCY, item.CD_IND, item.AMT, item.GL_SEQ);
                    result.AppendLine();
                }

            }
            if (recorddata.OData.OdataPendingList.Count > 0)
            {
                result.Append("返回的挂账记录:");
                result.AppendLine();
                foreach (AcctRecordMulti2OneODATA_PendingItem item in recorddata.OData.OdataPendingList)
                {
                    result.AppendFormat("套内序号:{0};挂账账号:{1};挂账序号:{2};挂账金额:{3}.", item.InnerSN, item.PendingAccount, item.PendingSN, item.PendingAmount);
                    result.AppendLine();
                }
            }

            if (recorddata.OData.OdataItemList.Count == 0 && recorddata.OData.OdataPendingList.Count == 0)
            {
                result.Append("ODATA:");
                result.AppendLine();
                result.Append(recorddata.OData.RespOdata);
            }
            if (!String.IsNullOrEmpty(recorddata.SyserrHandler.Message))
            {
                result.AppendFormat("SYSERR:{0}", recorddata.SyserrHandler.Message);
            }
        }
        private String TestForAcctRecord(StringBuilder result, CoreBizMsgDataBase respData)
        {
            AcctRecordData recorddata = respData as AcctRecordData;

            if (!String.IsNullOrEmpty(recorddata.RPhdrHandler.SEQ_NO))
            {
                result.AppendFormat("此交易流水号:{0}", recorddata.RPhdrHandler.SEQ_NO);
                result.AppendLine();
            }

            if (recorddata.OmsgHandler.NUM_ENT > 0)
            {
                result.AppendFormat("OMSG:{0} item(s)", recorddata.OmsgHandler.NUM_ENT);
                result.AppendLine();
                foreach (OMSG_Item_Handler omsgItem in recorddata.OmsgHandler.OMSGItemList)
                {
                    result.AppendFormat("MOD_ID:{0};MSG_NO:{1};MSG_TYPE:{2};MSG_TEXT:{3};", omsgItem.MOD_ID, omsgItem.MSG_NO, omsgItem.MSG_TYPE, omsgItem.MSG_TEXT);
                    result.AppendLine();
                }
            }
            if (!String.IsNullOrEmpty(recorddata.OData.RespOdata))
            {
                result.Append("ODATA:");
                result.AppendLine();
                result.Append(recorddata.OData.RespOdata);
                result.AppendLine();
            }
            if (!String.IsNullOrEmpty(recorddata.SyserrHandler.Message))
            {
                result.AppendFormat("SYSERR:{0}", recorddata.SyserrHandler.Message);
            }

            return result.ToString();
        }
 public static String ExtractOMsg(CoreBizMsgDataBase coremsg)
 {
     if (coremsg == null || coremsg.OmsgHandler == null)
     {
         return String.Empty;
     }
     StringBuilder outmsg = new StringBuilder();
     foreach (OMSG_Item_Handler item in coremsg.OmsgHandler.OMSGItemList)
     {
         outmsg.Append(item.MSG_TEXT);
         outmsg.AppendLine();
     }
     return outmsg.ToString();
 }
        private String TestForAddCstm(StringBuilder result, CoreBizMsgDataBase respData)
        {
            AddCstmData cstmdata = respData as AddCstmData;

            if (cstmdata.OmsgHandler.NUM_ENT > 0)
            {
                result.AppendFormat("OMSG:{0} item(s)", cstmdata.OmsgHandler.NUM_ENT);
                result.AppendLine();
                foreach (OMSG_Item_Handler omsgItem in cstmdata.OmsgHandler.OMSGItemList)
                {
                    result.AppendFormat("MOD_ID:{0};MSG_NO:{1};MSG_TYPE:{2};MSG_TEXT:{3};", omsgItem.MOD_ID, omsgItem.MSG_NO, omsgItem.MSG_TYPE, omsgItem.MSG_TEXT);
                    result.AppendLine();
                }
            }
            if (!String.IsNullOrEmpty(cstmdata.OData.CUS_CDE))
            {
                result.Append("ODATA:");
                result.AppendLine();
                result.AppendFormat("客户内码:{0}", cstmdata.OData.CUS_CDE);
                result.AppendLine();
            }
            if (!String.IsNullOrEmpty(cstmdata.SyserrHandler.Message))
            {
                result.AppendFormat("SYSERR:{0}", cstmdata.SyserrHandler.Message);
            }

            return result.ToString();
        }
        private String TestForRetrieveCstm(StringBuilder result, CoreBizMsgDataBase respData)
        {
            RetrieveCstmData cstmdata = respData as RetrieveCstmData;

            if (cstmdata.OmsgHandler.NUM_ENT > 0)
            {
                result.AppendFormat("OMSG:{0} item(s)", cstmdata.OmsgHandler.NUM_ENT);
                result.AppendLine();
                foreach (OMSG_Item_Handler omsgItem in cstmdata.OmsgHandler.OMSGItemList)
                {
                    result.AppendFormat("MOD_ID:{0};MSG_NO:{1};MSG_TYPE:{2};MSG_TEXT:{3};", omsgItem.MOD_ID, omsgItem.MSG_NO, omsgItem.MSG_TYPE, omsgItem.MSG_TEXT);
                    result.AppendLine();
                }
            }
            if (!String.IsNullOrEmpty(cstmdata.OData.CUS_CDE))
            {
                result.Append("ODATA:");
                result.AppendLine();
                result.AppendFormat("客户内码:{0}", cstmdata.OData.CUS_CDE);
                textBoxInterID.Text = cstmdata.OData.CUS_CDE;
                result.AppendLine();
                result.AppendFormat("客户号:{0}", cstmdata.OData.CUS_NO);
                result.AppendLine();
                result.AppendFormat("客户类型:{0}", cstmdata.OData.CUS_TYP);
                result.AppendLine();
                result.AppendFormat("客户名称:{0}", cstmdata.OData.CUS_NAM);
                textBoxCName.Text = cstmdata.OData.CUS_NAM;
                result.AppendLine();
                result.AppendFormat("其他名称:{0}", cstmdata.OData.CUS_ONAM);
                textBoxOName.Text = cstmdata.OData.CUS_ONAM;
                result.AppendLine();
                result.AppendFormat("国籍:{0}", cstmdata.OData.NATION);
                result.AppendLine();
                result.AppendFormat("贵宾类型:{0}", cstmdata.OData.VIP_TYP);
                result.AppendLine();
                result.AppendFormat("客户状态:{0}", cstmdata.OData.CUS_STS);
                result.AppendLine();
                result.AppendFormat("地址序号:{0}", cstmdata.OData.ADD_SN);
                result.AppendLine();
                result.AppendFormat("地址:{0}", cstmdata.OData.ADDR);
                textBoxAddress.Text = cstmdata.OData.ADDR;
                result.AppendLine();
                result.AppendFormat("电话序号:{0}", cstmdata.OData.TEL_SN);
                result.AppendLine();
                result.AppendFormat("电话号码:{0}", cstmdata.OData.TEL_NO);
                textBoxTelNO.Text = cstmdata.OData.TEL_NO;
                result.AppendLine();
                result.AppendFormat("手机号码:{0}", cstmdata.OData.MBL_NO);
                textBoxMblNO.Text = cstmdata.OData.MBL_NO;
                result.AppendLine();
                result.AppendFormat("邮编:{0}", cstmdata.OData.ZIP);
                textBoxZip.Text = cstmdata.OData.ZIP;
                result.AppendLine();
                result.AppendFormat("区域类型:{0}", cstmdata.OData.CMB_QYLX);
                result.AppendLine();
                result.AppendFormat("建立机构:{0}", cstmdata.OData.CRT_PDT);
                result.AppendLine();
                result.AppendFormat("建立柜员:{0}", cstmdata.OData.CRT_OPR);
                result.AppendLine();
                result.AppendFormat("建立日期:{0}", cstmdata.OData.CRT_DTE);
                result.AppendLine();
                result.AppendFormat("更新机构:{0}", cstmdata.OData.UP_PDT);
                result.AppendLine();
                result.AppendFormat("更新柜员:{0}", cstmdata.OData.UP_OPR);
                result.AppendLine();
                result.AppendFormat("更新日期:{0}", cstmdata.OData.UP_DTE);
                result.AppendLine();
            }
            if (!String.IsNullOrEmpty(cstmdata.SyserrHandler.Message))
            {
                result.AppendFormat("SYSERR:{0}", cstmdata.SyserrHandler.Message);
            }

            return result.ToString();
        }
        private String TestForAcctErase(StringBuilder result, CoreBizMsgDataBase respData)
        {
            AcctEraseData recorddata = respData as AcctEraseData;

            if (recorddata == null)
            {
                return result.ToString();
            }

            if (recorddata.OmsgHandler.NUM_ENT > 0)
            {
                result.AppendFormat("OMSG:{0} item(s)", recorddata.OmsgHandler.NUM_ENT);
                result.AppendLine();
                foreach (OMSG_Item_Handler omsgItem in recorddata.OmsgHandler.OMSGItemList)
                {
                    result.AppendFormat("MOD_ID:{0};MSG_NO:{1};MSG_TYPE:{2};MSG_TEXT:{3};", omsgItem.MOD_ID, omsgItem.MSG_NO, omsgItem.MSG_TYPE, omsgItem.MSG_TEXT);
                    result.AppendLine();
                }
            }
            if (recorddata.OData != null)
            {
                if (recorddata.OData.DB_BY999000 != null)
                {
                    result.Append("ODATA:");
                    result.AppendLine();
                    result.AppendFormat("BY999000:");
                    result.AppendLine();
                    result.AppendFormat("反交易时间:{0};反交易流水号:{1};交易日期:{2};交易时间:{3};交易柜员号:{4};交易码:{5};交易流水号:{6}.",
                        recorddata.OData.DB_BY999000.TIME, recorddata.OData.DB_BY999000.JNO, recorddata.OData.DB_BY999000.Date, recorddata.OData.DB_BY999000.TX_TIME, recorddata.OData.DB_BY999000.TEL_NO,recorddata.OData.DB_BY999000.TX_ID, recorddata.OData.DB_BY999000.TX_JNO);
                    result.AppendLine();
                }

                if (recorddata.OData.DB_BY999001_List.Count > 0)
                {
                    result.AppendFormat("BY999001:{0} item(s)!", recorddata.OData.DB_BY999001_List.Count);
                    result.AppendLine();
                }
                int i = 0;
                foreach (AcctEraseODATA_DB2 item in recorddata.OData.DB_BY999001_List)
                {
                    result.AppendFormat("No.{0}:  账号:{1};户名:{2};借/贷标志:{3};交易金额:{4};交易币种:{5}.",
                        i, item.ACC_NO, item.ACC_NAME, item.DRCR_IND, item.TX_AMT, item.TX_CCY);
                    result.AppendLine();
                    i++;
                }
            }

            if (!String.IsNullOrEmpty(recorddata.SyserrHandler.Message))
            {
                result.AppendFormat("SYSERR:{0}", recorddata.SyserrHandler.Message);
            }

            return result.ToString();
        }
        private String TestForRetrieveRecord(StringBuilder result, CoreBizMsgDataBase respData)
        {
            AcctRetrieveData recorddata = respData as AcctRetrieveData;

            if (recorddata == null)
            {
                return result.ToString();
            }

            if (recorddata.OmsgHandler.NUM_ENT > 0)
            {
                result.AppendFormat("OMSG:{0} item(s)", recorddata.OmsgHandler.NUM_ENT);
                result.AppendLine();
                foreach (OMSG_Item_Handler omsgItem in recorddata.OmsgHandler.OMSGItemList)
                {
                    result.AppendFormat("MOD_ID:{0};MSG_NO:{1};MSG_TYPE:{2};MSG_TEXT:{3};", omsgItem.MOD_ID, omsgItem.MSG_NO, omsgItem.MSG_TYPE, omsgItem.MSG_TEXT);
                    result.AppendLine();
                }
            }
            if (recorddata.OData!= null)
            {
                result.Append("ODATA:");
                result.AppendLine();

                if (recorddata.OData.DB_BGO30800 != null && !String.IsNullOrEmpty(recorddata.OData.DB_BGO30800.CoreTradeSN))
                {
                    result.AppendFormat("BGO30800:");
                    result.AppendLine();
                    result.AppendFormat("核心交易流水号:{0};发起方系统代码{1};有会计流水标志{2};外系统跟踪号:{3};被抹账标志:{4}",
                        recorddata.OData.DB_BGO30800.CoreTradeSN, recorddata.OData.DB_BGO30800.SrcSystemCode, recorddata.OData.DB_BGO30800.AcctSNFlag, recorddata.OData.DB_BGO30800.OutsideSN, recorddata.OData.DB_BGO30800.ErasedFlag);
                    result.AppendLine();
                }

                if (recorddata.OData.DB_BGO30801_List.Count > 0)
                {
                    result.AppendFormat("BGO30801:{0} item(s)!", recorddata.OData.DB_BGO30801_List.Count);
                    result.AppendLine();
                }
                int i = 0;
                foreach (AcctRetrieveODATA_DB2 item in recorddata.OData.DB_BGO30801_List)
                {
                    result.AppendFormat("No.{0}:  核心交易流水号:{1};交易账号:{2};户名:{3};现转标志:{4};借贷标志:{5};金额:{6};凭证号码:{7};发起方系统代码:{8};入账配钞标志:{9}.",
                        i, item.CoreTradeSN, item.TradeAccount, item.AccountName, item.CashFalg, item.LoanFlag, item.Amount, item.VoucherNO, item.SrcSystemCode, item.PostingCashFlag);
                    result.AppendLine();
                    i++;
                }

                if (recorddata.OData.DB_BGO30802 != null)
                {
                    result.Append("BGO30802:");
                    result.AppendLine();
                    result.AppendFormat("是否配钞:{0};配钞笔数:{1}.", recorddata.OData.DB_BGO30802.IsQuotaMoney, recorddata.OData.DB_BGO30802.QuotaMoneyCount);
                    result.AppendLine();
                }
                if (recorddata.OData.DB_BGO30803_List.Count > 0)
                {
                    result.AppendFormat("BGO30803:{0} item(s)!", recorddata.OData.DB_BGO30803_List.Count);
                    result.AppendLine();
                }
                i = 0;
                foreach (AcctRetrieveODATA_DB4 item in recorddata.OData.DB_BGO30803_List)
                {
                    result.AppendFormat("No. {0}:  币种:{1};配钞金额:{2}", i, item.Currency, item.QuotaAmount);
                    result.AppendLine();
                    i++;
                }
            }
            
            if (!String.IsNullOrEmpty(recorddata.SyserrHandler.Message))
            {
                result.AppendFormat("SYSERR:{0}", recorddata.SyserrHandler.Message);
            }

            return result.ToString();
        }
        private String TestForAcctRecord(StringBuilder result, CoreBizMsgDataBase respData)
        {
            AcctRecordData recorddata = respData as AcctRecordData;

            if (!String.IsNullOrEmpty(recorddata.RPhdrHandler.SEQ_NO))
            {
                result.AppendFormat("此交易流水号:{0}", recorddata.RPhdrHandler.SEQ_NO);
                result.AppendLine();
            }

            if (recorddata.OmsgHandler.NUM_ENT > 0)
            {
                result.AppendFormat("OMSG:{0} item(s)", recorddata.OmsgHandler.NUM_ENT);
                result.AppendLine();
                foreach (OMSG_Item_Handler omsgItem in recorddata.OmsgHandler.OMSGItemList)
                {
                    result.AppendFormat("MOD_ID:{0};MSG_NO:{1};MSG_TYPE:{2};MSG_TEXT:{3};", omsgItem.MOD_ID, omsgItem.MSG_NO, omsgItem.MSG_TYPE, omsgItem.MSG_TEXT);
                    result.AppendLine();
                }
            }
            if (recorddata.OData.OdataItemList.Count > 0)
            {
                result.Append("ODATA:");
                result.AppendLine();
                foreach (AcctRecordODATA_Item item in recorddata.OData.OdataItemList)
                {
                    result.AppendFormat("账号:{0};科目号:{1};币种:{2};借贷标志:{3};金额{4};分录序号:{5}.",item.ACCT, item.GL_NO, item.CCY, item.CD_IND, item.AMT, item.GL_SEQ);
                    result.AppendLine();
                }              
                
            }
            else
            {
                result.Append("ODATA:");
                result.AppendLine();
                result.Append(recorddata.OData.RespOdata);
            }
            if (!String.IsNullOrEmpty(recorddata.SyserrHandler.Message))
            {
                result.AppendFormat("SYSERR:{0}", recorddata.SyserrHandler.Message);
            }

            return result.ToString();
        }