Пример #1
0
        private void TableIcon_MouseClick(object sender, EventArgs e)
        {
            try
            {
                COrderManager tempOrderManager = new COrderManager();
                LobbyItemButton tempTableIcon = (LobbyItemButton)sender;
                CCommonConstants tempCommonConstants = ConfigManager.GetConfig<CCommonConstants>();

                if (tempTableIcon.Type.Equals("Table") || tempTableIcon.Type.Equals("Tabs"))
                {
                    if (m_bTableInfoClicked)
                    {
                        CTableInfoMessageBox tempTableInfoMessageBox = new CTableInfoMessageBox(tempTableIcon.OrderID);
                        tempTableInfoMessageBox.Show();

                        m_bTableInfoClicked = false;
                        return;
                    }
                    else if (m_bNameTableClicked)
                    {
                        CKeyBoardForm tempKeyBoardForm = new CKeyBoardForm("Table Naming", "Please Enter the Name of the Table");
                        tempKeyBoardForm.ShowDialog();

                        if (CKeyBoardForm.Content.Equals("Cancel") || CKeyBoardForm.Content.Equals(""))
                            return;

                        COrderInfo tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(tempTableIcon.OrderID).Data;
                        tempOrderInfo.TableName = CKeyBoardForm.Content;
                        tempOrderManager.UpdateOrderInfo(tempOrderInfo);
                        tempTableIcon.TableName = CKeyBoardForm.Content;
                        m_bNameTableClicked = false;
                        TablePanel.Controls.Clear();
                        this.Init();
                        return;
                    }
                    else if (m_bChangeDetailsClicked)
                    {
                        CKeyBoardForm tempKeyBoardForm = new CKeyBoardForm("Change Details", "Please Enter the Name of the Table");
                        tempKeyBoardForm.ShowDialog();
                        if (CKeyBoardForm.Content.Equals("Cancel")) //If cancelled then exit.
                        {
                            return;
                        }

                        CCalculatorForm tempCalculatorForm = new CCalculatorForm("Change Details", "Guest Quantity");
                        tempCalculatorForm.ShowDialog();

                        COrderInfo tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(tempTableIcon.OrderID).Data;
                        if (!CKeyBoardForm.Content.Equals("") && !CKeyBoardForm.Content.Equals("Cancel"))
                        {
                            tempOrderInfo.TableName = CKeyBoardForm.Content;
                        }

                        if(!CCalculatorForm.inputResult.Equals("") && !CCalculatorForm.inputResult.Equals("Cancel") && !(Int32.Parse(CCalculatorForm.inputResult)==0))
                            tempOrderInfo.GuestCount = Convert.ToInt32(CCalculatorForm.inputResult);
                        tempOrderManager.UpdateOrderInfo(tempOrderInfo);

                        m_bChangeDetailsClicked = false;
                        TablePanel.Controls.Clear();
                        Init();
                        return;
                    }
                }

                CTableInfo tempTableInfo = new CTableInfo();
                tempTableInfo = (CTableInfo)tempOrderManager.GetTableInfoByTableNumber(tempTableIcon.TableNumber, tempTableIcon.Type).Data;

                if (tempTableInfo!=null && tempTableInfo.Status == 1)
                {
                    CMessageBox tempMessageBox = new CMessageBox("Table Information", "Someone else is using this table at this moment.");
                    tempMessageBox.ShowDialog();
                    return;
                }

                tempTableInfo.TableNumber = tempTableIcon.TableNumber;
                tempTableInfo.TableType = tempTableIcon.Type;
                tempTableInfo.Status = 1;
                tempOrderManager.UpdateTableInfo(tempTableInfo);

                if (tempTableIcon.Type.Equals("Table"))
                {
                    CTableOrderForm tempTableOrderForm = new CTableOrderForm(tempTableIcon.OrderID, tempCommonConstants.TableType, tempTableIcon.TableNumber);
                    tempTableOrderForm.m_TerminalName = TerminalIDLabel.Text;
                    tempTableOrderForm.m_orderUserName = tempTableIcon.User;
                    tempTableOrderForm.Show();
                }
                else if (tempTableIcon.Type.Equals("Tabs"))
                {
                    CBarServiceForm tempBarServiceForm = new CBarServiceForm(tempTableIcon.OrderID, tempCommonConstants.TabsType, tempTableIcon.TableNumber);
                    tempBarServiceForm.Show();

                }
                else if (tempTableIcon.Type.Equals("TakeAway"))
                {
                    CTableOrderForm tempTableOrderForm = new CTableOrderForm(tempTableIcon.OrderID, tempCommonConstants.TakeAwayType, tempTableIcon.TableNumber);
                    //tempTableOrderForm.m_TerminalName = TerminalIDLabel.Text;
                    tempTableOrderForm.m_orderUserName = tempTableIcon.User;
                    tempTableOrderForm.Show();
                }

                CFormManager.Forms.Push(this);
                this.Hide();
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
            }
        }
