Ejemplo n.º 1
0
 public static void GetSipCopy()
 {
     if (CreditCardConnector is ICreditCardConnector2)
     {
         ((ICreditCardConnector2)CreditCardConnector).RunGetSlipCopyAsinc();
     }
     else
     {
         CopySlipFrm CSF = new CopySlipFrm();
         CSF.ShowDialog();
         Arcus2DataFromXML.GetSipCopy(CSF.SlipNumber);
     }
 }
 public string RunSVERKARepSinc(out string mReciept, out string mRes)
 {
     Amount    = 0;
     OperType  = 7;
     mOperType = CreditCardOperationType.Sverka;
     Sinc      = true;
     RunOper();
     Sinc     = false;
     mReciept = Receipt;
     mRes     = resOper;
     if ((RespCode == "00") || (RespCode == "000"))
     {
         Arcus2DataFromXML.SlipFileMove();
     }
     return(RespCode);
 }
        private void RunOper()
        {
            try
            {
                Utils.ToCardLog("Запуск RunOper OperType=" + OperType.ToString() + " Amount= " + Amount.ToString());
                OperInProcess = true;
                SAPacketObj        Request  = new SAPacketObj();
                SAPacketObj        Response = new SAPacketObj();
                PCPOSTConnectorObj Conn     = new PCPOSTConnectorObj();
                Request.Amount        = (Amount).ToString();
                Request.OperationCode = OperType;
                Request.CurrencyCode  = "643";
                Request.DateTimeHost  = DateTime.Now.ToString("yyyyMMddHHmmss");

                //Conn.InitResources();
                Conn.Exchange(ref Request, ref Response, 10);

                RespCode = Response.ResponseCodeHost.Trim();

                Utils.ToCardLog(String.Format("[RunOper] Операция выполнена. Результат: {0}, TrxIDCRM {1}, TrxID {2}, ReferenceNumber {3}", RespCode, Response.TrxIDCRM, Response.TrxID, Response.ReferenceNumber));
                try
                {
                    Utils.ToCardLog(String.Format("[RunOper] Операция выполнена. Входящий запрос: {0}, TrxIDCRM {1}, TrxID {2}, ReferenceNumber {3}", RespCode, Request.TrxIDCRM, Request.TrxID, Request.ReferenceNumber));
                }
                catch
                {
                }
                Receipt = ReadChequeFile();
                if (((RespCode == "00") || (RespCode == "000")) && (!Receipt.ToUpper().Contains("НЕ ОПЛАЧИВАТЬ")))
                {
                    if ((OperType == 1) || (OperType == 4))
                    {
                        string Tmp = Receipt;
                        if (!iniFile.Arcus2PrintOneSlip)
                        {
                            Tmp    += Convert.ToChar(31) + Environment.NewLine;
                            Tmp    += Receipt;
                            Receipt = Tmp;
                        }


                        try
                        {
                            Utils.ToCardLog("[RunOper] Добавляю Слип в Файл.");

                            ArcusSlips AS  = Arcus2DataFromXML.ReadArcusSlips();
                            DateTime   HDT = DateTime.Now;
                            try
                            {
                                HDT = Convert.ToDateTime(Response.DateTimeCRM);
                            }
                            catch
                            { }
                            ArcusSlip S = new ArcusSlip()
                            {
                                HostDt             = HDT,
                                Sum                = Convert.ToDecimal(Response.Amount),
                                Void               = (Response.OperationCode == 4),
                                Num                = Response.TrxIDCRM,
                                RRN                = Response.ReferenceNumber,
                                AlohaCheckId       = AlohaCheckId,
                                AlohaCheckShortNum = AlohaCheckShortNum
                            };
                            string[] Str = Receipt.Split(char.ConvertFromUtf32(10)[0]);

                            foreach (string str in Str)
                            {
                                Utils.ToCardLog(str);
                                S.Slip.Add(str);
                            }

                            decimal SummFromTxt = GetSummFromSlip(S.Slip);

                            if ((SummFromTxt != 0) && (S.Sum != SummFromTxt * 100))
                            {
                                Utils.ToCardLog("Error Разные суммы в слипе " + SummFromTxt.ToString() + " и ответе от терминала. " + S.Sum.ToString());
                                S.Sum = SummFromTxt * 100;
                            }

                            AS.Slips.Add(S);

                            Arcus2DataFromXML.WriteArcusSlips(AS);

                            Utils.ToCardLog("[RunOper] Добавлил Слип в Файл.");
                        }
                        catch (Exception e)
                        {
                            Utils.ToCardLog("[Error] Ошибка добавления слипа в файл." + e.Message);
                        }
                    }
                }
                else
                {
                    try
                    {
                        EventSenderClass.SendAlohaAsincEvent(StopListService.AlohaEventType.ErrorCreditCardterminal, "", AlohaTSClass.AlohaCurentState.WaterId,
                                                             AlohaTSClass.GetJobCode(AlohaTSClass.AlohaCurentState.WaterId),
                                                             "",
                                                             Convert.ToInt32(RespCode),
                                                             (int)AlohaTSClass.AlohaCurentState.TableId,
                                                             (int)AlohaTSClass.AlohaCurentState.CheckId);
                    }
                    catch
                    { }
                }
                resOper = GetCodeDescr(RespCode);
                if (!Sinc)
                {
                    RunOperationAsincComplitedVoid(OperType, RespCode, resOper, "", Receipt);
                }
                OperInProcess = false;
                Utils.ToCardLog("Отработал RunOper OperType=" + OperType.ToString() + " Amount= " + Amount.ToString());
            }
            catch (Exception e)
            {
                resOper  = "Ошибка программы. " + e.Message;
                RespCode = "-1";
                if (!Sinc)
                {
                    RunOperationAsincComplitedVoid(OperType, RespCode, resOper, "", "");
                }
                Utils.ToCardLog("[Error] Запускa RunOper " + e.Message);
            }
        }
        public void RunXRepAsinc()
        {
            string s = Arcus2DataFromXML.PrintShortReport();

            CreditCardAlohaIntegration.CreditCardOperationComplited(CreditCardOperationType.XReport, false, true, "", s);
        }