public void RunOper(int OperId, decimal amount, int CommandMode = 0, int CommandMode2 = 0, string RRN = "") { Task t = new Task(() => { DualConnectorApi DApi = new DualConnectorApi(); OperInProcess = true; string resStr = ""; string statusDescr = ""; string receipt = ""; int status = 0; int amountBase = (int)(amount); int res = DApi.Exchange(OperId, CommandMode, CommandMode2, amountBase, iniFile.CreditTerminalNum, RRN, out resStr, out receipt, out status, out statusDescr); if (res != 0) { string Mess = "Ошибка старта операции" + OperId + " на терминале пластиковых карт." + Environment.NewLine + resStr; Mess += "Код ошибки: " + res; Mess += "Описание ошибки: " + resStr; Utils.ToCardLog(Mess); } CreditCardAlohaIntegration.CreditCardOperationComplited(operType, res != 0, res == 0 && status == 1, resStr, receipt); OperInProcess = false; Utils.ToCardLog("OperInProcess = false"); }); t.Start(); }
private void RunOperationAsincComplitedVoid(Arcus3Wrapper.ArcusOp OperType, string respCode, string resStr, string receipt) { Utils.ToCardLog(String.Format("[RunOper] RunOperationAsincComplitedVoid " + OperType.ToString() + "; RespCode=" + respCode)); int respCodeInt = 0; var tryParseRes = int.TryParse(respCode, out respCodeInt); Utils.ToCardLog("tryParseRes " + tryParseRes + " respCodeInt: " + respCodeInt); bool ShowError = false; if (OperType == Arcus3Wrapper.ArcusOp.XReportShort) { mOperType = CreditCardOperationType.XReport; } else if (OperType == Arcus3Wrapper.ArcusOp.ZReport) { mOperType = CreditCardOperationType.Sverka; } else if (OperType == Arcus3Wrapper.ArcusOp.XReportFull) { mOperType = CreditCardOperationType.LongReport; } else if (OperType == Arcus3Wrapper.ArcusOp.Pay) { mOperType = CreditCardOperationType.Payment; } else if (OperType == Arcus3Wrapper.ArcusOp.Cancel) { mOperType = CreditCardOperationType.VoidPayment; } else if (OperType == Arcus3Wrapper.ArcusOp.Refund) { mOperType = CreditCardOperationType.VoidPayment; } bool res = false; if (respCode == "999") { resStr += Environment.NewLine + "Нет связи с терминалом пластиковых карт."; resStr += Environment.NewLine + "Проверьте соединение."; ShowError = true; } else { res = (respCodeInt == 0) && (!receipt.ToUpper().Contains("НЕ ОПЛАЧИВАТЬ")); } CreditCardAlohaIntegration.CreditCardOperationComplited(mOperType, ShowError, res, resStr, receipt); }