Пример #2
0
        private void FinishButton_Click(object sender, EventArgs e)
        {
            CResult objResultant = new CResult();
            try
            {
                if (!CheckEmpty() && m_orderIndex == 1)
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error", "Please enter all the mandatory values.");
                    tempMessageBox.ShowDialog();
                    return;
                }

                CCustomerManager tempCustomerManager = new CCustomerManager();
                CCustomerInfo tempCustomerInfo = new CCustomerInfo();

                if (txtPhoneNumber.Text.Trim().Equals(String.Empty))
                {
                    CResult oResult5 = tempCustomerManager.CustomerInfoGetByName(txtCustomerName.Text.Trim());
                    if (oResult5.IsSuccess && oResult5.Data != null)
                    {
                        tempCustomerInfo = (CCustomerInfo)oResult5.Data;
                    }
                }

                else
                {
                    CResult oResult = tempCustomerManager.CustomerInfoGetByPhone(txtPhoneNumber.Text.Trim());
                    if (oResult.IsSuccess && oResult.Data != null)
                    {
                        tempCustomerInfo = (CCustomerInfo)oResult.Data;
                    }
                }

                if (txtCustomerName.Text.Length == 0 && (m_orderIndex == 2 || m_orderIndex == 3))
                {
                    txtCustomerName.Text = m_order_name;
                }

                tempCustomerInfo.CustomerName = txtCustomerName.Text.Trim();
                tempCustomerInfo.CustomerPhone = txtPhoneNumber.Text.Trim();

                if (m_orderIndex == 1) //If only delivery type order is considered
                {
                    tempCustomerInfo.CustomerPostalCode = txtPostalCode.Text.Trim();

                    tempCustomerInfo.FloorAptNumber = txtFloorAptNumber.Text.Trim();
                    tempCustomerInfo.HouseNumber = txtHouseNumber.Text.Trim();
                    tempCustomerInfo.StreetName = txtStreetName.Text.Trim() + "-" + txtStreet2.Text.Trim();
                    tempCustomerInfo.BuildingName = txtBuildingName.Text.Trim();

                    tempCustomerInfo.CustomerTown = txtTown.Text.Trim();
                    tempCustomerInfo.CustomerCountry = cmbCountry.Text;
                    tempCustomerInfo.UserName = RMSGlobal.LoginUserName;
                    tempCustomerInfo.TerminalId = RMSGlobal.Terminal_Id;
                    Int64 currentdateTime = DateTime.Now.Ticks;
                    tempCustomerInfo.InsertDate = currentdateTime;
                }

                if (tempCustomerInfo.CustomerID == 0)
                {
                        CResult oResult6 = tempCustomerManager.InsertCustomerInfo(tempCustomerInfo);
                        if (oResult6.IsSuccess && oResult6.Data != null)
                            tempCustomerInfo = (CCustomerInfo)oResult6.Data;
                }
                else
                {
                        tempCustomerManager.UpdateCustomerInfo(tempCustomerInfo);
                }

                #region "Older"

                if (m_customerEditStatus == false)
                {
                    if (m_iOrderID == 0)
                    {
                        COrderManager tempOrderManager = new COrderManager();
                        COrderInfo tempOrderInfo = new COrderInfo();
                        tempOrderInfo.CustomerID = tempCustomerInfo.CustomerID;
                        tempOrderInfo.OrderType = "TakeAway";
                        tempOrderInfo.OrderTime = System.DateTime.Now;
                        tempOrderInfo.TableNumber = GetValidTableNumber("TakeAway");
                        CTableInfo tempTableInfo = new CTableInfo();
                        tempTableInfo.TableNumber = tempOrderInfo.TableNumber;
                        tempTableInfo.TableType = "TakeAway";
                        tempOrderManager.InsertTableInfo(tempTableInfo);

                        if (m_orderIndex==1)
                        {
                            tempOrderInfo.Status = "Delivery";
                        }
                        else if (m_orderIndex ==2 )
                        {
                            tempOrderInfo.Status = "Collection";
                        }
                        else if (m_orderIndex == 3)
                        {
                            tempOrderInfo.Status = "Waiting";
                        }

                        m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                        tempOrderInfo.UserID = m_oCommonConstants.UserInfo.UserID;

                        objResultant = tempOrderManager.InsertOrderInfo(tempOrderInfo); //New Order
                        COrderInfo tempOrderInfoNew = (COrderInfo)objResultant.Data;//Taking the order ID
                        m_iOrderID = tempOrderInfoNew.OrderID;

                        #region " Inserting Order details info if items are selected from the previous orders"
                        //Developed by baruri
                        List<COrderDetails> tempOrderDetailsList = new List<COrderDetails>();
                        if (m_htOrderInfo.Count > 0) //If item is selected from the previous order
                        {
                            tempOrderDetailsList = (List<COrderDetails>)m_htOrderInfo["orderdetail"];
                        }
                        if (tempOrderDetailsList.Count > 0) //Insert details for the new order
                        {
                            for (int itemDetailIndex = 0; itemDetailIndex < tempOrderDetailsList.Count; itemDetailIndex++)
                            {
                                COrderDetails objOrderDetails = (COrderDetails)tempOrderDetailsList[itemDetailIndex];
                                objOrderDetails.OrderID = tempOrderInfo.OrderID;
                                tempOrderManager.InsertOrderDetails(objOrderDetails);
                            }
                            m_htOrderInfo = new Hashtable();//Clearing the previous items from the order if there is any.
                        }
                        #endregion

                        //insert delivery time
                        if (tempOrderInfo.Status.Equals("Delivery"))
                        {
                            CDelivery tempDelivery = new CDelivery();
                            tempDelivery.DeliveryOrderID = tempOrderInfo.OrderID;
                            string deliveryTime = Convert.ToInt32("0" + cmbHour.Text).ToString("00") + ":" + Convert.ToInt32("0" + cmbMinute.Text).ToString("00") + " " + cmbMeridiem.Text;
                            tempDelivery.DeliveryTime = deliveryTime;// DeliveryTimeTextBox.Text.Trim();
                            tempOrderManager.InsertDeliveryInfo(tempDelivery);
                        }

                        //OLD Code
                        //Form tempForm = CFormManager.Forms.Pop();
                        //tempForm.Show();

                        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)
                        {
                        }

                        m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                        CTableOrderForm tempForm = new CTableOrderForm(m_iOrderID, m_oCommonConstants.TakeAwayType, tempOrderInfo.TableNumber);
                        tempForm.m_orderUserName = RMSGlobal.LoginUserName;
                        tempForm.Show();

                        this.Close();
                    }
                    else
                    {
                        COrderManager tempOrderManager = new COrderManager();
                        CResult oResult7 = tempOrderManager.OrderInfoByOrderID(m_iOrderID);
                        COrderInfo tempOrderInfo = new COrderInfo();
                        if (oResult7.IsSuccess && oResult7.Data != null)
                        {
                            tempOrderInfo = (COrderInfo)oResult7.Data;
                        }

                        tempOrderInfo.OrderType = "TakeAway";
                        tempOrderInfo.Status = "TakeAway";
                        tempOrderInfo.GuestCount = 0;
                        tempOrderInfo.TableName = "";
                        tempOrderInfo.CustomerID = tempCustomerInfo.CustomerID;
                        tempOrderInfo.TableNumber = GetValidTableNumber("TakeAway");

                        CTableInfo tempTableInfo = new CTableInfo();
                        tempTableInfo.TableNumber = tempOrderInfo.TableNumber;
                        tempTableInfo.TableType = "TakeAway";
                        tempOrderManager.InsertTableInfo(tempTableInfo);

                        if (m_orderIndex == 1)
                        {
                            tempOrderInfo.Status = "Delivery";
                        }
                        else if (m_orderIndex == 3)
                        {
                            tempOrderInfo.Status = "Waiting";
                        }
                        else if (m_orderIndex == 2)
                        {
                            tempOrderInfo.Status = "Collection";
                        }
                        tempOrderManager.UpdateOrderInfo(tempOrderInfo);

                        //insert delivery time
                        if (tempOrderInfo.Status.Equals("Delivery"))
                        {
                            CDelivery tempDelivery = new CDelivery();
                            tempDelivery.DeliveryOrderID = tempOrderInfo.OrderID;
                            string deliveryTime = Convert.ToInt32("0" + cmbHour.Text).ToString("00") + ":" + Convert.ToInt32("0" + cmbMinute.Text).ToString("00") + " " + cmbMeridiem.Text;
                            tempDelivery.DeliveryTime = deliveryTime;// DeliveryTimeTextBox.Text.Trim();
                            tempOrderManager.InsertDeliveryInfo(tempDelivery);
                        }

                        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)
                        {
                        }

                        m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                        CTableOrderForm tempForm = (CTableOrderForm)CFormManager.Forms.Pop();
                        tempForm.m_iType = m_oCommonConstants.TakeAwayType;
                        tempForm.Show();
                        this.Close();
                    }
                }
                #endregion
                else //Edit order information.As here is reached from order details screen.
                {
                    COrderInfo tempOrderInfo = new COrderInfo();
                    COrderManager tempOrderManager = new COrderManager();
                    CDelivery tempDelivery = null;

                    tempOrderInfo.OrderID = m_iOrderID;
                    tempOrderManager.DeleteDeliveryInfo(m_iOrderID);//Delete previous record from delivery information table

                    if (m_orderIndex==2)
                    {
                        tempOrderInfo.Status = "Collection";
                    }
                    else if (m_orderIndex==3)
                    {
                        tempOrderInfo.Status = "Waiting";
                    }
                    else
                    {
                        tempOrderInfo.Status = "Delivery";
                        tempDelivery = new CDelivery();
                        tempDelivery.DeliveryOrderID = tempOrderInfo.OrderID;
                        string deliveryTime = Convert.ToInt32("0" + cmbHour.Text).ToString("00") + ":" + Convert.ToInt32("0" + cmbMinute.Text).ToString("00") + " " + cmbMeridiem.Text;
                        tempDelivery.DeliveryTime = deliveryTime;//
                        tempOrderManager.InsertDeliveryInfo(tempDelivery);//Update delivery information
                    }

                    tempOrderManager.UpdateTakeawayOrderInfo(tempOrderInfo);//Update order information

                    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)
                    {
                    }

                    m_oCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                    CTableOrderForm tempForm = (CTableOrderForm)CFormManager.Forms.Pop();
                    tempForm.m_iType = m_oCommonConstants.TakeAwayType;
                    tempForm.Show();
                    this.Close();
                }
                m_phoneNumber = String.Empty;
            }
            catch (Exception exp)
            {
                Console.Write(exp.Message);
            }
        }
Пример #3
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)
            {
            }
        }