private void ChangeKOTAllItemStatus(object sender, RoutedEventArgs e) { try { KitchenViewModel kitchenViewModel = new KitchenViewModel(); var btnChangeStatus = sender as Button; string kotId = btnChangeStatus.Name.Substring(4); if (btnChangeStatus.Content.ToString() == "C") { kitchenViewModel.ChangeAllKOTItemStatus(kotId, (int)EnumUtility.KOTStatus.Cooking); } else if (btnChangeStatus.Content.ToString() == "P") { kitchenViewModel.ChangeAllKOTItemStatus(kotId, (int)EnumUtility.KOTStatus.Pending); } else if (btnChangeStatus.Content.ToString() == "D") { kitchenViewModel.ChangeAllKOTItemStatus(kotId, (int)EnumUtility.KOTStatus.Completed); } GetKitchenPending(KitchenOrder); } catch (Exception ex) { SystemError.Register(ex); } }
public ActionResult Index() { List <Order> orders = orderService.GetPendingOrders(); var model = new KitchenViewModel(orders); return(View(model)); }
/* Given date, show guest-information (expected amount, checked-in amount, etc.) */ public IActionResult ShowNotCheckInGuests() { DateTime date = DateTime.Now.Date; var expectedGuestsInfo = _context.Set <BuffetReservation>().Where(c => (c.Date.Day == date.Day) && (c.Date.Month == date.Month) && (c.Date.Year == date.Year)).ToList(); var checkedInEntries = _context.Set <CheckedInGuest>().Where(c => c.Date == date).ToList(); //var expectedGuestsInfo = _context.Set<BuffetReservation>().Find(date.Day); //var checkedInEntries = _context.Set<CheckedInGuest>().Where(c => c.Date.Day == date.Day).ToList(); //var buffetReservations = _context.Set<BuffetReservation>().Where(c => (c.Date.Day == date.Day) && (c.Date.Month == date.Month) && (c.Date.Year == date.Year)).ToList(); //var restaurantCheckIns = _context.Set<CheckedInGuest>().Where(c => c.Date == date).ToList(); var vm = new KitchenViewModel(expectedGuestsInfo, checkedInEntries); return(View(vm)); // if (buffetReservations != null && restaurantCheckIns.Count > 0) // { // var vm = new KitchenViewModel(buffetReservations, restaurantCheckIns); // return View(vm); // } // return RedirectToAction(nameof(Index)); }
public async Task Update(KitchenViewModel model) { var basketContent = new StringContent(JsonConvert.SerializeObject(model), System.Text.Encoding.UTF8, "application/json"); var response = await _apiClient.PostAsync("", basketContent); response.EnsureSuccessStatusCode(); }
public KitchenWindow() { InitializeComponent(); kvm = new KitchenViewModel(); DataContext = kvm; //CurrentDemoDataTemplateType = DemoDataTemplateType.OrderLine; //this.Loaded += new RoutedEventHandler(MainWindow_Loaded); }
/* Given date, show guest-information (expected amount, checked-in amount, etc.) */ public IActionResult ShowNotCheckInGuests(DateTime dateTime) { DateTime date = dateTime.Date; var expectedGuestsInfo = _context.Set <BuffetReservation>().Where(c => (c.Date.Day == date.Day) && (c.Date.Month == date.Month) && (c.Date.Year == date.Year)).ToList(); var checkedInEntries = _context.Set <CheckedInGuest>().Where(c => c.Date == date).ToList(); var vm = new KitchenViewModel(expectedGuestsInfo, checkedInEntries); return(View(vm)); }
public IActionResult Details(DateTime date) { var vm = new KitchenViewModel() { Reservations = _context.Reservations.Where(r => r.Date >= date.Date && r.Date < date.Date.AddDays(1)).ToList(), CheckedIns = _context.CheckedIns.Where(r => r.Date >= date.Date && r.Date < date.Date.AddDays(1)).ToList(), Date = date }; return(View(vm)); }
public IActionResult Find(DateTime Date) { var filterDate = Date.Date.AddDays(1); var res = _context.Bookings.Where(b => b.BookingDate >= Date.Date && b.BookingDate < filterDate).ToList(); var vm = new KitchenViewModel() { Bookings = res, Date = Date.Date, }; return(View(vm)); }
public IActionResult Put(KitchenViewModel model) { try { var result = _kitchenService.Update(model); return(Ok(result)); } catch (Exception ex) { _logger.LogError(ex, "Error occured in Put"); return(BadRequest(ex.Message)); } }
public async Task <IActionResult> Index() { KitchenViewModel kitchenViewModel = new KitchenViewModel(); kitchenViewModel.OrdersToBeFinished = await _context.Orders .Where(i => i.IsPaid == true && (i.Status == "Complete" || i.Status == "GOAReceived")) .Include(i => i.OrderItems) .ThenInclude(i => i.Item) .Include(i => i.OrderMenus) .ThenInclude(i => i.Menu) .ToListAsync(); return(View(kitchenViewModel)); }
public IActionResult KitchenView() { try { string requestString = Request.QueryString.Value; var date = (requestString == "" ? DateTime.Today : DateTime.Parse(HttpUtility.ParseQueryString(requestString).Get("date"))); var viewModel = new KitchenViewModel(_context, date); return(View(viewModel)); } catch (Exception e) { var viewModel = new KitchenViewModel(_context, DateTime.Today); return(View(viewModel)); } ; }
private KitchenViewModel CreateKitchen() { var serviceCollection = new ServiceCollection(); serviceCollection.AddDbContext <KitchenKanbanDB>(options => options.UseInMemoryDatabase("KitchenKanbanDB"), ServiceLifetime.Transient); ServiceProvider serviceProvider = serviceCollection.BuildServiceProvider(); IUserInfo userInfo = new UserInfo() { UserId = "95632324-a9f8-44ba-9b3d-4c90dd5d9650", UserType = Models.Enums.UserEnum.UserType.Administrator }; IKitchenService kitchenService = new KitchenService(serviceProvider, userInfo); var input = new KitchenViewModel() { CounterNumber = "My Counter 1" }; var kitchen = kitchenService.Create(input); return(kitchen); }
public bool Update(KitchenViewModel input) { try { var kitchen = _databaseContext.Kitchens.Where(x => x.KitchenId == input.KitchenId).FirstOrDefault(); if (kitchen == null) { throw new Exception("Kitchen not found."); } kitchen.CounterNumber = input.CounterNumber; kitchen.UpdatedBy = _userInfo.UserId; kitchen.UpdatedOn = DateTime.Now; _databaseContext.Kitchens.Update(kitchen); _databaseContext.SaveChanges(); return(true); } catch (Exception ex) { throw ex; } }
private void FormKitchen_Load(object sender, EventArgs e) { if (id.HasValue) { try { KitchenViewModel view = service.GetElement(id.Value); if (view != null) { textBoxName.Text = view.KitchenName; dataGridView.DataSource = view.KitchenDishs; dataGridView.Columns[0].Visible = false; dataGridView.Columns[1].Visible = false; dataGridView.Columns[2].Visible = false; dataGridView.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
//************************ Kitchen ************************************************** // GET: Bookings kitchen public async Task <IActionResult> Kitchen(DateTime searchDate) { var vm = new KitchenViewModel(); var bookings = from b in _context.Bookings select b; vm.bookings = await bookings.ToListAsync(); var CheckinQuery = from c in _context.Bookings select c.Date.Date; vm.CheckList = await CheckinQuery.Distinct().ToListAsync(); if (CheckinQuery != null) { bookings = bookings.Where(c => c.Date.Date.Equals(searchDate.Date)); } vm.bookings = await bookings.ToListAsync(); foreach (var booking in bookings) { if (booking.Checkedin == true) { vm.TotalAmountOfChecked += booking.AmountAdults + booking.AmountChildren; vm.AmontOfAdultsCheckedIn += booking.AmountAdults; vm.AmontOfChildrenCheckedIn += booking.AmountChildren; } vm.TotalAmountOfGuest += booking.AmountAdults + booking.AmountChildren; vm.TotalAmontOfAdults += booking.AmountAdults; vm.TotalAmontOfChildren += booking.AmountChildren; } vm.NotCheckedInYet = vm.TotalAmountOfGuest - vm.TotalAmountOfChecked; return(View(vm)); }
public KitchenViewModel Create(KitchenViewModel input) { try { var newKitchen = new Kitchen() { KitchenId = Guid.NewGuid().ToString(), CounterNumber = input.CounterNumber, CreatedBy = _userInfo.UserId, CreatedOn = DateTime.Now }; _databaseContext.Kitchens.Add(newKitchen); _databaseContext.SaveChanges(); input.KitchenId = newKitchen.KitchenId; return(input); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Create(KitchenViewModel model) { await _kitchen.Create(model); return(Redirect("/")); }
private void ChangeKOTStatus(object sender, MouseButtonEventArgs e) { try { SolidColorBrush solidColorBrush = new SolidColorBrush(); KitchenViewModel kitchenViewModel = new KitchenViewModel(); var kotDetailPanel = sender as WrapPanel; var txtfoodmenuName = kotDetailPanel.Children[0] as TextBlock; var txtQty = kotDetailPanel.Children[1] as TextBlock; var txtbKOTItemId = kotDetailPanel.Children[2] as TextBlock; var txtbKOTId = kotDetailPanel.Children[3] as TextBlock; var txtbKOTStatus = kotDetailPanel.Children[4] as TextBlock; var txtOrderTable = kotDetailPanel.Children[5] as TextBlock; int status = 0; ppStatus.StaysOpen = true; ppStatus.IsOpen = true; txtppTableNumber.Text = txtOrderTable.Text; txtppFoodmenuName.Text = txtfoodmenuName.Text; txtppQty.Text = txtQty.Text; txtbKOTItemIdHidden.Text = txtbKOTItemId.Text; txtbKOTIdHidden.Text = txtbKOTId.Text; if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Completed.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ffffff")); } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Pending.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ff726f")); } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Cooking.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#fbff99")); } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Ready.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#5cff7e")); } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Served.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ccd9ff")); } grItem.Background = solidColorBrush; e.Handled = true; return; if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Pending.ToString()) { status = (int)EnumUtility.KOTStatus.Cooking; } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Cooking.ToString()) { status = (int)EnumUtility.KOTStatus.Ready; } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Ready.ToString()) { status = (int)EnumUtility.KOTStatus.Served; } else if (txtbKOTStatus.Text == EnumUtility.KOTStatus.Served.ToString()) { status = (int)EnumUtility.KOTStatus.Completed; } if (status != 0) { kitchenViewModel.ChangeKOTStatus(txtbKOTItemId.Text, txtbKOTId.Text, status); GetKitchenPending(KitchenOrder); } } catch (Exception ex) { SystemError.Register(ex); } }
private void GetKitchenPending(List <int> KitchenOrder) { KitchenViewModel kitchenViewModel = new KitchenViewModel(); List <KitchenModel> kitchenModel = new List <KitchenModel>(); kitchenModel = kitchenViewModel.GetKitchenStaus(KitchenOrder); try { wpKitchenView.Children.Clear(); if (kitchenModel.Count > 0) { foreach (var item in kitchenModel) { WrapPanel wpKOT = new WrapPanel(); wpKOT.Orientation = Orientation.Vertical; wpKOT.VerticalAlignment = VerticalAlignment.Top; wpKOT.Width = 212; wpKOT.Height = 325; wpKOT.Margin = new Thickness(1); SolidColorBrush solidColorBrush = new SolidColorBrush(); solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#E8E8E8")); WrapPanel kotHeaderPanel = new WrapPanel(); kotHeaderPanel.Orientation = Orientation.Horizontal; kotHeaderPanel.VerticalAlignment = VerticalAlignment.Top; kotHeaderPanel.Width = 211; kotHeaderPanel.Height = 325; kotHeaderPanel.Background = solidColorBrush; kotHeaderPanel.Margin = new Thickness(1); ////Order Id TextBlock txtbOrderId = new TextBlock(); txtbOrderId.Text = "Order# " + item.CustomerOrderId.ToString(); txtbOrderId.Name = "txtbOrderId_" + item.CustomerOrderId.ToString(); txtbOrderId.FontSize = 1; txtbOrderId.Width = 0; txtbOrderId.Visibility = Visibility.Hidden; txtbOrderId.TextAlignment = TextAlignment.Left; kotHeaderPanel.Children.Add(txtbOrderId); //Table Name TextBlock txtbTableName = new TextBlock(); string strPerson = ""; if (item.AllocatedPerson > 0) { strPerson = " [" + item.AllocatedPerson + "] " + item.WaiterName; } txtbTableName.Text = "TABLE #" + item.TableName + strPerson; txtbTableName.Name = "txtbTableName_" + item.TableId; txtbTableName.FontSize = 18; txtbTableName.FontWeight = FontWeights.Bold; //txtbTableName.Width = 146; //if (item.CustomerOrderId == 0) //{ txtbTableName.Width = 211; //} txtbTableName.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#000000")); txtbTableName.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFFFFF")); txtbTableName.TextAlignment = TextAlignment.Left; kotHeaderPanel.Children.Add(txtbTableName); if (item.CustomerOrderId != 0) { ToggleButton btnAllKOT = new ToggleButton(); btnAllKOT.Content = "..."; btnAllKOT.Name = "btnAllKOT_" + item.TableId; btnAllKOT.FontSize = 16; btnAllKOT.FontWeight = FontWeights.Bold; btnAllKOT.Width = 45; btnAllKOT.Height = 27; btnAllKOT.BorderThickness = new Thickness(0); btnAllKOT.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#000000")); btnAllKOT.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFF")); btnAllKOT.Margin = new Thickness(0, 0, 0, 0); btnAllKOT.Checked += DisplayAllKotItem; btnAllKOT.Unchecked += DisplayCurrentKotItem; for (var i = 0; i < KitchenOrder.Count; i++) { if (KitchenOrder[i] == item.TableId) { btnAllKOT.IsChecked = true; } } // kotHeaderPanel.Children.Add(btnAllKOT); } //Waiter Name //TextBlock txtWaiterName = new TextBlock(); //txtWaiterName.Text = "Richard ";// + item.TableName + strPerson; //txtWaiterName.Name = "txtbTableName_" + item.AllocatedPerson; //txtWaiterName.FontSize = 18; //txtWaiterName.FontWeight = FontWeights.Bold; //txtbTableName.Width = 211; //txtWaiterName.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#000000")); //txtWaiterName.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFFFFF")); //txtWaiterName.TextAlignment = TextAlignment.Left; //kotHeaderPanel.Children.Add(txtWaiterName); if (item.kotStatusList.Count > 0) { foreach (var kotItem in item.kotStatusList) { if (kotItem.KOTStatus == EnumUtility.KOTStatus.Completed.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ffffff")); } else if (kotItem.KOTStatus == EnumUtility.KOTStatus.Pending.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ff726f")); } else if (kotItem.KOTStatus == EnumUtility.KOTStatus.Cooking.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#fbff99")); } else if (kotItem.KOTStatus == EnumUtility.KOTStatus.Ready.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#5cff7e")); } else if (kotItem.KOTStatus == EnumUtility.KOTStatus.Served.ToString()) { solidColorBrush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ccd9ff")); } WrapPanel kotDetailPanel = new WrapPanel(); kotDetailPanel.Orientation = Orientation.Horizontal; kotDetailPanel.VerticalAlignment = VerticalAlignment.Top; kotDetailPanel.Width = 226; kotDetailPanel.Background = solidColorBrush; kotDetailPanel.Margin = new Thickness(1); kotDetailPanel.MouseDown += ChangeKOTStatus; //Food Menu Name TextBlock txtbFoodMenuName = new TextBlock(); txtbFoodMenuName.Text = kotItem.FoodMenuName; txtbFoodMenuName.Name = "txtbFoodMenuName_" + kotItem.KOTItemId; txtbFoodMenuName.FontSize = 16; txtbFoodMenuName.Width = 225; txtbFoodMenuName.HorizontalAlignment = HorizontalAlignment.Left; kotDetailPanel.Children.Add(txtbFoodMenuName); //Food Menu Qty TextBlock txtbFoodMenuQty = new TextBlock(); txtbFoodMenuQty.Text = "Qty: " + kotItem.FoodMenuQty.ToString(); txtbFoodMenuQty.Name = "txtbFoodMenuQty_" + kotItem.KOTItemId; txtbFoodMenuQty.FontSize = 16; txtbFoodMenuQty.Width = 70; txtbFoodMenuQty.TextAlignment = TextAlignment.Left; kotDetailPanel.Children.Add(txtbFoodMenuQty); //KOT Item Id TextBlock txtbKOTItemId = new TextBlock(); txtbKOTItemId.Text = kotItem.KOTItemId.ToString(); txtbKOTItemId.Name = "txtbKOTItemId_" + kotItem.KOTItemId; txtbKOTItemId.Visibility = Visibility.Hidden; txtbKOTItemId.Width = 5; kotDetailPanel.Children.Add(txtbKOTItemId); //KOT Id TextBlock txtbKOTId = new TextBlock(); txtbKOTId.Text = kotItem.KOTId.ToString(); txtbKOTId.Name = "txtbKOTId_" + kotItem.KOTId; txtbKOTId.Visibility = Visibility.Hidden; txtbKOTId.Width = 5; kotDetailPanel.Children.Add(txtbKOTId); //KOT Status TextBlock txtbKOTStatus = new TextBlock(); txtbKOTStatus.Text = kotItem.KOTStatus.ToString(); txtbKOTStatus.Name = "txtbKOTStatus_" + kotItem.KOTItemId.ToString(); txtbKOTStatus.FontSize = 1; txtbKOTStatus.Width = 2; txtbKOTStatus.TextAlignment = TextAlignment.Right; kotDetailPanel.Children.Add(txtbKOTStatus); //Table Name as hidden attribute TextBlock txtbTableNameHidden = new TextBlock(); strPerson = ""; if (item.AllocatedPerson > 0) { strPerson = " [ " + item.AllocatedPerson + " ]"; } txtbTableNameHidden.Text = "TABLE #" + item.TableName + strPerson; txtbTableNameHidden.Name = "txtbTableName_" + item.TableId; txtbTableNameHidden.FontSize = 1; txtbTableNameHidden.Width = 1; kotDetailPanel.Children.Add(txtbTableNameHidden); kotHeaderPanel.Children.Add(kotDetailPanel); } //scrollbar if (item.kotStatusList.Count <= 6) { kotHeaderPanel.Height = 325; wpKOT.Children.Clear(); wpKOT.Children.Add(kotHeaderPanel); } else { kotHeaderPanel.Height = 50 * item.kotStatusList.Count; ScrollViewer sv = new ScrollViewer(); sv.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; sv.Height = 325; sv.Content = kotHeaderPanel; wpKOT.Children.Clear(); wpKOT.Children.Add(sv); } } else { wpKOT.Children.Clear(); wpKOT.Children.Add(kotHeaderPanel); } if (item.kotStatusList.Count > 0) { WrapPanel kotButtonPanel = new WrapPanel(); kotButtonPanel.Orientation = Orientation.Horizontal; kotButtonPanel.VerticalAlignment = VerticalAlignment.Top; kotButtonPanel.Width = 220; kotButtonPanel.Margin = new Thickness(1); ToggleButton btnSelectAll = new ToggleButton(); btnSelectAll.Content = "Select All"; btnSelectAll.Name = "btnSelectAll"; btnSelectAll.FontSize = 16; btnSelectAll.FontWeight = FontWeights.Bold; btnSelectAll.Width = 90; btnSelectAll.Height = 40; btnSelectAll.BorderThickness = new Thickness(1); btnSelectAll.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D9BA41")); btnSelectAll.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFF")); btnSelectAll.Margin = new Thickness(0, 0, 0, 0); btnSelectAll.Checked += SelectAllKotItem; btnSelectAll.Unchecked += DeSelectAllKotItem; kotButtonPanel.Children.Add(btnSelectAll); //Cooking Button Button btnCooking = new Button(); btnCooking.Content = "C"; btnCooking.Name = "btnC" + item.CustomerOrderId.ToString(); btnCooking.FontSize = 16; btnCooking.FontWeight = FontWeights.Bold; btnCooking.Width = 40; btnCooking.Height = 40; btnCooking.BorderThickness = new Thickness(1); btnCooking.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D9BA41")); btnCooking.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFF")); btnCooking.Margin = new Thickness(0, 0, 0, 0); btnCooking.Visibility = Visibility.Hidden; btnCooking.Click += ChangeKOTAllItemStatus; kotButtonPanel.Children.Add(btnCooking); //Pending Button Button btnPending = new Button(); btnPending.Content = "P"; btnPending.Name = "btnP" + item.CustomerOrderId.ToString(); btnPending.FontSize = 16; btnPending.FontWeight = FontWeights.Bold; btnPending.Width = 40; btnPending.Height = 40; btnPending.BorderThickness = new Thickness(1); btnPending.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D9BA41")); btnPending.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFF")); btnPending.Margin = new Thickness(0, 0, 0, 0); btnPending.Visibility = Visibility.Hidden; btnPending.Click += ChangeKOTAllItemStatus; kotButtonPanel.Children.Add(btnPending); //Completed Button Button btnCompleted = new Button(); btnCompleted.Content = "D"; btnCompleted.Name = "btnD" + item.CustomerOrderId.ToString(); btnCompleted.FontSize = 16; btnCompleted.FontWeight = FontWeights.Bold; btnCompleted.Width = 40; btnCompleted.Height = 40; btnCompleted.BorderThickness = new Thickness(1); btnCompleted.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D9BA41")); btnCompleted.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#FFF")); btnCompleted.Margin = new Thickness(0, 0, 0, 0); btnCompleted.Visibility = Visibility.Hidden; btnCompleted.Click += ChangeKOTAllItemStatus; kotButtonPanel.Children.Add(btnCompleted); wpKOT.Children.Add(kotButtonPanel); } wpKitchenView.Children.Add(wpKOT); } } } catch (Exception ex) { SystemError.Register(ex); } }