/// <summary>
        /// Update list of payment type in button list
        /// </summary>
        private void UpdatePaymentTypeList()
        {
            ButtonItem item;
            if (paymentMethods == null)
                return;
            PaymentTypePad.AutoRefresh = false;
            if (PaymentTypePad.Items.Count == 0)
            {
                // Add payment method to pad
                for (int i = 0;i < paymentMethods.Length;i++)
                {
                    item = new ButtonItem(paymentMethods[i].paymentMethodName, paymentMethods[i].paymentMethodID.ToString());
                    PaymentTypePad.Items.Add(item);
                }
            }

            int pos;
            for (int i = 0;i < paymentMethods.Length;i++)
            {
                item = (ButtonItem)PaymentTypePad.Items[i];
                pos = receipt.PaymentMethodList.IndexOf(paymentMethods[i]);
                if (paymentMethods[i] == receipt.PaymentMethod)
                {
                    PaymentTypePad.SetMatrix(i, 1, 1.75F, 1.75F);
                    if (pos >= 0)
                        item.Text = paymentMethods[i].paymentMethodName + "\n"
                            + ((double)receipt.PayValueList[pos]).ToString("N");
                    continue;
                }
                if (pos >= 0)
                {
                    PaymentTypePad.SetMatrix(i, 1, 2, 2);
                    item.Text = paymentMethods[i].paymentMethodName + "\n"
                        + ((double)receipt.PayValueList[pos]).ToString("N");
                }
                else
                {
                    PaymentTypePad.SetMatrix(i, 1, 1, 1);
                    item.Text = paymentMethods[i].paymentMethodName;
                }
            }
            PaymentTypePad.AutoRefresh = true;
            UpdatePaymentButtion();
        }
 /// <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;
 }
示例#3
0
 private void UpdateDateButton()
 {
     DateTime startDate = this.startDate;
     this.DatePad.AutoRefresh = false;
     this.DatePad.Items.Clear();
     this.DatePad.Red = 1f;
     this.DatePad.Green = 1f;
     this.DatePad.Blue = 1f;
     for (int i = 0; i < 7; i++)
     {
         ButtonItem item = new ButtonItem(startDate.ToString("dd MMM yyyy", AppParameter.Culture), i.ToString());
         this.DatePad.Items.Add(item);
         startDate = startDate.AddDays(1.0);
     }
     this.DatePad.AutoRefresh = true;
     this.UpdateReserveQueue();
 }
 /// <summary>
 /// Update list of discount in button list
 /// </summary>
 private void UpdateDiscountList()
 {
     Discount[] discounts = Receipt.Discounts;
     if (discounts == null)
         return;
     DiscountPad.AutoRefresh = false;
     if (DiscountPad.Items.Count == 0)
     {
         // Add discount to pad
         for (int i = 0;i < discounts.Length;i++)
         {
             ButtonItem item = new ButtonItem(discounts[i].description, discounts[i].promotionID.ToString());
             DiscountPad.Items.Add(item);
         }
     }
     DiscountPad.Red = 1;
     DiscountPad.Green = 1;
     DiscountPad.Blue = 1;
     for (int i = 0;i < discountSelected.Count;i++)
     {
         int index = (int)discountSelected[i];
         int pos = DiscountPad.GetPosition(index);
         if (pos > -1)
             DiscountPad.SetMatrix(pos, 1, 2, 1);
     }
     DiscountPad.AutoRefresh = true;
 }
