public static void TransactionComplited(int TransCode, int Status, InpasChk PayMentCheck, int Code, string CodeDescrstring, string Reciept)
        {
            if (Reciept != null)
            {
                if (Reciept != "")
                {
                    //System.Windows.Forms.MessageBox.Show(Reciept);

                    //  AlohaTSClass.PrintCardSlip
                    try
                    {
                        // string[] stringSeparators = new string[] { "\n\r", "\n\n", Environment.NewLine};

                        string[] stringSeparators = new string[] { "\n" };

                        string sres = Reciept.Replace("\r", "");

                        AlohaTSClass.PrintCardSlip(sres.Split(stringSeparators, StringSplitOptions.None).ToList());
                    }
                    catch (Exception e)
                    {
                        Utils.ToCardLog("Ошибка печати слипа " + e.Message);
                    }
                }
            }
            if (Code == 0)
            {
                if (Status == 1)
                {
                    if (TransCode == 1)
                    {
                        if (PayMentCheck.AllInTable)
                        {
                            foreach (InpasChk Chk in PayMentCheck.AllChks)
                            {
                                RemoteCloseCheck.AddRemoteChkToQuere(Chk.AlohaId, 20, Chk.CurrentEmpl, 0);
                            }
                        }
                        else
                        {
                            RemoteCloseCheck.AddRemoteChkToQuere(PayMentCheck.AlohaId, 20, PayMentCheck.CurrentEmpl, 0);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        static void RC_DataRecive(object Fi)
        {
            try
            {
                DataReciver.PDiscountCommand InCommand = (DataReciver.PDiscountCommand)Fi;
                Utils.ToCardLog("RC_DataRecive тип " + InCommand.CommandType);
                if (InCommand.Ansver)
                {
                }
                else
                {
                    switch (InCommand.CommandType)
                    {
                    case DataReciver.PDiscountCommandType.CloseCheck:
                    {
                        // if (!iniFile.RemoteCloseCheckEnabled)
                        {
                            //   InCommand.Result = AlohaTSClass.OrderItems(InCommand.EntIds, InCommand.CheckId, InCommand.TableId, out InCommand.ExeptionMessage);
                            InCommand.Result = true;
                            RemoteCloseCheck.AddRemoteChkToQuereLocal(InCommand.CheckId, InCommand.PaymentId, InCommand.EmployeeId, InCommand.PaymentSumm);
                        }
                        break;
                    }

                    case DataReciver.PDiscountCommandType.OrderItems:
                    {
                        InCommand.Result = AlohaTSClass.OrderItems(InCommand.EntIds, InCommand.CheckId, InCommand.TableId, out InCommand.ExeptionMessage);
                        break;
                    }

                    case DataReciver.PDiscountCommandType.OrderAllItems:
                    {
                        InCommand.Result = AlohaTSClass.OrderAllItems(InCommand.CheckId, InCommand.TableId, out InCommand.ExeptionMessage);
                        break;
                    }

                    case DataReciver.PDiscountCommandType.GetStopList:
                    {
                        //InCommand.Result = AlohaTSClass.OrderAllItems(InCommand.CheckId, InCommand.TableId, out InCommand.ExeptionMessage);
                        InCommand.EntIds = AlohaTSClass.GetStopList2();
                        InCommand.Result = true;

                        break;
                    }

                    case DataReciver.PDiscountCommandType.DeleteOrder:
                    {
                        //RemoteCloseCheck.RemoteDeleteCheck(InCommand.CheckId);
                        AlohaTSClass.LogIn(iniFile.RemoteOrderTerminalNumber, iniFile.RemoteOrderWaterNumber);
                        AlohaTSClass.DeleteAllItemsOnCurentCheckandClose2(iniFile.RemoteOrderTerminalNumber,
                                                                          iniFile.RemoteOrderWaterNumber, InCommand.CheckId);
                        break;
                    }

                    case DataReciver.PDiscountCommandType.PrintSlip:
                    {
                        if (iniFile.CreditCardSlipPrintPreCheck)
                        {
                            try
                            {
                                // string[] stringSeparators = new string[] { "\n\r", "\n\n", Environment.NewLine};

                                string[] stringSeparators = new string[] { "\n" };

                                string sres = InCommand.Slip.Replace("\r", "");

                                //if (iniFile.pri)
                                AlohaTSClass.PrintCardSlip(sres.Split(stringSeparators, StringSplitOptions.None).ToList());
                            }
                            catch (Exception e)
                            {
                                Utils.ToCardLog("Ошибка печати слипа " + e.Message);
                            }
                        }
                        else
                        {
                            // Slip += Convert.ToChar(31);
                            ToShtrih.PrintCardCheck(InCommand.Slip);
                        }
                        ToShtrih.PrintCardCheck(InCommand.Slip);
                        break;
                    }

                    case DataReciver.PDiscountCommandType.AddRemoteOrder:
                    {
                        RemoteOrderSrv.OrderInfoForAloha OI = new RemoteOrderSrv.OrderInfoForAloha();

                        List <RemoteOrderSrv.Item> Tmpit = new List <RemoteOrderSrv.Item>();

                        OI.OrderID = "0";

                        foreach (DataReciver.Item it in InCommand.OrderBody)
                        {
                            RemoteOrderSrv.Item IT = new RemoteOrderSrv.Item
                            {
                                ItemID             = it.Barcode,
                                ItemSpecialMessage = ""
                            };

                            Tmpit.Add(IT);
                            List <RemoteOrderSrv.Modifier> TmpMods = new List <RemoteOrderSrv.Modifier>();

                            foreach (DataReciver.Item mod in it.Mods)
                            {
                                RemoteOrderSrv.Modifier md = new RemoteOrderSrv.Modifier {
                                    ItemModifierID = mod.Barcode
                                };
                                TmpMods.Add(md);
                            }

                            IT.Modifiers = TmpMods.ToArray();
                        }
                        OI.Items = Tmpit.ToArray();



                        InCommand.ResultId = MainClass.CTG.AddRemoteOrderFromTCPCommand(OI, out InCommand.ExeptionMessage, out InCommand.CheckId);
                        break;
                    }

                    default:
                    {
                        break;
                    }
                    }
                    InCommand.Ansver = true;

                    //   Utils.ToLog("RC.SendData port: " + iniFile.RemoteSenderPort + " CompName: " + InCommand.Sender);
                    //   RC.SendData(InCommand.Sender, iniFile.RemoteSenderPort   , InCommand);
                    if (InCommand.SenderPort == 0)
                    {
                        InCommand.SenderPort = iniFile.RemoteSenderPort;
                    }
                    Utils.ToLog("RC.SendData port: " + InCommand.SenderPort + " CompName: " + InCommand.Sender);

                    RC.SendData(InCommand.Sender, InCommand.SenderPort, InCommand);
                }
            }
            catch (Exception e)
            {
                Utils.ToLog(e.Message);
            }
        }