Ejemplo n.º 1
0
        internal static void TryAddDiscount(int ModeId, int CheckId, int EmployeeId)
        {
            if (iniFile.TakeOutEnabled)
            {
                try
                {
                    if ((iniFile.TakeOutOrderId1 == ModeId) || (iniFile.TakeOutOrderId2 == ModeId))
                    {
                        AlohaTSClass.SetWaterToCurentCheck(EmployeeId, CheckId);
                        Utils.ToLog("Пытаюсь наложить скидку на заказ с собой");

                        Check Ch = AlohaTSClass.GetCheckById(CheckId);
                        //string LoyaltyNum = AlohaTSClass.GetTakeOutAttr(Ch.TableId);

                        string LoyaltyName = Ch.TableName;

                        Utils.ToCardLog("LoyaltyName = " + LoyaltyName);

                        if (LoyaltyName != "")
                        {
                            if (TakeOut.TOLoaltyConnect.ApplyDisc(Ch.TableId, LoyaltyName))
                            {
                                /*
                                 * Utils.ToCardLog("LoyaltyNum = " + LoyaltyNum);
                                 * AlohaTSClass.CheckWindow();
                                 * MainClass.AssignMember(LoyaltyNum, LoyaltyNum);
                                 * */
                                return;
                            }
                        }


                        /*
                         * if (AlohaTSClass.CheckWindow())
                         * {
                         *  if (AlohaTSClass.AlohaCurentState.CompIsAppled)
                         *  {
                         *      Utils.ToLog("Скидка уже применена");
                         *      return;
                         *
                         *
                         *  }
                         * }
                         */
                        if (AlohaTSClass.GetCheckDiscountById(CheckId))
                        {
                            Utils.ToLog("Скидка уже применена");
                            return;
                        }
                        string outmsg = "";
                        int    i      = AlohaTSClass.ApplyCompByCheckId(iniFile.TakeOutDiscountId, EmployeeId, CheckId, out outmsg);
                        if (i > 0)
                        {
                            Utils.ToLog("Cкидка на заказ с собой применена");
                        }
                        AlohaTSClass.RefreshCheckDisplay();
                    }
                }
                catch (Exception e)
                {
                }
            }
        }