|
|
|
|
@ -0,0 +1,901 @@ |
|
|
|
|
using System; |
|
|
|
|
using System.IO; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Text; |
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
using System.Windows; |
|
|
|
|
using System.Windows.Controls; |
|
|
|
|
using System.Windows.Data; |
|
|
|
|
using System.Windows.Documents; |
|
|
|
|
using System.Windows.Input; |
|
|
|
|
using System.Windows.Media; |
|
|
|
|
using System.Windows.Media.Imaging; |
|
|
|
|
using System.Windows.Navigation; |
|
|
|
|
using System.Windows.Shapes; |
|
|
|
|
using System.Threading; |
|
|
|
|
using System.Security.Cryptography; |
|
|
|
|
using System.Windows.Threading; |
|
|
|
|
using n5coredll; |
|
|
|
|
|
|
|
|
|
namespace ECR_N5_DLL_TestUI |
|
|
|
|
{ |
|
|
|
|
public partial class MainWindow : Window |
|
|
|
|
{ |
|
|
|
|
private string portName = "COM3"; |
|
|
|
|
private string baudRate = "9600"; |
|
|
|
|
private string dataBits = "8"; |
|
|
|
|
private string stopBits = "One"; |
|
|
|
|
private string parity = "None"; |
|
|
|
|
private string timeOut = "12000"; |
|
|
|
|
|
|
|
|
|
private string thisEvent; |
|
|
|
|
|
|
|
|
|
public bool addLogFlag = true; |
|
|
|
|
|
|
|
|
|
public string currEventName = null; |
|
|
|
|
public string jsonResultByThead = null; |
|
|
|
|
public string requestStrByThead = null; |
|
|
|
|
public string showResultStr = null; |
|
|
|
|
public string txnAmtTextBoxValue = null; |
|
|
|
|
public string paymentAppIdComboBoxValue = null; |
|
|
|
|
public string qrValueTextBoxValue = null; |
|
|
|
|
public string ecrTxnIdTextBoxValue = null; |
|
|
|
|
public string panTextBoxValue = null; |
|
|
|
|
public string authCodeTextBoxValue = null; |
|
|
|
|
public string batchIdTextBoxValue = null; |
|
|
|
|
public string settleDateTextBoxValue = null; |
|
|
|
|
public string expDateTextBoxValue = null; |
|
|
|
|
public string oriTxnDateTextBoxValue = null; |
|
|
|
|
public string hostRefNoTextBoxValue = null; |
|
|
|
|
public string paymentTypeTextBoxValue = null; |
|
|
|
|
private n5coredll.N5Core n5Core = null; |
|
|
|
|
private bool n5CoreInitSuccess = false; |
|
|
|
|
|
|
|
|
|
private string txnIdForSale = null; |
|
|
|
|
private string txnIdForRefund = null; |
|
|
|
|
private string txnIdForPreAuth = null; |
|
|
|
|
private string txnIdForOffline = null; |
|
|
|
|
private string txnIdForAdjust = null; |
|
|
|
|
private string txnIdForCreateOrder = null; |
|
|
|
|
private string enquiryPeriod = null; |
|
|
|
|
|
|
|
|
|
private string saleRequestMsg = null; |
|
|
|
|
private string preAuthRequestMsg = null; |
|
|
|
|
private string offlineRequestMsg = null; |
|
|
|
|
private string adjustRequestMsg = null; |
|
|
|
|
private string createOrderRequestMsg = null; |
|
|
|
|
private string refundRequestMsg = null; |
|
|
|
|
private string retrievalRequestMsg = null; |
|
|
|
|
private string voidRequestMsg = null; |
|
|
|
|
private string settlementRequestMsg = null; |
|
|
|
|
private string getInfoRequestMsg = null; |
|
|
|
|
private string checkUpdateRequestMsg = null; |
|
|
|
|
private string executeUpdateRequestMsg = null; |
|
|
|
|
private string linkTestRequestMsg = null; |
|
|
|
|
private string reprintRequestMsg = null; |
|
|
|
|
private string terminaionRequestMsg = null; |
|
|
|
|
private string scanRequestMsg = null; |
|
|
|
|
private string readCardRequestMsg = null; |
|
|
|
|
private string addPointRequestMsg = null; |
|
|
|
|
private string batchEnquiryRequestMsg = null; |
|
|
|
|
private string settleEnquiryRequestMsg = null; |
|
|
|
|
private string summaryEnquiryRequestMsg = null; |
|
|
|
|
private string checkHealthRequestMsg = null; |
|
|
|
|
|
|
|
|
|
private Boolean isRepeatSubmit = false; |
|
|
|
|
private string timeout = "300000"; |
|
|
|
|
public MainWindow() |
|
|
|
|
{ |
|
|
|
|
InitializeComponent(); |
|
|
|
|
} |
|
|
|
|
private void requestSummaryEnquiryThead() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
jsonResultByThead = n5Core.sendSummaryEnquiryRequest(enquiryPeriod, timeout); |
|
|
|
|
this.requestStrByThead = this.summaryEnquiryRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
private void requestSaleThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.requestSale(txnIdForSale, txnAmtTextBoxValue, "0", paymentAppIdComboBoxValue, qrValueTextBoxValue, timeout); |
|
|
|
|
this.requestStrByThead = this.saleRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void requestRefundThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.requestRefund(txnIdForRefund, txnAmtTextBoxValue, paymentAppIdComboBoxValue, qrValueTextBoxValue, oriTxnDateTextBoxValue, hostRefNoTextBoxValue , timeout); |
|
|
|
|
this.requestStrByThead = this.refundRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
private void requestRetrievalThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.requestRetrieval(ecrTxnIdTextBoxValue, timeout); |
|
|
|
|
this.requestStrByThead = this.retrievalRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
private void requestRepeatRetrievalThead() |
|
|
|
|
{ |
|
|
|
|
while (isRepeatSubmit) |
|
|
|
|
{ |
|
|
|
|
/* |
|
|
|
|
String result = n5Core.requestRetrieval(ecrTxnIdTextBoxValue, 10000); |
|
|
|
|
addRepeatLog("=============================count" + repeatCount + "============================="); |
|
|
|
|
addRepeatLog("ecrTxnId = " + ecrTxnIdTextBoxValue); |
|
|
|
|
|
|
|
|
|
RetrievalResult retrievalResult = RetrievalResult.toRetrievalResultFromJsonMsg(result);*/ |
|
|
|
|
String result = n5Core.requestSale(getTxnId(), "10", "0", "CC", "", "30000"); |
|
|
|
|
addRepeatLog("=============================count" + repeatCount + "============================="); |
|
|
|
|
addRepeatLog("ecrTxnId = " + ecrTxnIdTextBoxValue); |
|
|
|
|
|
|
|
|
|
SaleResult saleResult = SaleResult.toSaleResultFromJsonMsg(result); |
|
|
|
|
addRepeatLog("Sale Result:" + saleResult.Status); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
private void requestVoidThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.requestVoid(ecrTxnIdTextBoxValue, qrValueTextBoxValue, timeout); |
|
|
|
|
this.requestStrByThead = this.voidRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void requestSettlementThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.sendSettlementtRequest(timeout); |
|
|
|
|
this.requestStrByThead = this.settlementRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void requesGetInfoThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.requestGetInfo(timeout); |
|
|
|
|
this.requestStrByThead = this.getInfoRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void requesCheckUpdateThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.checkUpdate(timeout); |
|
|
|
|
this.requestStrByThead = this.checkUpdateRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void requesExecuteUpdateThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.executeUpdate(timeout); |
|
|
|
|
this.requestStrByThead = this.executeUpdateRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void requestLinkRequestThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.sendLinkTestRequest(timeout); |
|
|
|
|
this.requestStrByThead = this.linkTestRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void requestReprintThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.sendReprintRequest(ecrTxnIdTextBoxValue, timeout); |
|
|
|
|
this.requestStrByThead = this.reprintRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void requestTerminaionThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.sendAbortRequest(); |
|
|
|
|
this.requestStrByThead = this.terminaionRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void requestBatchEnquiryThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.sendBatchEnquiryRequest(settleDateTextBoxValue, timeout); |
|
|
|
|
this.requestStrByThead = this.batchEnquiryRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void requestSettleEnquiryThead() |
|
|
|
|
{ |
|
|
|
|
jsonResultByThead = n5Core.sendSettleEnquiryRequest(batchIdTextBoxValue, timeout); |
|
|
|
|
this.requestStrByThead = this.settleEnquiryRequestMsg; |
|
|
|
|
showResult(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int repeatCount = 1; |
|
|
|
|
public void sendRepeatSubmit() |
|
|
|
|
{ |
|
|
|
|
if (n5Core == null || !n5CoreInitSuccess) |
|
|
|
|
{ |
|
|
|
|
n5Core = n5coredll.N5Core.getInstance(); |
|
|
|
|
int initResult = n5Core.initN5Core(portName, baudRate, dataBits, stopBits, parity, timeOut); |
|
|
|
|
if (initResult == 0) |
|
|
|
|
{ |
|
|
|
|
n5CoreInitSuccess = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
ecrTxnIdTextBoxValue = ecrTxnIdTextBox.Text; |
|
|
|
|
Thread th = new Thread(requestRepeatRetrievalThead); |
|
|
|
|
th.Start(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void stopRepeatSubmit() |
|
|
|
|
{ |
|
|
|
|
repeatCount = 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void sendSubmit() |
|
|
|
|
{ |
|
|
|
|
addLogFlag = true; |
|
|
|
|
addLog("====>> sendSubmit start, thisEvent = " + this.thisEvent); |
|
|
|
|
currEventName = this.thisEvent; |
|
|
|
|
if (currEventName == null || "".Equals(currEventName.Trim())) { |
|
|
|
|
MessageBox.Show("Please select test function.", "Message"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
portName = this.portNameComboBox.Text; |
|
|
|
|
if (n5Core == null || !n5CoreInitSuccess) |
|
|
|
|
{ |
|
|
|
|
n5Core = n5coredll.N5Core.getInstance(); |
|
|
|
|
int initResult = n5Core.initN5Core(portName, baudRate, dataBits, stopBits, parity, timeOut); |
|
|
|
|
//if (initResult == 0) |
|
|
|
|
//{ |
|
|
|
|
n5CoreInitSuccess = true; |
|
|
|
|
//} |
|
|
|
|
} |
|
|
|
|
if (!n5CoreInitSuccess) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "n5coredll init fail."; |
|
|
|
|
this.jsonResultByThead = string.Empty; |
|
|
|
|
showResult(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.requestStrByThead = string.Empty; |
|
|
|
|
this.jsonResultByThead = string.Empty; |
|
|
|
|
int show = showResult(); |
|
|
|
|
if (show != 0) |
|
|
|
|
{ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ("Sale".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
if (this.txnAmtTextBox.Text == null || "".Equals(this.txnAmtTextBox.Text.Trim())) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Please input parameter."; |
|
|
|
|
this.jsonResultByThead = "Please input parameter."; |
|
|
|
|
showResult(); |
|
|
|
|
this.txnAmtTextBox.Focus(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
else if (this.paymentAppIdComboBox.Text == null || "".Equals(this.paymentAppIdComboBox.Text.Trim())) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Please input parameter."; |
|
|
|
|
this.jsonResultByThead = "Please input parameter."; |
|
|
|
|
showResult(); |
|
|
|
|
this.paymentAppIdComboBox.Focus(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
txnAmtTextBoxValue = this.txnAmtTextBox.Text; |
|
|
|
|
paymentAppIdComboBoxValue = this.paymentAppIdComboBox.Text; |
|
|
|
|
qrValueTextBoxValue = this.qrValueTextBox.Text; |
|
|
|
|
panTextBoxValue = this.panTextBox.Text; |
|
|
|
|
expDateTextBoxValue = this.expDateTextBox.Text; |
|
|
|
|
|
|
|
|
|
txnIdForSale = this.getTxnId(); |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName + "\n txnId = " + txnIdForSale + "\n txnAmt = " + txnAmtTextBoxValue + "\n paymentAppId = " + paymentAppIdComboBoxValue + "\n qrValue = " + qrValueTextBoxValue; |
|
|
|
|
showResult(); |
|
|
|
|
addLog("txnId = " + txnIdForSale + ", txnAmt = " + txnAmtTextBoxValue + ", paymentAppId = " + paymentAppIdComboBoxValue + ",qrValue = " + qrValueTextBoxValue); |
|
|
|
|
this.saleRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requestSaleThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
else if ("Refund".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
if (this.txnAmtTextBox.Text == null || "".Equals(this.txnAmtTextBox.Text.Trim())) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Please input parameter."; |
|
|
|
|
this.jsonResultByThead = "Please input parameter."; |
|
|
|
|
showResult(); |
|
|
|
|
this.txnAmtTextBox.Focus(); |
|
|
|
|
} |
|
|
|
|
else if (this.paymentAppIdComboBox.Text == null || "".Equals(this.paymentAppIdComboBox.Text.Trim())) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Please input parameter."; |
|
|
|
|
this.jsonResultByThead = "Please input parameter."; |
|
|
|
|
showResult(); |
|
|
|
|
this.paymentAppIdComboBox.Focus(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
txnAmtTextBoxValue = this.txnAmtTextBox.Text; |
|
|
|
|
paymentAppIdComboBoxValue = this.paymentAppIdComboBox.Text; |
|
|
|
|
qrValueTextBoxValue = this.qrValueTextBox.Text; |
|
|
|
|
oriTxnDateTextBoxValue = this.oriTxnDateTextBox.Text; |
|
|
|
|
hostRefNoTextBoxValue = this.hostRefNoTextBox.Text; |
|
|
|
|
|
|
|
|
|
txnIdForRefund = this.getTxnId(); |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName + "\n txnId = " + txnIdForRefund + "\n txnAmt = " + txnAmtTextBoxValue + "\n paymentAppId = " + paymentAppIdComboBoxValue + "\n qrValue = " + qrValueTextBoxValue; |
|
|
|
|
showResult(); |
|
|
|
|
addLog("txnId = " + txnIdForRefund + ", txnAmt = " + txnAmtTextBoxValue + ", paymentAppId = " + paymentAppIdComboBoxValue + ",qrValue = " + qrValueTextBoxValue); |
|
|
|
|
|
|
|
|
|
//jsonResultByThead = n5Core.requestRefund(txnId, txnAmtTextBoxValue, paymentAppIdComboBoxValue, qrValueTextBoxValue); |
|
|
|
|
this.refundRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requestRefundThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if ("Retrieval".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
if (this.ecrTxnIdTextBox.Text == null || "".Equals(this.ecrTxnIdTextBox.Text.Trim())) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Please input parameter."; |
|
|
|
|
this.jsonResultByThead = "Please input parameter."; |
|
|
|
|
showResult(); |
|
|
|
|
this.ecrTxnIdTextBox.Focus(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
ecrTxnIdTextBoxValue = this.ecrTxnIdTextBox.Text; |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName + "\n ecrTxnId = " + ecrTxnIdTextBoxValue; |
|
|
|
|
showResult(); |
|
|
|
|
addLog("ecrTxnId = " + ecrTxnIdTextBoxValue); |
|
|
|
|
|
|
|
|
|
//jsonResultByThead = n5Core.requestRetrieval(ecrTxnIdTextBoxValue, 180000); |
|
|
|
|
this.retrievalRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requestRetrievalThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if ("SummaryEnquiry".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName; |
|
|
|
|
showResult(); |
|
|
|
|
enquiryPeriod = periodTextBox.Text; |
|
|
|
|
//jsonResultByThead = n5Core.requestRetrieval(ecrTxnIdTextBoxValue, 180000); |
|
|
|
|
this.summaryEnquiryRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requestSummaryEnquiryThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
else if ("Void".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
if (this.ecrTxnIdTextBox.Text == null || "".Equals(this.ecrTxnIdTextBox.Text.Trim())) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Please input parameter."; |
|
|
|
|
this.jsonResultByThead = "Please input parameter."; |
|
|
|
|
showResult(); |
|
|
|
|
this.ecrTxnIdTextBox.Focus(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
qrValueTextBoxValue = this.qrValueTextBox.Text; |
|
|
|
|
ecrTxnIdTextBoxValue = this.ecrTxnIdTextBox.Text; |
|
|
|
|
|
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName + "\n ecrTxnId = " + ecrTxnIdTextBoxValue + "\n qrValue = " + qrValueTextBoxValue; |
|
|
|
|
showResult(); |
|
|
|
|
addLog("ecrTxnId = " + ecrTxnIdTextBoxValue + ", qrValue = " + qrValueTextBoxValue); |
|
|
|
|
// jsonResultByThead = n5Core.requestVoid(ecrTxnIdTextBoxValue, qrValueTextBoxValue); |
|
|
|
|
this.voidRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requestVoidThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if ("Settlement".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName; |
|
|
|
|
showResult(); |
|
|
|
|
|
|
|
|
|
//jsonResultByThead = n5Core.sendSettlementtRequest(); |
|
|
|
|
this.settlementRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requestSettlementThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
else if ("GetInfo".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName; |
|
|
|
|
showResult(); |
|
|
|
|
|
|
|
|
|
//jsonResultByThead = n5Core.sendSettlementtRequest(); |
|
|
|
|
this.getInfoRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requesGetInfoThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
else if ("CheckUpdate".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName; |
|
|
|
|
showResult(); |
|
|
|
|
|
|
|
|
|
//jsonResultByThead = n5Core.sendSettlementtRequest(); |
|
|
|
|
this.checkUpdateRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requesCheckUpdateThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
else if ("ExecuteUpdate".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName; |
|
|
|
|
showResult(); |
|
|
|
|
|
|
|
|
|
//jsonResultByThead = n5Core.sendSettlementtRequest(); |
|
|
|
|
this.executeUpdateRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requesExecuteUpdateThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
else if ("Link Request".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName; |
|
|
|
|
showResult(); |
|
|
|
|
//jsonResultByThead = n5Core.sendLinkTestRequest(); |
|
|
|
|
this.linkTestRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requestLinkRequestThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
else if ("Reprint".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
ecrTxnIdTextBoxValue = this.ecrTxnIdTextBox.Text; |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName; |
|
|
|
|
showResult(); |
|
|
|
|
//jsonResultByThead = n5Core.sendReprintRequest(); |
|
|
|
|
this.reprintRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requestReprintThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
else if ("Terminaion".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName; |
|
|
|
|
showResult(); |
|
|
|
|
//jsonResultByThead = n5Core.sendAbortRequest(); |
|
|
|
|
this.terminaionRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requestTerminaionThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
else if ("BatchEnquiry".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
if (this.settleDateTextBox.Text == null || "".Equals(this.settleDateTextBox.Text.Trim())) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Please input parameter."; |
|
|
|
|
this.jsonResultByThead = "Please input parameter."; |
|
|
|
|
showResult(); |
|
|
|
|
this.settleDateTextBox.Focus(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
this.settleDateTextBoxValue = this.settleDateTextBox.Text; |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName; |
|
|
|
|
showResult(); |
|
|
|
|
this.batchEnquiryRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requestBatchEnquiryThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if ("SettleEnquiry".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
if (this.batchIdTextBox.Text == null || "".Equals(this.batchIdTextBox.Text.Trim())) |
|
|
|
|
{ |
|
|
|
|
this.requestStrByThead = "Please input parameter."; |
|
|
|
|
this.jsonResultByThead = "Please input parameter."; |
|
|
|
|
showResult(); |
|
|
|
|
this.batchIdTextBox.Focus(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
this.batchIdTextBoxValue = this.batchIdTextBox.Text; |
|
|
|
|
this.requestStrByThead = "Test Function : " + currEventName; |
|
|
|
|
showResult(); |
|
|
|
|
this.settleEnquiryRequestMsg = this.requestStrByThead; |
|
|
|
|
Thread th = new Thread(requestSettleEnquiryThead); |
|
|
|
|
th.Start(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
addLog("thisEvent is error"); |
|
|
|
|
MessageBox.Show("Please select test function.", "Message"); |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
addLog("jsonResultByThead = " + jsonResultByThead); |
|
|
|
|
showResult(); |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void RadioButton_Checked(object sender, RoutedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
RadioButton thisButton = (RadioButton)sender; |
|
|
|
|
this.thisEvent = thisButton.Content.ToString(); |
|
|
|
|
|
|
|
|
|
this.requestTextBox.Text = string.Empty; |
|
|
|
|
this.result1TextBox.Text = string.Empty; |
|
|
|
|
|
|
|
|
|
if (this.logPathTextBox.Text == null || "".Equals(this.logPathTextBox.Text.Trim())) |
|
|
|
|
{ |
|
|
|
|
this.logPathTextBox.Text = "Log Path : " + System.IO.Path.GetTempPath() + "\\myN5TestWin.log"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ("Sale".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = true; |
|
|
|
|
if (this.paymentAppIdComboBox.Text == null || "".Equals(this.paymentAppIdComboBox.Text)) |
|
|
|
|
{ |
|
|
|
|
this.paymentAppIdComboBox.Text = "CC"; |
|
|
|
|
} |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = true; |
|
|
|
|
this.qrValueTextBox.IsEnabled = true; |
|
|
|
|
this.panTextBox.IsEnabled = true; |
|
|
|
|
this.expDateTextBox.IsEnabled = true; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("CreateOrder".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = true; |
|
|
|
|
this.paymentTypeTextBox.IsEnabled = true; |
|
|
|
|
if (this.paymentAppIdComboBox.Text == null || "".Equals(this.paymentAppIdComboBox.Text)) |
|
|
|
|
{ |
|
|
|
|
this.paymentAppIdComboBox.Text = "CC"; |
|
|
|
|
} |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = true; |
|
|
|
|
this.qrValueTextBox.IsEnabled = true; |
|
|
|
|
this.panTextBox.IsEnabled = true; |
|
|
|
|
this.expDateTextBox.IsEnabled = true; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if("PreAuth".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = true; |
|
|
|
|
if (this.paymentAppIdComboBox.Text == null || "".Equals(this.paymentAppIdComboBox.Text)) |
|
|
|
|
{ |
|
|
|
|
this.paymentAppIdComboBox.Text = "CC"; |
|
|
|
|
} |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = true; |
|
|
|
|
this.panTextBox.IsEnabled = true; |
|
|
|
|
this.expDateTextBox.IsEnabled = true; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("Offline".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = true; |
|
|
|
|
if (this.paymentAppIdComboBox.Text == null || "".Equals(this.paymentAppIdComboBox.Text)) |
|
|
|
|
{ |
|
|
|
|
this.paymentAppIdComboBox.Text = "CC"; |
|
|
|
|
} |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = true; |
|
|
|
|
this.panTextBox.IsEnabled = true; |
|
|
|
|
this.authCodeTextBox.IsEnabled = true; |
|
|
|
|
this.expDateTextBox.IsEnabled = true; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("Adjust".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = true; |
|
|
|
|
if (this.paymentAppIdComboBox.Text == null || "".Equals(this.paymentAppIdComboBox.Text)) |
|
|
|
|
{ |
|
|
|
|
this.paymentAppIdComboBox.Text = "CC"; |
|
|
|
|
} |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = true; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("Refund".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
|
|
|
|
|
this.txnAmtTextBox.IsEnabled = true; |
|
|
|
|
if (this.paymentAppIdComboBox.Text == null || "".Equals(this.paymentAppIdComboBox.Text)) |
|
|
|
|
{ |
|
|
|
|
this.paymentAppIdComboBox.Text = "CC"; |
|
|
|
|
} |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = true; |
|
|
|
|
this.qrValueTextBox.IsEnabled = true; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("Retrieval".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.txnAmtTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.Text = ""; |
|
|
|
|
this.qrValueTextBox.Text = ""; |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = false; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = false; |
|
|
|
|
this.qrValueTextBox.IsEnabled = false; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = true; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("Void".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.txnAmtTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.Text = ""; |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = false; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = false; |
|
|
|
|
this.qrValueTextBox.IsEnabled = true; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = true; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("Settlement".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.txnAmtTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.Text = ""; |
|
|
|
|
this.qrValueTextBox.Text = ""; |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = false; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = false; |
|
|
|
|
this.qrValueTextBox.IsEnabled = false; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("Link Request".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.txnAmtTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.Text = ""; |
|
|
|
|
this.qrValueTextBox.Text = ""; |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = false; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = false; |
|
|
|
|
this.qrValueTextBox.IsEnabled = false; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("Terminaion".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.txnAmtTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.Text = ""; |
|
|
|
|
this.qrValueTextBox.Text = ""; |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = false; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = false; |
|
|
|
|
this.qrValueTextBox.IsEnabled = false; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("Scan".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.txnAmtTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.Text = ""; |
|
|
|
|
this.qrValueTextBox.Text = ""; |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = false; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = false; |
|
|
|
|
this.qrValueTextBox.IsEnabled = false; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("ReadCard".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.txnAmtTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.Text = ""; |
|
|
|
|
this.qrValueTextBox.Text = ""; |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = false; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = false; |
|
|
|
|
this.qrValueTextBox.IsEnabled = false; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("AddPoint".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.txnAmtTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.Text = ""; |
|
|
|
|
this.qrValueTextBox.Text = ""; |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = true; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = false; |
|
|
|
|
this.qrValueTextBox.IsEnabled = false; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = true; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
else if ("BatchEnquiry".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.txnAmtTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.Text = ""; |
|
|
|
|
this.qrValueTextBox.Text = ""; |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.panTextBox.Text = ""; |
|
|
|
|
this.authCodeTextBox.Text = ""; |
|
|
|
|
this.expDateTextBox.Text = ""; |
|
|
|
|
this.batchIdTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = false; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = false; |
|
|
|
|
this.qrValueTextBox.IsEnabled = false; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.panTextBox.IsEnabled = false; |
|
|
|
|
this.authCodeTextBox.IsEnabled = false; |
|
|
|
|
this.expDateTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = false; |
|
|
|
|
this.settleDateTextBox.IsEnabled = true; |
|
|
|
|
} |
|
|
|
|
else if ("SettleEnquiry".Equals(this.thisEvent)) |
|
|
|
|
{ |
|
|
|
|
this.txnAmtTextBox.Text = ""; |
|
|
|
|
this.paymentAppIdComboBox.Text = ""; |
|
|
|
|
this.qrValueTextBox.Text = ""; |
|
|
|
|
this.ecrTxnIdTextBox.Text = ""; |
|
|
|
|
this.panTextBox.Text = ""; |
|
|
|
|
this.authCodeTextBox.Text = ""; |
|
|
|
|
this.expDateTextBox.Text = ""; |
|
|
|
|
this.settleDateTextBox.Text = ""; |
|
|
|
|
this.txnAmtTextBox.IsEnabled = false; |
|
|
|
|
this.paymentAppIdComboBox.IsEnabled = false; |
|
|
|
|
this.qrValueTextBox.IsEnabled = false; |
|
|
|
|
this.ecrTxnIdTextBox.IsEnabled = false; |
|
|
|
|
this.panTextBox.IsEnabled = false; |
|
|
|
|
this.authCodeTextBox.IsEnabled = false; |
|
|
|
|
this.expDateTextBox.IsEnabled = false; |
|
|
|
|
this.batchIdTextBox.IsEnabled = true; |
|
|
|
|
this.settleDateTextBox.IsEnabled = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void Submit_1_Button_Click(object sender, RoutedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
this.requestTextBox.Text = string.Empty; |
|
|
|
|
this.result1TextBox.Text = string.Empty; |
|
|
|
|
this.submit_1_Button.IsEnabled = false; |
|
|
|
|
addLog("==========Submit start========== "); |
|
|
|
|
this.sendSubmit(); |
|
|
|
|
addLog("==========Submit end========== "); |
|
|
|
|
this.submit_1_Button.IsEnabled = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void Reset_Button_Click(object sender, RoutedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
this.requestTextBox.Text = string.Empty; |
|
|
|
|
this.result1TextBox.Text = string.Empty; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void addLog(string logInfo) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
if (addLogFlag) |
|
|
|
|
{ |
|
|
|
|
StreamWriter sw = File.AppendText(System.IO.Path.GetTempPath() + "\\myN5TestWin.log"); |
|
|
|
|
sw.WriteLine(DateTime.Now.ToString() + " [LOGGER] " + logInfo + Environment.NewLine); |
|
|
|
|
sw.Flush(); |
|
|
|
|
sw.Close(); |
|
|
|
|
// Console.WriteLine(logInfo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (Exception err) |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine("Exception = " + err); |
|
|
|
|
addLogFlag = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void addRepeatLog(string logInfo) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
StreamWriter sw = File.AppendText(System.IO.Path.GetTempPath() + "\\myN5TestWin_repeat.log"); |
|
|
|
|
sw.WriteLine(DateTime.Now.ToString() + " [LOGGER] " + logInfo + Environment.NewLine); |
|
|
|
|
sw.Flush(); |
|
|
|
|
sw.Close(); |
|
|
|
|
// Console.WriteLine(logInfo); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
catch (Exception err) |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine("Exception = " + err); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private string getTxnId() |
|
|
|
|
{ |
|
|
|
|
StringBuilder txnIdSb = new StringBuilder(); |
|
|
|
|
DateTime dt = DateTime.Now; |
|
|
|
|
txnIdSb.Append(dt.ToString("yyyyMMddHHmmssfff")); |
|
|
|
|
|
|
|
|
|
byte[] randomBytes = new byte[15]; |
|
|
|
|
RNGCryptoServiceProvider rngServiceProvider = new RNGCryptoServiceProvider(); |
|
|
|
|
rngServiceProvider.GetBytes(randomBytes); |
|
|
|
|
Int32 resultInt32 = BitConverter.ToInt32(randomBytes, 0); |
|
|
|
|
for (int i = 0; i < 15; i++) |
|
|
|
|
{ |
|
|
|
|
txnIdSb.Append(randomBytes[i].ToString()); |
|
|
|
|
} |
|
|
|
|
string txnIdResult = null; |
|
|
|
|
if (txnIdSb.ToString().Length > 32) |
|
|
|
|
{ |
|
|
|
|
txnIdResult = txnIdSb.ToString().Substring(0, 32); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
txnIdResult = txnIdSb.ToString(); |
|
|
|
|
} |
|
|
|
|
addLog("txnIdResult = " + txnIdResult); |
|
|
|
|
return txnIdResult; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private int showResult() |
|
|
|
|
{ |
|
|
|
|
//this.requestTextBox.Text = this.requestStrByThead; |
|
|
|
|
requestTextBox.Dispatcher.Invoke( |
|
|
|
|
DispatcherPriority.Normal, TimeSpan.FromSeconds(1), new Action(showRequestTxtBox)); |
|
|
|
|
|
|
|
|
|
showResultStr = this.jsonResultByThead.Replace("{", "").Replace("}", "").Replace(",", "\n"); |
|
|
|
|
//this.result1TextBox.Text = showResultStr; |
|
|
|
|
|
|
|
|
|
result1TextBox.Dispatcher.Invoke( |
|
|
|
|
DispatcherPriority.Normal, TimeSpan.FromSeconds(1), new Action(showResultTxtBox)); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showRequestTxtBox() |
|
|
|
|
{ |
|
|
|
|
this.requestTextBox.Text = requestStrByThead; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void showResultTxtBox() |
|
|
|
|
{ |
|
|
|
|
this.result1TextBox.Text = showResultStr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void PortNameComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) |
|
|
|
|
{ |
|
|
|
|
this.n5CoreInitSuccess = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |