public static int[] ShowMulti(string PageShow, TableInformation mainTable, int[] mergeTable)
 {
     if (instance == null)
         instance = new TableForm();
     if (PageShow != null)
         instance.TablePanel.Caption = PageShow;
     instance.BtnOk.Visible = true;
     instance.mode = MODE_MULTI;
     instance.tableSelect = mainTable;
     instance.multiTemp.Clear();
     instance.LoadTableInformation();
     instance.CreateMultiTemp(mergeTable);
     instance.AddTableButton();
     instance.ShowDialog();
     return instance.multiSelectID;
 }
 /// <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();
 }
 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();
 }
 /// <summary>
 /// This method call TableService.GetTableList() for get all tables' information
 /// and create objects in TableInfo array list.
 /// </summary>
 private void LoadTableInformation()
 {
     TableService.TableService service = new TableService.TableService();
     tableInfo = service.GetTableList();
     while (tableInfo == null)
     {
         DialogResult result = MessageBox.Show("Can't load table information.", "Error",
             MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
         if (result == DialogResult.Cancel)
             ((MainForm)this.MdiParent).Exit();
         else
             tableInfo = service.GetTableList();
     }
     // Search table object by table id = 0 (Take Out Table)
     for (int i = 0;i < tableInfo.Length;i++)
     {
         if (tableInfo[i].TableID == 0)
         {
             takeOutTable = tableInfo[i];
             break;
         }
     }
 }
 private void LoadTableInformation()
 {
     smartRestaurant.TableService.TableService service = new smartRestaurant.TableService.TableService();
     this.tableInfo = service.GetTableList();
     while (this.tableInfo == null)
     {
         if (MessageBox.Show("Can't load table information.", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Hand) == DialogResult.Cancel)
         {
             ((MainForm) base.MdiParent).Exit();
         }
         else
         {
             this.tableInfo = service.GetTableList();
         }
     }
     for (int i = 0; i < this.tableInfo.Length; i++)
     {
         if (this.tableInfo[i].TableID == 0)
         {
             this.takeOutTable = this.tableInfo[i];
             return;
         }
     }
 }
 /// <summary>
 /// This method uses for show TakeOutForm. Take Out Form is form for users to
 /// select customer and new take out. Or for users to select order this already take out
 /// for edit for check bill.
 /// </summary>
 /// <param name="table">Table Information object. This case use table number 0 object.</param>
 /// <param name="custName">Predefine customer name. Use for users create order before select customer name or users change take out's customer name.</param>
 /// <param name="takeOrder">This boolean variable is true for change customer name after create order.</param>
 public void ShowTakeOutForm(TableInformation table, string custName, bool takeOrder)
 {
     takeOutForm.Table = table;
     takeOutForm.TakeOrderMode = takeOrder;
     takeOutForm.CustomerName = custName;
     if (userProfile != null)
         takeOutForm.EmployeeID = userProfile.UserID;
     takeOutForm.Show();
     takeOutForm.BringToFront();
     takeOutForm.UpdateForm();
 }
 /// <summary>
 /// This method uses to show TakeOrderForm.<br/>
 /// TakeOrderForm uses in many cases. But this method uses in <u>New Take Out</u> case.
 /// This method use for new take out order or resume take out order. But not include
 /// change customer name case. If want to change customer name, use
 /// <i>ShowTakeOrderForm(string custName)</i>
 /// </summary>
 /// <param name="table">Table Information object. In this case uses table number 0 object.</param>
 /// <param name="orderID">For resume take out, uses Order ID. If new take out, uses 0 (zero).</param>
 /// <param name="custName">For predefine customer name.</param>
 public void ShowTakeOrderForm(TableInformation table, int orderID, string custName)
 {
     takeOrderForm.Table = table;
     takeOrderForm.OrderID = orderID;
     takeOrderForm.CustomerName = custName;
     takeOrderForm.TakeOrderResume = false;
     if (userProfile != null)
         takeOrderForm.EmployeeID = userProfile.UserID;
     takeOrderForm.Show();
     takeOrderForm.BringToFront();
     takeOrderForm.UpdateForm();
 }
 /// <summary>
 /// This method uses to show TakeOrderForm.<br/>
 /// TakeOrderForm uses in many cases. But this method uses in <u>Take Order</u> case.
 /// Take Order case has 2 sub cases. First case is new order, open new table.
 /// Second case is resume order, for new order item, cancel item, or check bill.
 /// </summary>
 /// <param name="table">Table Information object for open new order or resume order.</param>
 public void ShowTakeOrderForm(TableInformation table)
 {
     if (table != null)
     {
         takeOrderForm.Table = table;
         takeOrderForm.OrderID = 0;
         takeOrderForm.TakeOrderResume = false;
     }
     else
         takeOrderForm.TakeOrderResume = true;
     if (userProfile != null)
         takeOrderForm.EmployeeID = userProfile.UserID;
     takeOrderForm.Show();
     takeOrderForm.BringToFront();
     takeOrderForm.UpdateForm();
 }
 /// <summary>
 /// This methods use for show PrintReceiptForm. Print Receipt Form is form to print
 /// receipt and check bill form. All cases, take order and take out, use this form to
 /// check bill too.
 /// </summary>
 /// <param name="table">Table object for print receipt and check bill.</param>
 /// <param name="order">Order object for print receipt and check bill.</param>
 /// <param name="orderBill">Order Bill object for print receipt and check bill.</param>
 public void ShowPrintReceiptForm(TableInformation table, OrderInformation order, OrderBill orderBill)
 {
     if (table == null || order == null || orderBill == null)
         return;
     printReceiptForm.Table = table;
     printReceiptForm.Order = order;
     printReceiptForm.OrderBill = orderBill;
     if (userProfile != null)
         printReceiptForm.EmployeeID = userProfile.UserID;
     printReceiptForm.Show();
     printReceiptForm.BringToFront();
     printReceiptForm.UpdateForm();
 }
 public static OrderInformation CreateOrderObject(OrderInformation orderInfo, int employeeID, TableInformation tableInfo, int guestNumber, int billNumber)
 {
     if (orderInfo == null)
     {
         orderInfo = new OrderInformation();
         orderInfo.OrderID = 0;
         orderInfo.OrderTime = DateTime.Now;
         orderInfo.TableID = tableInfo.TableID;
         orderInfo.EmployeeID = employeeID;
         orderInfo.NumberOfGuest = guestNumber;
         orderInfo.CloseOrderDate = AppParameter.MinDateTime;
         orderInfo.CreateDate = DateTime.Now;
         orderInfo.Bills = new OrderBill[billNumber];
         for (int j = 0; j < billNumber; j++)
         {
             orderInfo.Bills[j] = new OrderBill();
             orderInfo.Bills[j].CloseBillDate = AppParameter.MinDateTime;
             orderInfo.Bills[j].EmployeeID = employeeID;
             orderInfo.Bills[j].BillID = j + 1;
         }
         return orderInfo;
     }
     int billID = 0;
     OrderBill[] bills = orderInfo.Bills;
     orderInfo.Bills = new OrderBill[billNumber];
     for (int i = 0; i < billNumber; i++)
     {
         if (i < bills.Length)
         {
             orderInfo.Bills[i] = bills[i];
             billID = orderInfo.Bills[i].BillID;
         }
         else
         {
             orderInfo.Bills[i] = new OrderBill();
             orderInfo.Bills[i].CloseBillDate = AppParameter.MinDateTime;
             orderInfo.Bills[i].EmployeeID = employeeID;
             orderInfo.Bills[i].BillID = ++billID;
         }
     }
     return orderInfo;
 }
Exemple #11
0
 private void Table_Click(object sender, EventArgs e)
 {
     ImageButton button = (ImageButton) sender;
     int objectValue = (int) button.ObjectValue;
     if (objectValue < 0)
     {
         objectValue = -objectValue;
     }
     for (int i = 0; i < this.tableInfo.Length; i++)
     {
         if (this.tableInfo[i].TableID == objectValue)
         {
             if (this.tableStatus[i].InUse)
             {
                 MessageForm.Show("Select Table", "Can't select used table.");
                 return;
             }
             if (this.mode == MODE_SINGLE)
             {
                 this.tableSelect = this.tableInfo[i];
                 base.Close();
             }
             else if (this.mode == MODE_MULTI)
             {
                 if (this.tableInfo[i].TableID != this.tableSelect.TableID)
                 {
                     if (this.multiTemp.Contains(this.tableInfo[i]))
                     {
                         this.multiTemp.Remove(this.tableInfo[i]);
                         button.Red = 1f;
                         button.Green = 1f;
                         button.Blue = 1f;
                         return;
                     }
                     this.multiTemp.Add(this.tableInfo[i]);
                     button.Red = 2f;
                     button.Green = 2f;
                     button.Blue = 1f;
                 }
                 return;
             }
         }
     }
 }
Exemple #12
0
 private void BtnCancel_Click(object sender, EventArgs e)
 {
     this.tableSelect = null;
     this.multiSelectID = null;
     base.Close();
 }
Exemple #13
0
 public override void UpdateForm()
 {
     if (AppParameter.DeliveryModeOnly)
     {
         this.BtnMain.Visible = false;
         this.BtnManager.Visible = ((MainForm) base.MdiParent).User.IsManager() || ((MainForm) base.MdiParent).User.IsAuditor();
         this.BtnExit.Visible = true;
     }
     else
     {
         this.BtnMain.Visible = true;
         this.BtnManager.Visible = false;
         this.BtnExit.Visible = false;
     }
     if (this.tableInfo == null)
     {
         smartRestaurant.TableService.TableService service = new smartRestaurant.TableService.TableService();
         TableInformation[] tableList = service.GetTableList();
         while (tableList == null)
         {
             if (MessageBox.Show("Can't load table information.", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Hand) == DialogResult.Cancel)
             {
                 ((MainForm) base.MdiParent).Exit();
             }
             else
             {
                 tableList = service.GetTableList();
             }
         }
         for (int i = 0; i < tableList.Length; i++)
         {
             if (tableList[i].TableID == 0)
             {
                 this.tableInfo = tableList[i];
                 break;
             }
         }
         if (this.tableInfo == null)
         {
             ((MainForm) base.MdiParent).Exit();
         }
     }
     this.selectedTakeOut = null;
     this.selectedRoad = null;
     this.roadIgnoreFlag = false;
     this.roadLstIgnoreFlag = false;
     this.LblPageID.Text = "Employee ID:" + ((MainForm) base.MdiParent).UserID + " | STTO020";
     this.UpdateTakeOutList();
     if (this.FieldFName.Text == "")
     {
         this.BtnCustList_Click(null, null);
     }
     else
     {
         this.BtnCustSearch_Click(null, null);
     }
     this.FieldPhone.Focus();
 }
 private void Table_Click(object sender, System.EventArgs e)
 {
     ImageButton btn = (ImageButton)sender;
     int tableValue = (int)btn.ObjectValue;
     if (tableValue < 0)
         tableValue = -tableValue;
     // Search table object by table id
     for (int i = 0;i < tableInfo.Length;i++)
     {
         if (tableInfo[i].TableID == tableValue)
         {
             if (tableStatus[i].InUse)
             {
                 MessageForm.Show("Select Table", "Can't select used table.");
                 return;
             }
             if (mode == MODE_SINGLE)
             {
                 tableSelect  = tableInfo[i];
                 this.Close();
             }
             else if (mode == MODE_MULTI)
             {
                 if (tableInfo[i].TableID == tableSelect.TableID)
                     return;
                 // Change select table
                 if (multiTemp.Contains(tableInfo[i]))
                 {
                     multiTemp.Remove(tableInfo[i]);
                     btn.Red = 1;
                     btn.Green = 1;
                     btn.Blue = 1;
                 }
                 else
                 {
                     multiTemp.Add(tableInfo[i]);
                     btn.Red = 2;
                     btn.Green = 2;
                     btn.Blue = 1;
                 }
                 break;
             }
         }
     }
     // If not found in loop
 }
 private void BtnCancel_Click(object sender, System.EventArgs e)
 {
     tableSelect = null;
     multiSelectID = null;
     this.Close();
 }
 /// <summary>
 /// If not found order object, create new order object.
 /// If found order object, allocate bills array.
 /// </summary>
 public static OrderInformation CreateOrderObject(OrderInformation orderInfo, int employeeID,
     TableInformation tableInfo, int guestNumber, int billNumber)
 {
     if (orderInfo == null)
     {
         // Create new order object
         orderInfo = new OrderInformation();
         orderInfo.OrderID = 0;
         orderInfo.OrderTime = DateTime.Now;
         orderInfo.TableID = tableInfo.TableID;;
         orderInfo.EmployeeID = employeeID;
         orderInfo.NumberOfGuest = guestNumber;
         orderInfo.CloseOrderDate = DateTime.MinValue;
         orderInfo.CreateDate = DateTime.Now;
         // Allocate bills array
         orderInfo.Bills = new OrderBill[billNumber];
         for (int i = 0;i < billNumber;i++)
         {
             orderInfo.Bills[i] = new OrderBill();
             orderInfo.Bills[i].CloseBillDate = DateTime.MinValue;
             orderInfo.Bills[i].EmployeeID = employeeID;
             orderInfo.Bills[i].BillID = i + 1;
         }
     }
     else
     {
         int lastID = 0;
         // Reallocate bills array
         OrderBill[] oldBills = orderInfo.Bills;
         orderInfo.Bills = new OrderBill[billNumber];
         for (int i = 0;i < billNumber;i++)
         {
             if (i < oldBills.Length)
             {
                 orderInfo.Bills[i] = oldBills[i];
                 lastID = orderInfo.Bills[i].BillID;
             }
             else
             {
                 orderInfo.Bills[i] = new OrderBill();
                 orderInfo.Bills[i].CloseBillDate = DateTime.MinValue;
                 orderInfo.Bills[i].EmployeeID = employeeID;
                 orderInfo.Bills[i].BillID = ++lastID;
             }
         }
     }
     return orderInfo;
 }