internal static void InsertOrderTime(List <OrderedDish> BarCodes, int CheckId, int Tableid, DateTime dt, DateTime DOB, int QueueId, int EmployeeId, int ModeId, int EmployeeOwner) { try { if (!iniFile.SQLCheckDisabled) { foreach (OrderedDish BC in BarCodes) { OrderTime Ot = new OrderTime() { BarCode = BC.BarCode, BusinessDate = DOB, CheckId = CheckId, SystemDate = dt, EmployeeId = EmployeeId, ModeId = ModeId, QueueId = QueueId, TableId = Tableid, EntryId = BC.EntryId, Sale = false, EmployeeOwner = EmployeeOwner, DishClosed = false }; Utils.ToCardLog(String.Format("Add To SQL EntryId {0} , BarCode {1}", BC.EntryId, BC.BarCode)); MyBase.OrderTimes.InsertOnSubmit(Ot); } MyBase.SubmitChanges(); } } catch (Exception e) { Utils.ToCardLog("[Error InsertOrderTime] " + e.Message); } }
internal static DateTime GetOrderTime(int BarCode, int CheckId, int EntryId, DateTime OpenTime, bool Sale, int EmployeeId) { Utils.ToCardLog(String.Format("GetOrderTime BarCode {0} EntryId {1} ", BarCode, EntryId)); DateTime dt = DateTime.Now; if (!iniFile.SQLCheckDisabled) { try { if ((from o in MyBase.OrderTimes where o.BarCode == BarCode && o.EntryId == EntryId select o).Count() < 1) { Utils.ToCardLog("GetOrderTime entry non find"); OrderTime Ot = new OrderTime() { BarCode = BarCode, BusinessDate = AlohainiFile.BDate, CheckId = CheckId, SystemDate = dt, EmployeeId = EmployeeId, ModeId = 0, QueueId = 0, TableId = 0, EntryId = EntryId, Sale = Sale, EmployeeOwner = EmployeeId, DishClosed = true }; MyBase.OrderTimes.InsertOnSubmit(Ot); } else { Utils.ToCardLog("GetOrderTime find dt " + dt.ToString()); // dt = (from o in MyBase.OrderTimes where o.BarCode == BarCode && o.CheckId == CheckId && o.EntryId==EntryId select o.SystemDate).Max().Value; dt = (from o in MyBase.OrderTimes where o.BarCode == BarCode && o.EntryId == EntryId select o.SystemDate).Max().Value; //уБИРАЕМ сравнение по чеку, т.к. возможен перенос блюда OrderTime ot = (from o in MyBase.OrderTimes where o.BarCode == BarCode && o.EntryId == EntryId && o.SystemDate == dt select o).First(); ot.Sale = Sale; ot.DishClosed = true; } Utils.ToCardLog("GetOrderTime before submit "); MyBase.SubmitChanges(); } catch (Exception e) { Utils.ToLog("Error GetOrderTime not find by EntryId " + e.Message); try { dt = (from o in MyBase.OrderTimes where o.BarCode == BarCode && o.CheckId == CheckId select o.SystemDate).Max().Value; } catch (Exception ee) { Utils.ToLog("Error GetOrderTime " + ee.Message); //Отправить ошибку на сервер } } } if (dt < OpenTime.AddHours(-24)) { Utils.ToLog("GetOrderTime Not find"); dt = OpenTime; } return(dt); }
partial void UpdateOrderTime(OrderTime instance);
partial void DeleteOrderTime(OrderTime instance);
partial void InsertOrderTime(OrderTime instance);