private void FillOrders() { COrderManager tempOrderManager = new COrderManager(); List<COrderShow> tempOrderShowList = (List<COrderShow>)tempOrderManager.OrderListShowByStatus("Paid").Data; dgvCurrentOrders.RowCount = 0; for (int orderCounter = 0; orderCounter < tempOrderShowList.Count; orderCounter++) { CTableIcon tableIcon = new CTableIcon(); tableIcon.User = tempOrderShowList[orderCounter].UserName; tableIcon.GuestCount = tempOrderShowList[orderCounter].GuestCount.ToString(); tableIcon.TableName = tempOrderShowList[orderCounter].TableName; tableIcon.Type = tempOrderShowList[orderCounter].OrderType; tableIcon.OrderID = tempOrderShowList[orderCounter].OrderID; if (tableIcon.Type.Equals("Table")) { tableIcon.TableName = "Table " + tempOrderShowList[orderCounter].TableNumber.ToString(); } else if (tableIcon.Type.Equals("Tabs")) { tableIcon.TableName = "Tab " + tempOrderShowList[orderCounter].TableNumber.ToString(); } else if (tableIcon.Type.Equals("TakeAway")) { COrderInfo temp2OrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(tempOrderShowList[orderCounter].OrderID).Data; CCustomerManager tempCustomerManager = new CCustomerManager(); CCustomerInfo tempCustomerinfo = new CCustomerInfo(); tempCustomerinfo = (CCustomerInfo)tempCustomerManager.CustomerInfoGetByCustomerID(temp2OrderInfo.CustomerID).Data; if (tempCustomerinfo != null) { tableIcon.TableName = tempCustomerinfo.CustomerName; } else { tableIcon.TableName = "Take Away"; } tableIcon.GuestCountLabel.Text = tempOrderShowList[orderCounter].Status; } DataGridViewRowCollection dgvRow = (DataGridViewRowCollection)dgvCurrentOrders.Rows; dgvRow.Add(tableIcon.OrderID, tableIcon.TableName, tempOrderShowList[orderCounter].OnlineOrderID); } }
private void functionalButton1_Click(object sender, EventArgs e) { try { COrderManager tempOrderManager = new COrderManager(); CResult oResult = tempOrderManager.OrderInfoByOrderID(orderID); COrderInfo tempOrderInfo = new COrderInfo(); if (oResult.IsSuccess && oResult.Data != null) { tempOrderInfo = (COrderInfo)oResult.Data; } List<COrderShow> tempOrderShowList = new List<COrderShow>(); oResult = tempOrderManager.OrderListShowByStatus("Paid"); if (oResult.IsSuccess && oResult.Data != null) { tempOrderShowList = (List<COrderShow>)oResult.Data; } if (tempOrderInfo.OrderType.Equals("Table")) { tempOrderManager.DeleteTableInfo(tempOrderInfo.TableNumber, "Table"); CTakeAwayForm tempTakeAway = new CTakeAwayForm(orderID); tempTakeAway.Show(); CFormManager.Forms.Push(this); this.Hide(); } else if (tempOrderInfo.OrderType.Equals("TakeAway")) { CCalculatorForm tableNumberForm = new CCalculatorForm("Table Information", "Table Number"); tableNumberForm.ShowDialog(); if (CCalculatorForm.inputResult.Equals("Cancel")) return; if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0) { CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!"); tempMessageBox.ShowDialog(); return; } string tableNumber = ""; tableNumber = CCalculatorForm.inputResult; bool found = false; for (int counter = 0; counter < tempOrderShowList.Count; counter++) { if (int.Parse(tableNumber) == tempOrderShowList[counter].TableNumber && tempOrderShowList[counter].OrderType.Equals("Table")) found = true; } if (found) { CMessageBox tempMessageBox = new CMessageBox("Error", "Table already opened. Please select another table number."); tempMessageBox.ShowDialog(); return; } CCalculatorForm tableGuestForm = new CCalculatorForm("Table Information", "Guest Quantity"); tableGuestForm.ShowDialog(); if (CCalculatorForm.inputResult.Equals("Cancel")) return; if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0) { CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!"); tempMessageBox.ShowDialog(); return; } string tableGuest = ""; tableGuest = CCalculatorForm.inputResult; tempOrderManager.DeleteTableInfo(tempOrderInfo.TableNumber, "TakeAway"); tempOrderInfo.OrderType = "Table"; tempOrderInfo.Status = "Seated"; tempOrderInfo.TableNumber = int.Parse(tableNumber); //tempOrderInfo.TableName = "Table " + tableNumber; tempOrderInfo.GuestCount = int.Parse(tableGuest); CTableInfo tempTableInfo = new CTableInfo(); tempTableInfo.TableNumber = tempOrderInfo.TableNumber; tempTableInfo.TableType = "Table"; tempOrderManager.InsertTableInfo(tempTableInfo); ////g_ConvertButton.Text = "Convert to Take Away"; tempOrderManager.UpdateOrderInfo(tempOrderInfo); } } catch (Exception exp) { MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void g_OpenTabsButton_Click(object sender, EventArgs e) { try { COrderManager tempOrderManager = new COrderManager(); List<COrderShow> tempOrderShowList = (List<COrderShow>)tempOrderManager.OrderListShowByStatus("Paid").Data; CKeyBoardForm tempKeyboardForm = new CKeyBoardForm("Tabs Information", "Enter Customer Name"); tempKeyboardForm.ShowDialog(); if (CKeyBoardForm.Content.Equals("Cancel") || CKeyBoardForm.Content.Equals("")) return; string tabsName = CKeyBoardForm.Content; CCalculatorForm tableGuestForm = new CCalculatorForm("Tabs Information", "Guest Quantity"); tableGuestForm.ShowDialog(); if (CCalculatorForm.inputResult.Equals("Cancel")) return; if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0) { CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!"); tempMessageBox.ShowDialog(); return; } string tableGuest = ""; tableGuest = CCalculatorForm.inputResult; NewOrder(); CResult oResult=tempOrderManager.OrderInfoByOrderID(orderID); COrderInfo tempOrderInfo = new COrderInfo(); if (oResult.IsSuccess && oResult.Data != null) { tempOrderInfo = (COrderInfo)oResult.Data; } tempOrderInfo.GuestCount = int.Parse(tableGuest); tempOrderInfo.TableName = tabsName; tempOrderManager.UpdateOrderInfo(tempOrderInfo); } catch (Exception eee) { } }
private void g_ConvertButton_Click(object sender, EventArgs e) { try { COrderManager tempOrderManager = new COrderManager(); CResult oResult = tempOrderManager.OrderListShowByStatus("Paid"); List<COrderShow> tempOrderShowList= new List<COrderShow>(); if (oResult.IsSuccess && oResult.Data != null) { tempOrderShowList = (List<COrderShow>)oResult.Data; } CCalculatorForm tableNumberForm = new CCalculatorForm("Table Information", "Table Number"); tableNumberForm.ShowDialog(); string tableNumber = ""; if (CCalculatorForm.inputResult.Equals("Cancel")) return; if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0) { CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!"); tempMessageBox.ShowDialog(); return; } tableNumber = CCalculatorForm.inputResult; //check whether table already exists bool found = false; for (int orderCounter = 0; orderCounter < tempOrderShowList.Count; orderCounter++) { if (int.Parse(tableNumber) == tempOrderShowList[orderCounter].TableNumber && tempOrderShowList[orderCounter].OrderType.Equals("Table")) found = true; } if (found) { CMessageBox tempMessageBox = new CMessageBox("Error", "Table already opened. Please select another table number."); tempMessageBox.ShowDialog(); return; } CCalculatorForm tableGuestForm = new CCalculatorForm("Table Information", "Guest Quantity"); tableGuestForm.ShowDialog(); if (CCalculatorForm.inputResult.Equals("Cancel")) return; if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0) { CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!"); tempMessageBox.ShowDialog(); return; } string tableGuest = ""; tableGuest = CCalculatorForm.inputResult; //update order info table COrderInfo tempOrderInfo = new COrderInfo(); oResult = tempOrderManager.OrderInfoByOrderID(orderID); if (oResult.IsSuccess && oResult.Data != null) { tempOrderInfo = (COrderInfo)oResult.Data; } //delete previous tab number from table info if(tempOrderInfo.TableNumber!=0) tempOrderManager.DeleteTableInfo(tempOrderInfo.TableNumber, "Tabs"); //update order info tempOrderInfo.GuestCount = int.Parse(tableGuest); tempOrderInfo.Status = "Seated"; tempOrderInfo.OrderType = "Table"; tempOrderInfo.TableNumber = int.Parse(tableNumber); tempOrderInfo.TableName = ""; tempOrderManager.UpdateOrderInfo(tempOrderInfo); //insert new table number in table info CTableInfo tempTableInfo = new CTableInfo(); tempTableInfo.TableNumber = tempOrderInfo.TableNumber; tempTableInfo.TableType = "Table"; tempOrderManager.InsertTableInfo(tempTableInfo); CMainForm tempMainForm = (CMainForm)CFormManager.Forms.Pop(); tempMainForm.Show(); this.Close(); } catch (Exception eee) { //MessageBox.Show(eee.ToString()); } }
private void NewTableButton_Click(object sender, EventArgs e) { try { COrderManager tempOrderManager = new COrderManager(); List<COrderShow> tempOrderShowList = (List<COrderShow>)tempOrderManager.OrderListShowByStatus("Paid").Data; CCalculatorForm tableNumberForm = new CCalculatorForm("Table Information", "Table Number"); tableNumberForm.ShowDialog(); if (CCalculatorForm.inputResult.Equals("Cancel")) return; if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0) { CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!"); tempMessageBox.ShowDialog(); return; } string tableNumber = ""; tableNumber = CCalculatorForm.inputResult; if (tableNumber.Equals("")) return; bool found = false; for (int recordCounter = 0; recordCounter < tempOrderShowList.Count; recordCounter++) { if (int.Parse(tableNumber) == tempOrderShowList[recordCounter].TableNumber && tempOrderShowList[recordCounter].OrderType.Equals("Table")) found = true; } if (found) { CMessageBox tempMessageBox = new CMessageBox("Error", "Table already opened. Please select another table number."); tempMessageBox.ShowDialog(); return; } if (tableNumber.Equals("Cancel")) { return; } CCalculatorForm tableGuestForm = new CCalculatorForm("Table Information", "Covers"); tableGuestForm.ShowDialog(); if (CCalculatorForm.inputResult.Equals("Cancel")) { return; } if (CCalculatorForm.inputResult.Equals("") || Int32.Parse(CCalculatorForm.inputResult) == 0) { CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!"); tempMessageBox.ShowDialog(); return; } string tableGuest = ""; tableGuest = CCalculatorForm.inputResult; if (tableGuest.Equals("Cancel")) //If cancelled then exit. { return; } CCalculatorForm floorNumberForm = new CCalculatorForm("Floor Information", "Floor Number"); floorNumberForm.ShowDialog(); if (CCalculatorForm.inputResult.Equals("Cancel")) return; string floorNumber = ""; floorNumber = CCalculatorForm.inputResult; COrderInfo tempOrderInfo = new COrderInfo(); tempOrderInfo.TableNumber = int.Parse(tableNumber); //tempOrderInfo.TableName = "Table " + tableNumber; tempOrderInfo.UserID = m_oCommonConstants.UserInfo.UserID; tempOrderInfo.OrderTime = System.DateTime.Now; //needed now tempOrderInfo.OrderType = "Table"; tempOrderInfo.GuestCount = int.Parse(tableGuest); tempOrderInfo.Status = "Seated"; tempOrderInfo.FloorNo = floorNumber; //tempOrderInfo.InitialKitchenText = kitchenText; COrderManager tempOrderManager2 = new COrderManager(); tempOrderInfo = (COrderInfo)tempOrderManager2.InsertOrderInfo(tempOrderInfo).Data; COrderSeatTime tempOrderSeatTime = new COrderSeatTime(); tempOrderSeatTime.OrderID = tempOrderInfo.OrderID; tempOrderSeatTime.SeatTime = DateTime.Now; tempOrderManager2.InsertOrderSeatTime(tempOrderSeatTime); LobbyItemButton tableIcon = new LobbyItemButton(); tableIcon.OrderID = tempOrderInfo.OrderID; tableIcon.TableName = "Table " + tableNumber; tableIcon.GuestCount = tableGuest; tableIcon.User = m_oCommonConstants.UserInfo.UserName; tableIcon.SeatedTime = tempOrderSeatTime.SeatTime; // tableIcon.Icon = global::RMS.Properties.Resources.seated; tableIcon.ItemType = RMSUIConstants.ItemType.SeatedButNoOrdered; tableIcon.TableNumber = int.Parse(tableNumber); tableIcon.Click += new EventHandler(TableIcon_MouseClick); tableIconList.Add(tableIcon); CTableInfo tempTableInfo = new CTableInfo(); tempTableInfo.TableNumber = int.Parse(tableNumber); tempTableInfo.TableType = "Table"; tempTableInfo.Status = 0; tempOrderManager.InsertTableInfo(tempTableInfo); try { WaiterForm waiterForm = new WaiterForm(); waiterForm.UserList = userList; waiterForm.ShowDialog(); if (waiterForm.DialogResult == DialogResult.OK) { COrderWaiterDao orderwaiterDao = new COrderWaiterDao(); COrderwaiter orderwaiter = new COrderwaiter(); orderwaiter = orderwaiterDao.GetOrderwaiterByOrderID(tempOrderInfo.OrderID); if (orderwaiter != null && orderwaiter.ID > 0 && orderwaiter.WaiterID != waiterForm.UserInfoData.UserID) { orderwaiter.OrderID = tempOrderInfo.OrderID; orderwaiter.WaiterID = waiterForm.UserInfoData.UserID; orderwaiter.WaiterName = waiterForm.UserInfoData.UserName; orderwaiterDao.UpdateOrderwaiter(orderwaiter); } else if (orderwaiter.ID == 0) { orderwaiter.OrderID = tempOrderInfo.OrderID; orderwaiter.WaiterID = waiterForm.UserInfoData.UserID; orderwaiter.WaiterName = waiterForm.UserInfoData.UserName; orderwaiterDao.InsertOrderwaiter(orderwaiter); } } } catch (Exception ex) { } #region "OLD Code" //TablePanel.Controls.Clear(); //Init(); #endregion #region "New code added by Baruri" CTableOrderForm objOrderDetailsForm = new CTableOrderForm(tempOrderInfo.OrderID, 0, tempTableInfo.TableNumber); objOrderDetailsForm.m_orderUserName = RMSGlobal.LoginUserName; objOrderDetailsForm.Show(); CFormManager.Forms.Push(this); this.Hide(); #endregion } catch (Exception ee) { } }
private void Init() { string onlineOrders = String.Empty; try { m_bTableInfoClicked = false; m_bNameTableClicked = false; m_bChangeDetailsClicked = false; m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>(); if (m_oCommonConstants.UserInfo == null) { return; } UserStatusLabel.Text = "Logged in as " + m_oCommonConstants.UserInfo.UserName; tableIconList = new List<LobbyItemButton>(); COrderManager tempOrderManager = new COrderManager(); List<COrderShow> tempOrderShowList = (List<COrderShow>)tempOrderManager.OrderListShowByStatus("Paid").Data; onlineOrders = String.Empty; for (int orderCounter = 0; orderCounter < tempOrderShowList.Count; orderCounter++) { LobbyItemButton tableIcon = new LobbyItemButton(); // tableIcon.Visible = false; tableIcon.User = tempOrderShowList[orderCounter].UserName; tableIcon.GuestCount = tempOrderShowList[orderCounter].GuestCount.ToString(); tableIcon.TableName = tempOrderShowList[orderCounter].TableName; tableIcon.Type = tempOrderShowList[orderCounter].OrderType; tableIcon.FloorName = tempOrderShowList[orderCounter].FloorNo; if (tableIcon.TableName.Equals("")) { if (tableIcon.Type.Equals("Table")) tableIcon.TableName = "Table " + tempOrderShowList[orderCounter].TableNumber.ToString(); else if (tableIcon.Type.Equals("Tabs")) tableIcon.TableName = "Tab " + tempOrderShowList[orderCounter].TableNumber.ToString(); else if (tableIcon.Type.Equals("TakeAway")) { COrderInfo temp2OrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(tempOrderShowList[orderCounter].OrderID).Data; CCustomerManager tempCustomerManager = new CCustomerManager(); CCustomerInfo tempCustomerinfo = new CCustomerInfo(); tempCustomerinfo = (CCustomerInfo)tempCustomerManager.CustomerInfoGetByCustomerID(temp2OrderInfo.CustomerID).Data; if (tempCustomerinfo != null) tableIcon.TableName = tempCustomerinfo.CustomerName; else tableIcon.TableName = "Take Away"; //tableIcon.GuestCountLabel.Text = tempOrderShowList[orderCounter].Status; tableIcon.TableName = tempOrderShowList[orderCounter].Status; } } tableIcon.TableNumber = Int64.Parse(tempOrderShowList[orderCounter].TableNumber.ToString()); string status = tempOrderShowList[orderCounter].Status; tableIcon.OrderID = tempOrderShowList[orderCounter].OrderID; //Added by Baruri at 13.12.2008.This portion is used for automatic printing of online orders. if (tempOrderShowList[orderCounter].OnlineOrderID >1) //If online order { if (onlineOrders.Length == 0) { onlineOrders = tempOrderShowList[orderCounter].OrderID.ToString(); } else { onlineOrders = onlineOrders + "," + tempOrderShowList[orderCounter].OrderID.ToString(); } } COrderInfo tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(tableIcon.OrderID).Data; COrderSeatTime tempOrderSeatTime = (COrderSeatTime)tempOrderManager.OrderSeatTimeByOrderID(tableIcon.OrderID).Data; tableIcon.OrderedTime = tempOrderInfo.OrderTime; tableIcon.SeatedTime = tempOrderSeatTime.SeatTime; if (tempOrderShowList[orderCounter].OrderType.Equals("Table")) { if (status.Equals("Seated")) { tableIcon.ItemType = RMSUIConstants.ItemType.SeatedButNoOrdered; } else if (status.Equals("Ordered")) { tableIcon.ItemType = RMSUIConstants.ItemType.Ordered; //tableIcon.Icon = global::RMS.Properties.Resources.ordered_png; } else if (status.Equals("Billed")) { tableIcon.ItemType = RMSUIConstants.ItemType.WaitingForPayment; //tableIcon.Icon = global::RMS.Properties.Resources.awaiting_png; } else if (tempOrderShowList[orderCounter].Status.Equals("DelivaryFromKitchen")) { tableIcon.ItemType = RMSUIConstants.ItemType.Delevery; // tableIcon.Icon = global::RMS.Properties.Resources.Delevery_png; } tableIcon.Type = "Table"; } else if (tempOrderShowList[orderCounter].OrderType.Equals("TakeAway")) { if (tempOrderShowList[orderCounter].Status.Equals("Collection")) { tableIcon.ItemType = RMSUIConstants.ItemType.Collection; // tableIcon.Icon = global::RMS.Properties.Resources.takeaway_png; } else if (tempOrderShowList[orderCounter].Status.Equals("DelivaryFromKitchen")) { tableIcon.ItemType = RMSUIConstants.ItemType.Delevery; // tableIcon.Icon = global::RMS.Properties.Resources.Delevery_png; } //else if(tempOrderShowList[orderCounter].Status.Equals("Delivery")) //{ // tableIcon.ItemType = RMSUIConstants.ItemType.Delevery; // // tableIcon.Icon = global::RMS.Properties.Resources.Delevery_png; //} else if (tempOrderShowList[orderCounter].Status.Equals("Waiting")) { tableIcon.ItemType = RMSUIConstants.ItemType.Waiting; } tableIcon.Type = "TakeAway"; } else if (tempOrderShowList[orderCounter].OrderType.Equals("Tabs")) { // tableIcon.i = global::RMS.Properties.Resources.rms_bar_service; tableIcon.ItemType = RMSUIConstants.ItemType.BarService; //tableIcon.Icon = global::RMS.Properties.Resources.tab_png; tableIcon.Type = "Tabs"; } tableIcon.Click += new EventHandler(TableIcon_MouseClick); tableIconList.Add(tableIcon); } this.SortIcons(); for (int k = ((m_iPageIndex - 1) * m_page_order_capacity); k < tableIconList.Count && k < (m_iPageIndex * m_page_order_capacity); k++) TablePanel.Controls.Add(tableIconList[k]); #region "Current Code Modified by Baruri at 30/07/2008" if (tableIconList.Count % m_page_order_capacity == 0) { m_iTotalPageCount = tableIconList.Count / m_page_order_capacity; } else { m_iTotalPageCount = (tableIconList.Count / m_page_order_capacity) + 1; } TotalPageLabel.Text = m_iTotalPageCount.ToString(); #endregion if (m_iPageIndex < m_iTotalPageCount) NextButton.Enabled = true; else NextButton.Enabled = false; if (m_iPageIndex > 1) PreviousButton.Enabled = true; else PreviousButton.Enabled = false; CurrentPageLabel.Text = m_iPageIndex.ToString(); String BarServiceColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Bar Service'")[0]["color"].ToString(); BarServiceButton.BackColor = Color.FromArgb(Int32.Parse(BarServiceColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber), Int32.Parse(BarServiceColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber), Int32.Parse(BarServiceColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber)); String TakeAwayColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'Take Away'")[0]["color"].ToString(); TWButton.BackColor = Color.FromArgb(Int32.Parse(TakeAwayColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber), Int32.Parse(TakeAwayColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber), Int32.Parse(TakeAwayColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber)); String NewTableColorString = Program.initDataSet.Tables["ButtonColor"].Select("name = 'New Table'")[0]["color"].ToString(); NewTableButton.BackColor = Color.FromArgb(Int32.Parse(NewTableColorString.Substring(1, 2), System.Globalization.NumberStyles.HexNumber), Int32.Parse(NewTableColorString.Substring(3, 2), System.Globalization.NumberStyles.HexNumber), Int32.Parse(NewTableColorString.Substring(5, 2), System.Globalization.NumberStyles.HexNumber)); LoadStatusBar(tempOrderShowList.Count); } catch (Exception ee) { } m_onlineOrders = onlineOrders.Split(','); //Online order list . }