Ejemplo n.º 1
0
        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)
            {
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// icon List
 /// </summary>
 public void SortIcons()
 {
     try
     {
         for (int iconCounter = 0; iconCounter < tableIconList.Count; iconCounter++)
             for (int iconInnerCounter = iconCounter + 1; iconInnerCounter < tableIconList.Count; iconInnerCounter++)
             {
                 if (!tableIconList[iconCounter].Type.Equals(tableIconList[iconInnerCounter].Type))
                 {
                     if (tableIconList[iconCounter].Type.Equals("TakeAway"))
                     {
                         LobbyItemButton tempTableIcon = new LobbyItemButton();
                         tempTableIcon = tableIconList[iconCounter];
                         tableIconList[iconCounter] = tableIconList[iconInnerCounter];
                         tableIconList[iconInnerCounter] = tempTableIcon;
                     }
                     else if (tableIconList[iconCounter].Type.Equals("Tabs") && !tableIconList[iconInnerCounter].Type.Equals("TakeAway"))
                     {
                         LobbyItemButton tempTableIcon = new LobbyItemButton();
                         tempTableIcon = tableIconList[iconCounter];
                         tableIconList[iconCounter] = tableIconList[iconInnerCounter];
                         tableIconList[iconInnerCounter] = tempTableIcon;
                     }
                     continue;
                 }
                 if (tableIconList[iconCounter].TableNumber > tableIconList[iconInnerCounter].TableNumber)
                 {
                     LobbyItemButton tempTableIcon = new LobbyItemButton();
                     tempTableIcon = tableIconList[iconCounter];
                     tableIconList[iconCounter] = tableIconList[iconInnerCounter];
                     tableIconList[iconInnerCounter] = tempTableIcon;
                 }
             }
     }
     catch (Exception exp)
     {
         Console.Write(exp.Message);
     }
 }
Ejemplo n.º 3
0
        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 .
        }