示例#5
0
 private void UpdatePaymentTypeList()
 {
     if (this.paymentMethods != null)
     {
         ButtonItem item;
         this.PaymentTypePad.AutoRefresh = false;
         if (this.PaymentTypePad.Items.Count == 0)
         {
             for (int j = 0; j < this.paymentMethods.Length; j++)
             {
                 item = new ButtonItem(this.paymentMethods[j].paymentMethodName, this.paymentMethods[j].paymentMethodID.ToString());
                 this.PaymentTypePad.Items.Add(item);
             }
         }
         for (int i = 0; i < this.paymentMethods.Length; i++)
         {
             item = (ButtonItem) this.PaymentTypePad.Items[i];
             int index = this.receipt.PaymentMethodList.IndexOf(this.paymentMethods[i]);
             if (this.paymentMethods[i] == this.receipt.PaymentMethod)
             {
                 this.PaymentTypePad.SetMatrix(i, 1f, 1.75f, 1.75f);
                 if (index >= 0)
                 {
                     double num4 = (double) this.receipt.PayValueList[index];
                     item.Text = this.paymentMethods[i].paymentMethodName + "\n" + num4.ToString("N");
                 }
             }
             else if (index >= 0)
             {
                 this.PaymentTypePad.SetMatrix(i, 1f, 2f, 2f);
                 item.Text = this.paymentMethods[i].paymentMethodName + "\n" + ((double) this.receipt.PayValueList[index]).ToString("N");
             }
             else
             {
                 this.PaymentTypePad.SetMatrix(i, 1f, 1f, 1f);
                 item.Text = this.paymentMethods[i].paymentMethodName;
             }
         }
         this.PaymentTypePad.AutoRefresh = true;
         this.UpdatePaymentButtion();
     }
 }
示例#6
0
 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;
     }
 }
示例#7
0
 private void UpdateDiscountList()
 {
     Discount[] discounts = Receipt.Discounts;
     if (discounts != null)
     {
         this.DiscountPad.AutoRefresh = false;
         if (this.DiscountPad.Items.Count == 0)
         {
             for (int j = 0; j < discounts.Length; j++)
             {
                 ButtonItem item = new ButtonItem(discounts[j].description, discounts[j].promotionID.ToString());
                 this.DiscountPad.Items.Add(item);
             }
         }
         this.DiscountPad.Red = 1f;
         this.DiscountPad.Green = 1f;
         this.DiscountPad.Blue = 1f;
         for (int i = 0; i < this.discountSelected.Count; i++)
         {
             int index = (int) this.discountSelected[i];
             int position = this.DiscountPad.GetPosition(index);
             if (position > -1)
             {
                 this.DiscountPad.SetMatrix(position, 1f, 2f, 1f);
             }
         }
         this.DiscountPad.AutoRefresh = true;
     }
 }
 /// <summary>
 /// Clear waiting list button.
 /// </summary>
 private void InitWaitingList()
 {
     try
     {
         BillItemPad.AutoRefresh = false;
         ButtonItem item;
         for (int row = 0;row < BillItemPad.Row;row++)
             for (int col = 0;col < BillItemPad.Column;col++)
             {
                 item = new ButtonItem(null, null);
                 BillItemPad.Items.Add(item);
                 if (row == 0)
                     BillItemPad.SetMatrix(col, 1, 1, 2);
             }
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
     }
     finally
     {
         BillItemPad.AutoRefresh = true;
     }
 }
 /*private void AddTableButton()
 {
     try
     {
         // Get table status from web service
         TableService.TableService service = new TableService.TableService();
         TableStatus[] tableStatus = service.GetTableStatus();
         // Create button to screen
         ImageButton button;
         Image img = ButtonImgList.Images[0];
         Image imgClick = ButtonImgList.Images[1];
         int x, y;
         bool newButton = false;
         x = 13; y = 48;
         if (tableStatus != null && tableStatus.Length > 1)
         {
             // Table not include ID = 0
             if (tableButtons == null || tableButtons.Length != tableStatus.Length - 1)
             {
                 TablePanel.Controls.Clear();
                 tableButtons = new ImageButton[tableStatus.Length - 1];
                 newButton = true;
             }
             for (int cnt = 0;cnt < tableStatus.Length - 1;cnt++)
             {
                 if (newButton)
                 {
                     button = new ImageButton();
                     button.Image = img;
                     button.ImageClick = imgClick;
                     button.Left = x;
                     button.Top = y;
                     button.Text = tableStatus[cnt + 1].TableName;
                 }
                 else
                     button = tableButtons[cnt];
                 // Check Table Status
                 if (tableStatus[cnt + 1].InUse)
                 {
                     button.ObjectValue = -tableStatus[cnt + 1].TableID;
                     button.Red = 1;
                     button.Green = 2;
                     button.Blue = 2;
                 }
                 else
                 {
                     button.ObjectValue = tableStatus[cnt + 1].TableID;
                     button.Red = 1;
                     button.Green = 1;
                     button.Blue = 1;
                 }
                 // Add event and control
                 if (newButton)
                 {
                     button.Click += new EventHandler(this.Table_Click);
                     TablePanel.Controls.Add(button);
                     tableButtons[cnt] = button;
                 }
                 x += button.Width + 10;
                 if (((cnt + 1) % 8) == 0)
                 {
                     x = 13; y += button.Height + 10;
                 }
             }
         }
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
     }
 }*/
 /// <summary>
 /// This method use for check all table information and create button item on
 /// table list button.
 /// </summary>
 private void AddTableButton()
 {
     try
     {
         TablePad.AutoRefresh = false;
         TablePad.Red = 1;
         TablePad.Green = 1;
         TablePad.Blue = 1;
         TablePad.Items.Clear();
         // Get table status from web service
         TableService.TableService service = new TableService.TableService();
         tableStatus = service.GetTableStatus();
         // Create button to screen
         if (tableStatus != null && tableStatus.Length > 1)
         {
             // Table not include ID = 0
             for (int cnt = 0;cnt < tableStatus.Length - 1;cnt++)
             {
                 ButtonItem item = new ButtonItem(tableStatus[cnt + 1].TableName, null);
                 TablePad.Items.Add(item);
                 // Check Table Status
                 if (tableStatus[cnt + 1].InUse)
                     item.Value = ((int)(-tableStatus[cnt + 1].TableID)).ToString();
                 else
                     item.Value = tableStatus[cnt + 1].TableID.ToString();
             }
         }
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
     }
     finally
     {
         TablePad.AutoRefresh = true;
     }
 }
