public static MenuItem GetMenuItemFromID(MenuType type, int id) { if ((type.MenuItems != null) && (type.MenuItems.Length > 0)) { for (int i = 0; i < type.MenuItems.Length; i++) { if (type.MenuItems[i].ID == id) { return type.MenuItems[i]; } } } return null; }
/// <summary> /// Get menu item by menu type and menu id /// </summary> /// <param name="type">Menu type</param> /// <param name="id">Menu ID</param> /// <returns>Menu item for menu type/id. return null if not found.</returns> public static MenuItem GetMenuItemFromID(MenuType type, int id) { MenuItem menuItem = null; if (type.MenuItems != null && type.MenuItems.Length > 0) { for (int j = 0;j < type.MenuItems.Length;j++) if (type.MenuItems[j].ID == id) { menuItem = type.MenuItems[j]; break; } } return menuItem; }
private void CategoryPad_PadClick(object sender, smartRestaurant.Controls.ButtonListPadEventArgs e) { int typeIndex; // Check for click in other input state if (inputState == INPUT_UNIT || inputState == INPUT_OPTION) StartInputMenu(); if (inputState != INPUT_MENU) return; // Get type button index if (e.Value == null) return; try { typeIndex = int.Parse(e.Value); } catch (Exception ex) { MessageForm.Show(ex.ToString(), "Exception"); return; } // Show at monitor inputValue = e.Button.Text.Substring(0,2); UpdateMonitor(); // Set Menu Item selectedType = menuTypes[typeIndex]; MenuService.MenuItem[] menuItems = selectedType.MenuItems; OptionPad.AutoRefresh = false; OptionPad.Items.Clear(); OptionPad.ItemStart = 0; if (menuItems != null) for (int i = 0;i < menuItems.Length;i++) OptionPad.Items.Add(new ButtonItem(MenuManagement.GetMenuLanguageName(menuItems[i]), i.ToString())); OptionPad.Red = e.Button.Red; OptionPad.Green = e.Button.Green; OptionPad.Blue = e.Button.Blue; OptionPad.AutoRefresh = true; }
/// <summary> /// Initial form when start take order. /// (Call this method from outside) /// </summary> public override void UpdateForm() { LoadMenus(); // Check for reserve mode takeOutMode = (tableInfo.TableID == 0); OrderService.OrderService service = new OrderService.OrderService(); if (!takeOrderResume) { // Load old table order information (Web Services) if (!takeOutMode) { orderInfo = service.GetOrder(tableInfo.TableID); if (orderInfo != null) { if (tableInfo.TableID != orderInfo.TableID) { TableService.TableService tabService = new TableService.TableService(); tableInfo = tabService.GetTableInformation(orderInfo.TableID); } tableIDList = service.GetTableReference(orderInfo.OrderID); } else tableIDList = null; } else if (takeOutOrderID > 0) { orderInfo = service.GetOrderByOrderID(takeOutOrderID); tableIDList = null; } else { orderInfo = null; tableIDList = null; } // Reset input isChanged = false; } else { if (!takeOutMode) orderInfo = service.GetOrder(tableInfo.TableID); } // Check exist order information if (orderInfo != null) { // Found (Edit order) guestNumber = orderInfo.NumberOfGuest; billNumber = orderInfo.Bills.Length; } else if (guestNumber <= 0) { // Not found (New order) guestNumber = billNumber = 1; } // Check Demo version if (AppParameter.IsDemo()) { ListOrderItem.ItemWidth = 240; ListOrderCount.Left = 248; ListOrderItemBy.Visible = true; LblGuest.Text = "Guest"; } else { ListOrderItem.ItemWidth = 280; ListOrderCount.Left = 288; ListOrderItemBy.Visible = false; LblGuest.Text = "Seat"; } ListOrderCount.Left = ListOrderItem.Left + ListOrderItem.ItemWidth; // Clear Input selectedBill = null; selectedItem = null; selectedType = null; if (orderInfo != null && orderInfo.Bills != null) { for (int i = 0;i < orderInfo.Bills.Length;i++) if (orderInfo.Bills[i].CloseBillDate == DateTime.MinValue) { selectedBill = orderInfo.Bills[i]; break; } } // Update screen LblPageID.Text = "Employee ID:" + ((MainForm)MdiParent).UserID + " | "; if (takeOutMode) LblPageID.Text += "STTO021"; else LblPageID.Text += "STTO011"; PanCustName.Visible = takeOutMode; BtnSearch.Visible = takeOutMode; OptionPad.AutoRefresh = false; OptionPad.Red = OptionPad.Green = OptionPad.Blue = 1; OptionPad.AutoRefresh = true; ListOrderItem.Reset(); ListOrderCount.Reset(); ListOrderItemBy.Reset(); UpdateTableInformation(); StartInputMenu(); }
/// <summary> /// Method to clear variable and prepare for move item. /// </summary> private void StartMoveItem() { inputState = INPUT_MOVEITEM; inputValue = "-> Select Seat"; selectedType = null; moveItem = true; CategoryPad.AutoRefresh = false; CategoryPad.ItemStart = 0; CategoryPad.AutoRefresh = true; UpdateOrderGrid(); UpdateMonitor(); OptionPad.AutoRefresh = false; OptionPad.Items.Clear(); OptionPad.ItemStart = 0; OptionPad.Red = 1; OptionPad.Green = 1; OptionPad.Blue = 1; OptionPad.AutoRefresh = true; }
/// <summary> /// Method to set variable to prepare for input amount of menu item. /// </summary> private void StartInputUnit() { inputState = INPUT_UNIT; inputValue = ""; selectedType = null; moveItem = false; CategoryPad.AutoRefresh = false; CategoryPad.ItemStart = 0; CategoryPad.AutoRefresh = true; UpdateOrderGrid(); UpdateMonitor(); OptionPad.AutoRefresh = false; OptionPad.Items.Clear(); OptionPad.ItemStart = 0; OptionPad.Red = 1; OptionPad.Green = 1; OptionPad.Blue = 1; OptionPad.AutoRefresh = true; }
/// <summary> /// Method to set variable and screen to show menu option. /// </summary> private void StartInputOption() { // Get Menu object and check for exist. MenuService.MenuItem menu = MenuManagement.GetMenuItemFromID(selectedItem.MenuID); if (menu == null) { StartInputMenu(); return; } // Set variable to prepare for input option state. inputState = INPUT_OPTION; inputValue = ""; selectedType = null; moveItem = false; CategoryPad.AutoRefresh = false; CategoryPad.ItemStart = 0; CategoryPad.AutoRefresh = true; UpdateOrderGrid(); UpdateMonitor(); // Load Option to panel OptionPad.AutoRefresh = false; OptionPad.Items.Clear(); OptionPad.ItemStart = 0; OptionPad.Red = 1; OptionPad.Green = 1; OptionPad.Blue = 1; if (menuOptions != null) { // Loop for all Menu Option for (int i = 0;i < menuOptions.Length;i++) { int len = 0; if (selectedItem.DefaultOption) { if (menu.MenuDefaults != null) len = menu.MenuDefaults.Length; } else { if (selectedItem.ItemChoices != null) len = selectedItem.ItemChoices.Length; } // Loop for Menu Item Default/Selected Option for (int j = 0;j < len;j++) { int choiceID; if (selectedItem.DefaultOption) choiceID = menu.MenuDefaults[j].OptionID; else choiceID = selectedItem.ItemChoices[j].OptionID; // In case of Menu Option is use in Menu Item if (menuOptions[i].OptionID == choiceID) { // Loop and set Menu Option Choice to button pad for (int k = 0;k < menuOptions[i].OptionChoices.Length;k++) { ButtonItem btn = new ButtonItem(menuOptions[i].OptionChoices[k].ChoiceName, menuOptions[i].OptionChoices[k].OptionID.ToString()+":"+menuOptions[i].OptionChoices[k].ChoiceID.ToString()); if ((j % 2) == 0) btn.ForeColor = Color.Red; else btn.ForeColor = Color.Blue; OptionPad.Items.Add(btn); if (selectedItem.DefaultOption) { if (menuOptions[i].OptionChoices[k].ChoiceID == menu.MenuDefaults[j].DefaultChoiceID) OptionPad.SetMatrix(OptionPad.Items.Count - 1, 2, 1, 2); } else { if (selectedItem.ItemChoices != null && menuOptions[i].OptionChoices[k].ChoiceID == selectedItem.ItemChoices[j].ChoiceID) OptionPad.SetMatrix(OptionPad.Items.Count - 1, 2, 1, 2); } } } } } } OptionPad.AutoRefresh = true; }
private void CategoryPad_PadClick(object sender, ButtonListPadEventArgs e) { if ((this.inputState == 1) || (this.inputState == 2)) { this.StartInputMenu(); } if ((this.inputState == 0) && (e.Value != null)) { int num; try { num = int.Parse(e.Value); } catch (Exception exception) { MessageForm.Show(exception.ToString(), "Exception"); return; } this.inputValue = e.Button.Text.Substring(0, 2); this.UpdateMonitor(); this.selectedType = this.menuTypes[num]; smartRestaurant.MenuService.MenuItem[] menuItems = this.selectedType.MenuItems; this.OptionPad.AutoRefresh = false; this.OptionPad.Items.Clear(); this.OptionPad.ItemStart = 0; if (menuItems != null) { for (int i = 0; i < menuItems.Length; i++) { this.OptionPad.Items.Add(new ButtonItem(MenuManagement.GetMenuLanguageName(menuItems[i]), i.ToString())); } } this.OptionPad.Red = e.Button.Red; this.OptionPad.Green = e.Button.Green; this.OptionPad.Blue = e.Button.Blue; this.OptionPad.AutoRefresh = true; } }
public override void UpdateForm() { this.LoadMenus(); this.takeOutMode = this.tableInfo.TableID == 0; smartRestaurant.OrderService.OrderService service = new smartRestaurant.OrderService.OrderService(); if (!this.takeOrderResume) { if (!this.takeOutMode) { this.orderInfo = service.GetOrder(this.tableInfo.TableID); if (this.orderInfo != null) { if (this.tableInfo.TableID != this.orderInfo.TableID) { this.tableInfo = this.tabService.GetTableInformation(this.orderInfo.TableID); } this.tableIDList = service.GetTableReference(this.orderInfo.OrderID); } else { this.tableIDList = null; } } else if (this.takeOutOrderID > 0) { this.orderInfo = service.GetOrderByOrderID(this.takeOutOrderID); this.tableIDList = null; } else { this.orderInfo = null; this.tableIDList = null; } this.isChanged = false; } else if (!this.takeOutMode) { this.orderInfo = service.GetOrder(this.tableInfo.TableID); } if (this.orderInfo != null) { this.guestNumber = this.orderInfo.NumberOfGuest; this.billNumber = this.orderInfo.Bills.Length; } else if (this.guestNumber <= 0) { this.guestNumber = this.billNumber = 1; } if (AppParameter.IsDemo()) { this.ListOrderItem.ItemWidth = 240; this.ListOrderCount.Left = 0xf8; this.ListOrderItem.Row = 14; this.ListOrderCount.Row = 14; this.ListOrderItemBy.Row = 14; this.ListOrderItemBy.Visible = true; this.LblTotalText.Visible = false; this.LblTotalValue.Visible = false; this.LblGuest.Text = "Guest"; } else { if (AppParameter.ShowOrderItemPrice) { this.ListOrderItem.ItemWidth = 240; this.ListOrderCount.Left = 0xf8; this.ListOrderCount.ItemWidth = 80; this.ListOrderItem.Row = 13; this.ListOrderCount.Row = 13; this.LblTotalText.Visible = true; this.LblTotalValue.Visible = true; } else { this.ListOrderItem.ItemWidth = 280; this.ListOrderCount.Left = 0x120; this.ListOrderCount.ItemWidth = 40; this.ListOrderItem.Row = 14; this.ListOrderCount.Row = 14; this.LblTotalText.Visible = false; this.LblTotalValue.Visible = false; } this.ListOrderItemBy.Visible = false; this.LblGuest.Text = "Seat"; } this.ListOrderCount.Left = this.ListOrderItem.Left + this.ListOrderItem.ItemWidth; this.selectedBill = null; this.selectedItem = null; this.selectedType = null; if ((this.orderInfo != null) && (this.orderInfo.Bills != null)) { for (int i = 0; i < this.orderInfo.Bills.Length; i++) { if (this.orderInfo.Bills[i].CloseBillDate == AppParameter.MinDateTime) { this.selectedBill = this.orderInfo.Bills[i]; break; } } } this.LblPageID.Text = "Employee ID:" + ((MainForm) base.MdiParent).UserID + " | "; if (this.takeOutMode) { this.LblPageID.Text = this.LblPageID.Text + "STTO021"; } else { this.LblPageID.Text = this.LblPageID.Text + "STTO011"; } this.PanCustName.Visible = this.takeOutMode; this.BtnSearch.Visible = this.takeOutMode; this.OptionPad.AutoRefresh = false; this.OptionPad.Red = this.OptionPad.Green = this.OptionPad.Blue = 1f; this.OptionPad.AutoRefresh = true; this.ListOrderItem.Reset(); this.ListOrderCount.Reset(); this.ListOrderItemBy.Reset(); this.UpdateTableInformation(); this.StartInputMenu(); }
private void StartMoveItem() { this.inputState = 20; this.inputValue = "-> Select Seat"; this.selectedType = null; this.moveItem = true; this.CategoryPad.AutoRefresh = false; this.CategoryPad.ItemStart = 0; this.CategoryPad.AutoRefresh = true; this.UpdateOrderGrid(); this.UpdateMonitor(); this.OptionPad.AutoRefresh = false; this.OptionPad.Items.Clear(); this.OptionPad.ItemStart = 0; this.OptionPad.Red = 1f; this.OptionPad.Green = 1f; this.OptionPad.Blue = 1f; this.OptionPad.AutoRefresh = true; }
private void StartInputOption() { smartRestaurant.MenuService.MenuItem menuItemFromID = MenuManagement.GetMenuItemFromID(this.selectedItem.MenuID); if (menuItemFromID == null) { this.StartInputMenu(); } else { this.inputState = 2; this.inputValue = ""; this.selectedType = null; this.moveItem = false; this.CategoryPad.AutoRefresh = false; this.CategoryPad.ItemStart = 0; this.CategoryPad.AutoRefresh = true; this.UpdateOrderGrid(); this.UpdateMonitor(); this.OptionPad.AutoRefresh = false; this.OptionPad.Items.Clear(); this.OptionPad.ItemStart = 0; this.OptionPad.Red = 1f; this.OptionPad.Green = 1f; this.OptionPad.Blue = 1f; if (this.menuOptions != null) { for (int i = 0; i < this.menuOptions.Length; i++) { int length = 0; if (this.selectedItem.DefaultOption) { if (menuItemFromID.MenuDefaults != null) { length = menuItemFromID.MenuDefaults.Length; } } else if (this.selectedItem.ItemChoices != null) { length = this.selectedItem.ItemChoices.Length; } for (int j = 0; j < length; j++) { int optionID; if (this.selectedItem.DefaultOption) { optionID = menuItemFromID.MenuDefaults[j].OptionID; } else { optionID = this.selectedItem.ItemChoices[j].OptionID; } if (this.menuOptions[i].OptionID == optionID) { for (int k = 0; k < this.menuOptions[i].OptionChoices.Length; k++) { ButtonItem item2 = new ButtonItem(this.menuOptions[i].OptionChoices[k].ChoiceName, this.menuOptions[i].OptionChoices[k].OptionID.ToString() + ":" + this.menuOptions[i].OptionChoices[k].ChoiceID.ToString()); if ((j % 2) == 0) { item2.ForeColor = Color.Red; } else { item2.ForeColor = Color.Blue; } this.OptionPad.Items.Add(item2); if (this.selectedItem.DefaultOption) { if (this.menuOptions[i].OptionChoices[k].ChoiceID == menuItemFromID.MenuDefaults[j].DefaultChoiceID) { this.OptionPad.SetMatrix(this.OptionPad.Items.Count - 1, 2f, 1f, 2f); } } else if ((this.selectedItem.ItemChoices != null) && (this.menuOptions[i].OptionChoices[k].ChoiceID == this.selectedItem.ItemChoices[j].ChoiceID)) { this.OptionPad.SetMatrix(this.OptionPad.Items.Count - 1, 2f, 1f, 2f); } } } } } } this.OptionPad.AutoRefresh = true; } }