public static Salad GetSalad(GuestItem dbGuestItem) { var sizeOfSalad = SaladSize.None; switch (dbGuestItem.SelectSizeID) { case 7: sizeOfSalad = SaladSize.Small; break; case 8: sizeOfSalad = SaladSize.Large; break; case 14: sizeOfSalad = SaladSize.LunchSpecial; break; } var salad = new Salad(sizeOfSalad); if (dbGuestItem.Mods.Count > 0) { GetSaladToppings(dbGuestItem, ref salad); } salad.PopulateBasePrice(); salad.PopulateDisplayName(); salad.PopulatePricePerItem(); salad.DbItemId = dbGuestItem.ID; salad.WasSentToKitchen = dbGuestItem.OrderSent; salad.DbOrderId = (int)dbGuestItem.OrderID; salad.ItemCount = 1; return(salad); }
public static OrderItem GetOrderItem(GuestItem oldGuestItem) { OrderItem thisOrderItem = new Drink(); switch (oldGuestItem.SuperCategoryID) { case 1: thisOrderItem = GetPizza(oldGuestItem); break; case 2: thisOrderItem = GetCalzone(oldGuestItem); break; case 3: thisOrderItem = GetSalad(oldGuestItem); break; case 4: thisOrderItem = GetDrink(oldGuestItem); break; case 5: thisOrderItem = GetDessert(oldGuestItem); break; //case 6: Merch //case 7: Sides //case 8: Variable?? } return(thisOrderItem); }
public virtual GuestItem CreateGuestItem(DBItem dbItem, decimal orderId) { var guestItem = new GuestItem() { Availability = dbItem.Availability, BasePrice = PricePerItemIncludingToppings, CanBeHalf = dbItem.CanBeHalf, Description = dbItem.Description, HasAllMods = dbItem.HasAllMods, HasRequiredMods = dbItem.HasRequiredMods, OrderID = orderId, ID = dbItem.ID, LongName = dbItem.LongName, NonTaxable = dbItem.NonTaxable, ShortName = dbItem.ShortName, SelectCommand = dbItem.SelectCommand, SizeTable = dbItem.SizeTable, Stackable = dbItem.Stackable, SubCategoryID = dbItem.SubCategoryID, SubCategoryName = dbItem.SubCategoryName, SuperCategory = dbItem.SuperCategory, SuperCategoryID = dbItem.SuperCategoryID, TieredPricing = dbItem.TieredPricing, OrderSent = false, Mods = new List <GuestModifier>(), Note = new List <string>() }; return(guestItem); }
//public static Order ConvertDbCheckToOrder(DBCheck check, decimal tableId, decimal[] guestIds) //{ // //var openOrder = new Order(tableId) // //{ // // IsTakeout = false, // // GuestIds = guestIds // //}; // //foreach (var item in check.Items) // //{ // // var openOrderItem = OrderItemFactory.GetOrderItem(item); // // openOrder.AddItemToOrder(openOrderItem); // //} // //return openOrder; //} public static Dessert GetDessert(GuestItem oldGuestItem) { Dessert newDessert = MenuFood.GetDessertFromMenu(oldGuestItem.ID); newDessert.DbItemId = oldGuestItem.ID; newDessert.WasSentToKitchen = oldGuestItem.OrderSent; newDessert.DbOrderId = (int)oldGuestItem.OrderID; newDessert.ItemCount = 1; return(newDessert); }
public override GuestItem CreateGuestItem(DBItem dbItem, decimal orderId) { GuestItem guestItem = base.CreateGuestItem(dbItem, orderId); switch (PizzaType) { //TODO: GuestComboItems case PizzaType.Medium: guestItem.SelectSizeID = 11; break; case PizzaType.Large: guestItem.SelectSizeID = 12; break; case PizzaType.ThinSlice: if (MajorMamaInfo == MajorOrMama.Major) { guestItem.SelectSizeID = 9; } else { guestItem.SelectSizeID = 24; } break; case PizzaType.Indy: guestItem.SelectSizeID = 10; break; case PizzaType.Mfp: if (MajorMamaInfo == MajorOrMama.Major) { guestItem.SelectSizeID = 22; } else { guestItem.SelectSizeID = 60; } break; case PizzaType.SatchPan: if (MajorMamaInfo == MajorOrMama.Major) { guestItem.SelectSizeID = 23; } else { guestItem.SelectSizeID = 15; } break; } return(guestItem); }
private static void GetSaladToppings(GuestItem oldGuestItem, ref Salad salad) { foreach (GuestModifier mod in oldGuestItem.Mods) { Topping newTopping = new Topping(ToppingName.Unknown); if (DataBaseDictionaries.DbIdToppingDictionary.ContainsKey(mod.ID)) { var ToppingName = DataBaseDictionaries.DbIdToppingDictionary[mod.ID]; if (MenuFood.SaladToppings.ContainsKey(ToppingName)) { newTopping = MenuFood.SaladToppings[ToppingName].GetClone(); } else { Console.WriteLine("***Debug JOANNE***TOPPINGS DICTIONARY DOES NOT CONTAIN: " + ToppingName); continue; } if (mod.State == "Lite") { newTopping.ToppingModifier = ToppingModifierType.LightTopping; } else if (mod.State == "" || (mod.State == "Plus" && mod.Count > 0)) { newTopping.ToppingModifier = ToppingModifierType.ExtraTopping; newTopping.Count = (int)mod.Count; } else if (mod.State == "Side") { newTopping.ToppingModifier = ToppingModifierType.ToppingOnSide; } if (mod.State == "No") { newTopping.ToppingModifier = ToppingModifierType.NoTopping; //TODO: ?? At present, default toppings aren't included with salads. //pizza.Toppings.RemoveTopping(newTopping.ToppingName); } } else { Console.WriteLine("***Debug JOANNE***TOPPINGS DICTIONARY Salad ITEM NOT FOUND: " + mod.Name + mod.ID); } salad.Toppings.AddTopping(newTopping, false); } salad.Toppings.UpdateToppingsTotal(); }
public static Calzone GetCalzone(GuestItem dbGuestItem) { var calzone = new Calzone(); switch (dbGuestItem.ID) { case 51: calzone.CalzoneType = CalzoneType.Cheese; break; case 52: calzone.CalzoneType = CalzoneType.HotRope; break; case 53: calzone.CalzoneType = CalzoneType.PBJ; break; case 54: calzone.CalzoneType = CalzoneType.SteakAndCheese; break; case 56: calzone.CalzoneType = CalzoneType.Cheese; calzone.MajorMamaInfo = MajorOrMama.Major; calzone.Toppings.AddMajorToppings(); break; default: Console.WriteLine("***Debug JOANNE***calzone TYPE FROM SERVER NOT FOUND FOR GuestItem ID " + dbGuestItem.ID); break; } if (dbGuestItem.Mods.Count > 0) { GetCalzoneToppings(dbGuestItem, ref calzone); } calzone.PopulateBasePrice(); calzone.PopulateDisplayName(); calzone.PopulatePricePerItem(); calzone.DbItemId = dbGuestItem.ID; calzone.WasSentToKitchen = dbGuestItem.OrderSent; calzone.DbOrderId = (int)dbGuestItem.OrderID; calzone.ItemCount = 1; return(calzone); }
public override GuestItem CreateGuestItem(DBItem dbItem, decimal orderId) { GuestItem guestItem = base.CreateGuestItem(dbItem, orderId); switch (SizeOfSalad) { case SaladSize.LunchSpecial: guestItem.SelectSizeID = 14; break; case SaladSize.Small: guestItem.SelectSizeID = 7; break; case SaladSize.Large: guestItem.SelectSizeID = 8; break; } return(guestItem); }
public override GuestItem CreateGuestItem(DBItem dbItem, decimal orderId) { GuestItem item = base.CreateGuestItem(dbItem, orderId); switch (DrinkSize) { case DrinkSize.Pint: item.SelectSizeID = 1; break; case DrinkSize.Pitcher: item.SelectSizeID = 2; break; case DrinkSize.Glass: item.SelectSizeID = 3; break; case DrinkSize.Bottle: item.SelectSizeID = 6; break; } return(item); }
public static Drink GetDrink(GuestItem oldGuestItem) { DrinkSize drinkSize = DrinkSize.JustOneSize; switch (oldGuestItem.SelectSizeID) { case 3: drinkSize = DrinkSize.Glass; break; case 6: drinkSize = DrinkSize.Bottle; break; case 1: drinkSize = DrinkSize.Pint; break; case 2: drinkSize = DrinkSize.Pitcher; break; default: drinkSize = DrinkSize.JustOneSize; break; } Drink drink = MenuDrinks.GetDrinkFromMenu(oldGuestItem.ID, drinkSize); var newdrink = drink.GetClone(); newdrink.DbItemId = oldGuestItem.ID; newdrink.WasSentToKitchen = oldGuestItem.OrderSent; newdrink.DbOrderId = (int)oldGuestItem.OrderID; newdrink.ItemCount = 1; return(newdrink); }
private static void GetCalzoneToppings(GuestItem oldGuestItem, ref Calzone calzone) { foreach (GuestModifier mod in oldGuestItem.Mods) { bool addThisModAsTopping = true; Topping newTopping = new Topping(ToppingName.Unknown); if (DataBaseDictionaries.DbIdToppingDictionary.ContainsKey(mod.ID)) { var ToppingName = DataBaseDictionaries.DbIdToppingDictionary[mod.ID]; if (MenuFood.PizzaToppings.ContainsKey(ToppingName)) { newTopping = MenuFood.PizzaToppings[ToppingName].GetClone(); } else { addThisModAsTopping = false; Console.WriteLine("***Debug JOANNE***TOPPINGS DICTIONARY DOES NOT CONTAIN: " + ToppingName); continue; } if (mod.State == "Lite") { newTopping.ToppingModifier = ToppingModifierType.LightTopping; } else if (mod.State == "" || (mod.State == "Plus" && mod.Count > 1)) { newTopping.ToppingModifier = ToppingModifierType.ExtraTopping; newTopping.Count = (int)mod.Count; } else if (mod.State == "Plus" && mod.Name.ToUpper() == "NO CHEESE") { newTopping.ToppingModifier = ToppingModifierType.NoTopping; addThisModAsTopping = true; } else if (mod.State == "Side") { newTopping.ToppingModifier = ToppingModifierType.ToppingOnSide; } if (mod.State == "No") { if (calzone.MajorMamaInfo == MajorOrMama.Major) { newTopping.ToppingModifier = ToppingModifierType.NoTopping; calzone.Toppings.RemoveTopping(newTopping.ToppingName); addThisModAsTopping = true; } else { newTopping.ToppingModifier = ToppingModifierType.NoTopping; //Try to remove topping just in case it is there, but will probably //be something like no cheese. calzone.Toppings.RemoveTopping(newTopping.ToppingName); addThisModAsTopping = true; } } } else { addThisModAsTopping = false; Console.WriteLine("***Debug JOANNE***TOPPINGS DICTIONARY ITEM NOT FOUND: " + mod.Name + mod.ID); } if (addThisModAsTopping) { calzone.Toppings.AddTopping(newTopping, false); } } calzone.Toppings.UpdateToppingsTotal(); }
private static void GetPizzaToppings(GuestItem oldGuestItem, ref Pizza pizza) { foreach (GuestModifier mod in oldGuestItem.Mods) { bool addThisModAsTopping = true; Topping newTopping = new Topping(ToppingName.Unknown); var wholeOrHalf = ToppingWholeHalf.Whole; var halfOpposite = ToppingWholeHalf.Whole; if (DataBaseDictionaries.DbIdToppingDictionary.ContainsKey(mod.ID)) { var ToppingName = DataBaseDictionaries.DbIdToppingDictionary[mod.ID]; if (MenuFood.PizzaToppings.ContainsKey(ToppingName)) { newTopping = MenuFood.PizzaToppings[ToppingName].GetClone(); } else { addThisModAsTopping = false; Console.WriteLine("***Debug JOANNE***TOPPINGS DICTIONARY DOES NOT CONTAIN: " + ToppingName); continue; } switch (mod.Half) { case "Half_A": case "Half A": wholeOrHalf = ToppingWholeHalf.HalfA; halfOpposite = ToppingWholeHalf.HalfB; break; case "Half_B": case "Half B": wholeOrHalf = ToppingWholeHalf.HalfB; halfOpposite = ToppingWholeHalf.HalfA; break; } if (DataBaseDictionaries.ToppingDbIdDictionary.ContainsKey(ToppingName.HalfMajor) && mod.ID == DataBaseDictionaries.ToppingDbIdDictionary[ToppingName.HalfMajor]) { addThisModAsTopping = false; if (wholeOrHalf == ToppingWholeHalf.Whole) { wholeOrHalf = ToppingWholeHalf.HalfA; } pizza.Toppings.AddMajorToppingsToHalf(wholeOrHalf); } if (mod.State == "Lite") { newTopping.ToppingModifier = ToppingModifierType.LightTopping; } else if (mod.State == "" || (mod.State == "Plus" && mod.Count > 1)) { newTopping.ToppingModifier = ToppingModifierType.ExtraTopping; newTopping.Count = (int)mod.Count; } else if (mod.State == "Plus" && mod.Name.ToUpper() == "NO CHEESE") { newTopping.ToppingModifier = ToppingModifierType.NoTopping; addThisModAsTopping = true; } else if (mod.State == "Side") { newTopping.ToppingModifier = ToppingModifierType.ToppingOnSide; } if (mod.State == "No") { newTopping.ToppingModifier = ToppingModifierType.NoTopping; addThisModAsTopping = true; if (pizza.MajorMamaInfo == MajorOrMama.Major) { if (wholeOrHalf == ToppingWholeHalf.Whole) { pizza.Toppings.RemoveTopping(newTopping.ToppingName); } else { pizza.Toppings.ChangeToppingToHalf(newTopping.ToppingName, halfOpposite); } } else { //Try to remove topping just in case it is there, but will probably //be something like no cheese. pizza.Toppings.RemoveTopping(newTopping.ToppingName); } } } else { addThisModAsTopping = false; if (mod.ID != 50 && mod.ID != 51) { Console.WriteLine("***Debug JOANNE***TOPPINGS DICTIONARY ITEM NOT FOUND: " + mod.Name + mod.ID); } } if (mod.ID == 50) { pizza.ChangePizzaBase(PizzaBase.Pesto, false); addThisModAsTopping = false; } else if (mod.ID == 51) { pizza.ChangePizzaBase(PizzaBase.White, false); addThisModAsTopping = false; } else if (DataBaseDictionaries.ToppingDbIdDictionary.ContainsKey(ToppingName.SatchPanSlice) && mod.ID == DataBaseDictionaries.ToppingDbIdDictionary[ToppingName.SatchPanSlice]) { pizza.ChangePizzaToDeep(); addThisModAsTopping = false; } if (addThisModAsTopping) { newTopping.ToppingWholeHalf = wholeOrHalf; pizza.Toppings.AddTopping(newTopping, false); } } pizza.Toppings.UpdateToppingsTotal(); }
public static Pizza GetPizza(GuestItem dbGuestItem) { var pizza = new Pizza(); switch (dbGuestItem.ID) { case 57: if (dbGuestItem.SelectSizeID == 9) { pizza.PizzaType = PizzaType.ThinSlice; } if (dbGuestItem.SelectSizeID == 10) { pizza.PizzaType = PizzaType.Indy; } if (dbGuestItem.SelectSizeID == 11) { pizza.PizzaType = PizzaType.Medium; } if (dbGuestItem.SelectSizeID == 12) { pizza.PizzaType = PizzaType.Large; } if (dbGuestItem.SelectSizeID == 90) { pizza.PizzaType = PizzaType.LunchSpecialSlice; } break; case 59: if (dbGuestItem.SelectSizeID == 9) { pizza.PizzaType = PizzaType.ThinSlice; } if (dbGuestItem.SelectSizeID == 10) { pizza.PizzaType = PizzaType.Indy; } if (dbGuestItem.SelectSizeID == 11) { pizza.PizzaType = PizzaType.Medium; } if (dbGuestItem.SelectSizeID == 12) { pizza.PizzaType = PizzaType.Large; } if (dbGuestItem.SelectSizeID == 22) { pizza.PizzaType = PizzaType.Mfp; } if (dbGuestItem.SelectSizeID == 23) { pizza.PizzaType = PizzaType.SatchPan; } pizza.MajorMamaInfo = MajorOrMama.Major; pizza.Toppings.AddMajorToppings(); break; case 60: pizza.PizzaType = PizzaType.Mfp; break; case 61: pizza.PizzaType = PizzaType.SatchPan; break; //case 51: // pizza.PizzaType = PizzaType.Calzone; // break; //case 54: // pizza.PizzaType = PizzaType.CalzoneSteakAndCheese; // break; //case 56: // pizza.PizzaType = PizzaType.Calzone; // pizza.MajorMamaInfo = MajorOrMama.Major; // pizza.Toppings.AddMajorToppings(); // break; default: Console.WriteLine("***Debug JOANNE***PIZZA TYPE FROM SERVER NOT FOUND FOR GuestItem ID " + dbGuestItem.ID + " & SizeID: " + dbGuestItem.SelectSizeID); break; } if (dbGuestItem.Mods.Count > 0) { GetPizzaToppings(dbGuestItem, ref pizza); } pizza.PopulateBasePrice(); pizza.PopulateDisplayName(); pizza.PopulatePricePerItem(); pizza.DbItemId = dbGuestItem.ID; pizza.WasSentToKitchen = dbGuestItem.OrderSent; pizza.DbOrderId = (int)dbGuestItem.OrderID; pizza.ItemCount = 1; //pizza.UpdateItemTotal(); return(pizza); }
public ActionResult Index(string Id) { int HotelId = Convert.ToInt32(Id); Session["HotelId"] = HotelId; Hotels hotelItem = dbContext.Hotels.Where(x => x.HotelId == HotelId).FirstOrDefault(); var hotelProperties = from hotelPropertiesConnect in dbContext.HotelPropertyConnects join hotel in dbContext.Hotels on hotelPropertiesConnect.HotelId equals hotel.HotelId join hotelProperty in dbContext.HotelProperties on hotelPropertiesConnect.HotelPropertyId equals hotelProperty.HotelPropertyId where hotel.HotelId == hotelItem.HotelId select hotelProperty; var hotelComments = from hotelComment in dbContext.HotelComments join customer in dbContext.Customers on hotelComment.CustomerId equals customer.CustomerId join hotel in dbContext.Hotels on hotelComment.HotelId equals hotel.HotelId where hotelComment.HotelId == hotelItem.HotelId select new CommentItem() { HotelId = hotel.HotelId, NameSurname = customer.NameSurname, Comment = hotelComment.Comment, InsertedDate = hotelComment.InsertedDate, Rate = hotelComment.Rating, Title = hotelComment.Title }; var hotelRoomType = from hotelRoomValue in dbContext.HotelRooms join roomType in dbContext.RoomTypes on hotelRoomValue.RoomTypeId equals roomType.RoomTypeId where roomType.Title == "Standart Oda" && hotelRoomValue.HotelId == hotelItem.HotelId select new { roomType, hotelRoomValue }; var hotelRoom = (from roomPropertyConnectKey in dbContext.RoomPropertyConnects join roomPropertyKey in dbContext.RoomProperties on roomPropertyConnectKey.RoomPropertyId equals roomPropertyKey.RoomPropertyId join hotelRoomKey in dbContext.HotelRooms on roomPropertyConnectKey.RoomId equals hotelRoomKey.HotelRoomId join RoomTypeKey in dbContext.RoomTypes on hotelRoomKey.RoomTypeId equals RoomTypeKey.RoomTypeId where hotelRoomKey.HotelId == hotelItem.HotelId select new { hotelRoomKey, RoomTypeKey }).ToList().GroupBy(x => x.hotelRoomKey.HotelRoomId).Select(s => new HotelRoomDetail() { AvailableCount = s.First().hotelRoomKey.AvailableCount, BedCount = s.First().RoomTypeKey.BedCount, PersonCount = s.First().RoomTypeKey.PersonCount, Price = s.First().hotelRoomKey.Price, RoomType = s.First().RoomTypeKey.Title, HotelRoomId = s.First().hotelRoomKey.HotelRoomId, roomproperties = dbContext.RoomPropertyConnects.Join(dbContext.RoomProperties, k => k.RoomPropertyId, p => p.RoomPropertyId, (p, k) => new { p, k }).ToList().Where(x => x.p.RoomId == s.First().hotelRoomKey.HotelRoomId).Select(c => new RoomProperties() { RoomPropertyId = c.k.RoomPropertyId, Title = c.k.Title }).ToList() }).ToList(); GuestItem guestItems = new GuestItem(); if (Session["adult"] != null || Session["child"] != null) { guestItems.adultCount = Convert.ToInt32(Session["adult"]); guestItems.childCount = Convert.ToInt32(Session["child"]); } HotelDetailDto hotelDetailDto = new HotelDetailDto() { Description = hotelItem.Description, hotelComments = hotelComments.ToList(), hotelId = hotelItem.HotelId, hotelName = hotelItem.Title, hotelPhotos = dbContext.HotelPhotos.Where(x => x.HotelId == hotelItem.HotelId).ToList(), hotelRooms = hotelRoom, hotelProperties = hotelProperties.ToList(), rate = Convert.ToInt32(hotelItem.Rating), guests = guestItems, roomTypes = hotelRoomType.FirstOrDefault().roomType, Price = hotelRoomType.FirstOrDefault().hotelRoomValue.Price, HotelRoomId = hotelRoomType.FirstOrDefault().hotelRoomValue.HotelRoomId }; if (Session["checkin"] != null || Session["checkout"] != null) { hotelDetailDto.checkin = Convert.ToDateTime(Session["checkin"]).Date.ToShortDateString(); hotelDetailDto.checkout = Convert.ToDateTime(Session["checkout"]).Date.ToShortDateString(); hotelDetailDto.nightCount = Convert.ToDateTime(Session["checkout"]).Date.Day - Convert.ToDateTime(Session["checkin"]).Date.Day; } return(View(hotelDetailDto)); }
internal async Task <DBTable> ConvertOrderToDbTableAsync(Order orderToSend, bool sendOrderToKitchen = false) { if (ServiceCallConfig == ServiceCallConfigType.AllServiceCallsOff) { return(new DBTable()); } //Get stored DBTable. DBTable newTable = DataBaseDictionaries.DbTablesDictionary[orderToSend.TableId]; try { List <decimal> guestIds = await GetGuestIdsAsync(orderToSend.TableId); if (newTable.Guests.Count == 0) { bool first = true; foreach (decimal id in guestIds) { Staunch.POS.Classes.Guest_DB guest = new Staunch.POS.Classes.Guest_DB(); guest.ID = id; guest.CheckedOut = false; guest.Items = new List <GuestItem>(); guest.ComboItems = new List <GuestComboItem>(); guest.TableID = orderToSend.TableId; if (first) { guest.IsWhole = true; first = false; } newTable.Guests.Add(guest); } } if (DataBaseDictionaries.MenuDictionary != null && DataBaseDictionaries.MenuDictionary.Count > 0) { //Create DBItems for Guest_DB object. foreach (var orderItem in orderToSend.OrderItems) { var keysTuple = orderItem.GetMenuDbItemKeys(); var dbItem = new DBItem(); bool menuItemFound = false; //Use the item from the Database Dictionary. foreach (var menuItem in DataBaseDictionaries.MenuDictionary[keysTuple.Item1]) { if (menuItem.ID == keysTuple.Item2) { dbItem = menuItem; menuItemFound = true; break; } } if (orderItem.DbOrderId <= 0) { orderItem.DbOrderId = -1; } if (menuItemFound) { GuestItem guestItem = orderItem.CreateGuestItem(dbItem, orderItem.DbOrderId); guestItem.Mods = orderItem.CreateMods(); guestItem.OrderSent = sendOrderToKitchen; if (orderItem.PartOfCombo) { if (newTable.Guests[0].ComboItems == null) { newTable.Guests[0].ComboItems = new List <GuestComboItem>(); } //TODO: Create GuestComboItem which contains ComboGuestItems - will add guestItem there. } newTable.Guests[0].Items.Add(guestItem); //Pricing check - TODO: Take out for production?? //Had to comment out in testing because wouldn't process - says mismatch with service but can't find problem. //GuestItem databaseGuestItem = checkClient.PriceOrder(guestItem); //if (databaseGuestItem.Price != guestItem.Price) //{ // Console.WriteLine("JOANNE LOG: price differs for " + guestItem.ShortName); //} } } } } catch (Exception ex) { var whatisthis = ex.InnerException; throw; } return(newTable); }