示例#10
0
 private void InitWaitingList()
 {
     this.WaitingListPanel.Visible = this.showWaitingList;
     try
     {
         this.BillItemPad.AutoRefresh = false;
         for (int i = 0; i < this.BillItemPad.Row; i++)
         {
             for (int j = 0; j < this.BillItemPad.Column; j++)
             {
                 ButtonItem item = new ButtonItem(null, null);
                 this.BillItemPad.Items.Add(item);
                 if (i == 0)
                 {
                     this.BillItemPad.SetMatrix(j, 1f, 1f, 2f);
                 }
             }
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.ToString());
     }
     finally
     {
         this.BillItemPad.AutoRefresh = true;
     }
 }
示例#11
0
 private void AddTableButton()
 {
     try
     {
         this.TablePad.AutoRefresh = false;
         this.TablePad.Red = 1f;
         this.TablePad.Green = 1f;
         this.TablePad.Blue = 1f;
         this.TablePad.Items.Clear();
         this.tableStatus = new smartRestaurant.TableService.TableService().GetTableStatus();
         if ((this.tableStatus != null) && (this.tableStatus.Length > 1))
         {
             for (int i = 0; i < (this.tableStatus.Length - 1); i++)
             {
                 ButtonItem item = new ButtonItem(this.tableStatus[i + 1].TableName, this.tableStatus[i + 1]);
                 if (this.tableStatus[i + 1].LockInUse)
                 {
                     item.IsLock = true;
                 }
                 this.TablePad.Items.Add(item);
             }
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.ToString());
     }
     finally
     {
         this.UpdateTableStatus();
         this.TablePad.AutoRefresh = true;
     }
 }