public static bool ApplyDisc(int Table, string Name) { Utils.ToCardLog("ApplyDisc Table: " + Table.ToString() + " name " + Name); string Disc = TOBaseConnect.GetLoyaltyNumber(Name); if (Disc != "") { Utils.ToCardLog("ApplyDisc к мемберу " + Name + " привязана карта " + Disc); //AlohaTSClass.SetTakeOutAttr(Table, Name); /* * AlohaTSClass.CheckWindow(); * */ MainClass.AssignMember(Disc, Disc); return(true); } return(false); }
public void ConvertCard(List <int> FRoad, List <int> SRoad) { // if (FRoad[0] == (int)Keys.Z) // { string FR = GetStrByKeys(FRoad); /* * if (iniFile.Read("Discounts", Prefix.ToUpper()) != null) * { * return CardTypes.Discount; * } * else if (iniFile.Read("PrivilegedKey", Prefix + Num) != null) * { * return CardTypes.Discount; * } * */ if (iniFile.Read("Emulator", FR.ToUpper()) != null) { string GetRestrPrefiks = iniFile.Read("Emulator", FR.ToUpper()); List <int> Tmp = new List <int>(); foreach (char ch in GetRestrPrefiks) { int i = Convert.ToInt32(ch); //Keys k = GetKeyByInt(i); Tmp.Add(i); } /* * Tmp.Add((int)Keys.D9); * Tmp.Add((int)Keys.D0); * Tmp.Add((int)Keys.D6); * Tmp.Add((int)Keys.D5); * Tmp.Add((int)Keys.D8); * */ /* * Tmp.Add((int)Keys.D0); * Tmp.Add((int)Keys.D0); * Tmp.Add((int)Keys.D0); * Tmp.Add((int)Keys.D1); * Tmp.Add((int)Keys.D2); * */ //string SecondRoad = GetStrByKeys(SRoad ); string SecondRoad = ""; int C = 0; foreach (int ss in SRoad) { if (C > 8) { continue; } C++; Keys k = (Keys)ss; SecondRoad += k.ToString()[1]; } if (iniFile.Read("PrivilegedKey", FRoad + SecondRoad) != null) { GetRestrPrefiks = iniFile.Read("Emulator", "VIP50"); } for (int i = 9; i > 0; i--) { int k = 0; try { k = SRoad[SRoad.Count - i]; } catch { } Tmp.Add(k); } /* * Tmp.Add(SRoad[SRoad.Count - 4]); * Tmp.Add(SRoad[SRoad.Count - 5]); * Tmp.Add(SRoad[SRoad.Count - 6]); * Tmp.Add(SRoad[SRoad.Count - 1]); * */ // RaiseCard(Tmp); int z = ToBase.DoVizitAsink(FR.ToUpper(), SecondRoad, AlohainiFile.DepNum, AlohaTSClass.AlohaCurentState.CheckNum, AlohaTSClass.AlohaCurentState.TerminalId, DateTime.Now); MainClass.AssignMember(GetRestrPrefiks + SecondRoad, GetRestrPrefiks + SecondRoad); } else { //MainClass.mSetWinHook.RaiseHookedKeys(); MainClass.SendCard(FRoad, SRoad); } }
//} internal bool EmulateLoyaltyCard(string Pref, string Num) { if ((iniFile.Read("Emulator", Pref.ToUpper()) != null) || (Pref.Length == 5)) { AlohaTSClass.ShowMessage("Распознал карту " + Pref + Num); if (AlohaTSClass.AlohaCurentState.CompIsAppled) { AlohaTSClass.ShowMessage("Скидка уже применена"); return(true); } if (AlohaTSClass.AlohaCurentState.PredCheckAndNotManager) { AlohaTSClass.ShowMessage("Применить скидку по данному чеку может только менеджер."); return(true); } string GetRestrPrefiks = ""; string NewNum = ""; if (Pref.Length == 5) { GetRestrPrefiks = Pref; NewNum = Num; } else { Utils.ToLog("Конвертирую карту"); GetRestrPrefiks = iniFile.Read("Emulator", Pref.ToUpper()); if (iniFile.Read("PrivilegedKey", Pref + Num) == "8") { GetRestrPrefiks = iniFile.Read("Emulator", "VIP50"); } if (iniFile.Read("PrivilegedKey", Pref + Num) == "2") { GetRestrPrefiks = iniFile.Read("Emulator", "VIP30"); } int z = ToBase.DoVizitAsink(Pref.ToUpper(), Num, AlohainiFile.DepNum, AlohaTSClass.AlohaCurentState.CheckNum, AlohaTSClass.AlohaCurentState.TerminalId, DateTime.Now); NewNum = ConvertNumTo9Digits(Num); } string OldDisc = AlohaTSClass.GetDiscountAttr((int)AlohaTSClass.AlohaCurentState.CheckId); if ((OldDisc != "") && (OldDisc.Replace(" ", "") != (Pref + Num).Replace(" ", "")) && (Utils.GetDiscountNumByCardSeries(Convert.ToInt32(GetRestrPrefiks)) != 6)) { Utils.ToCardLog(String.Format("На чек {0} наложен атрибут {1}", AlohaTSClass.AlohaCurentState.CheckId, OldDisc)); AlohaTSClass.ShowMessage("Нельзя применить скидку на чек с зарегистрированным посещением. Совсем нельзя. "); return(true); } MainClass.AssignMember(GetRestrPrefiks + NewNum, GetRestrPrefiks + NewNum); return(true); } return(false); }