Beispiel #1
0
        private void btnEditOrder_Click(object sender, EventArgs e)
        {
            if (m_customerID < 1) //If table type order is considered.
            {
                COrderManager tempOrderManager = new COrderManager();
                CKeyBoardForm tempKeyBoardForm = new CKeyBoardForm("Change Table Name", "Please Enter the Name of the Table");
                tempKeyBoardForm.ShowDialog();
                if (CKeyBoardForm.Content.Equals("Cancel")) //If cancelled then exit.
                {
                    return;
                }

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

                COrderInfo tempOrderInfo = (COrderInfo)tempOrderManager.OrderInfoByOrderID(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);
            }
        }
Beispiel #2
0
        private void g_MiscButton_Click(object sender, EventArgs e)
        {
            try
            {
                CKeyBoardForm tempKeyBoardForm = new CKeyBoardForm("Misc Item", "Enter Item Name or Description", true);
                tempKeyBoardForm.ShowDialog();

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

                if (CKeyBoardForm.Content.Equals(""))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error!", "Item Name cannot be Empty");
                    tempMessageBox.ShowDialog();
                    return;
                }
                CPriceCalculatorForm tempCalculatorForm = new CPriceCalculatorForm("Misc Item", "Enter Price");
                tempCalculatorForm.ShowDialog();

                if (CPriceCalculatorForm.inputResult.Equals("Cancel"))
                    return;

                if (CPriceCalculatorForm.inputResult.Equals("0.000"))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error!", "Price cannot be zero.");
                    tempMessageBox.ShowDialog();
                    return;
                }
                  double price = Double.Parse(CPriceCalculatorForm.inputResult);
                //change by mithu

                        CPriceCalculatorForm tempCalculatorForm1 = new CPriceCalculatorForm("Misc Item", "Enter vat");
                     tempCalculatorForm1.ShowDialog();

                if (CPriceCalculatorForm.inputResult.Equals("Cancel"))
                    return;

                if (CPriceCalculatorForm.inputResult.Equals("0.000"))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error!", "Vat cannot be zero.");
                    tempMessageBox.ShowDialog();
                    return;
                }

                double addmisvat=Double.Parse(CPriceCalculatorForm.inputResult);

                try
                {
                    CCalculatorForm tempQtyCalculatorForm = new CCalculatorForm("Order Quantity", "Item Quantity");
                    tempQtyCalculatorForm.ShowDialog();

                    if (CCalculatorForm.inputResult.Equals("Cancel"))
                        return;

                    string str = CCalculatorForm.inputResult;
                    str = (str == "") ? "1" : str;

                    if (Int32.Parse(str) == 0)
                    {
                        CMessageBox tempMessageBox = new CMessageBox("Error", "Input invalid!");
                        tempMessageBox.ShowDialog();
                        return;
                    }

                    int tempOrderedQty = Int32.Parse(str);
                    m_iSavedOrderedQty = tempOrderedQty;

                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                COrderManager tempOrderManager = new COrderManager();
                COrderDetails tempOrderDetails = new COrderDetails();
                DataGridView tempDataGridView = null;

                if (CKeyBoardForm.m_foodType == true) //If miscelleneous item is food
                {
                    tempDataGridView = g_FoodDataGridView;
                }
                else
                {
                    tempDataGridView = g_BeverageDataGridView;
                }

                int tempResult = FindExistingItem(tempDataGridView, CKeyBoardForm.Content);
                if (tempResult != -1)
                {
                    //update Order_details table
                    int tempRowIndex = tempResult;
                    tempDataGridView.Rows[tempRowIndex].Cells[1].Value = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                    tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[7].Value.ToString());
                    tempOrderDetails.OrderID = orderID;
                    tempOrderDetails.ProductID = 0;
                    tempOrderDetails.CategoryLevel = 0;
                    tempOrderDetails.OrderRemarks = CKeyBoardForm.Content;
                    tempOrderDetails.Product_Name = CKeyBoardForm.Content;
                    tempOrderDetails.OrderQuantity = Int32.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString());
                    tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity*price;
                    tempOrderDetails.VatTotal = (addmisvat*tempOrderDetails.OrderAmount)/100.0;
                    tempOrderDetails.Amount_with_vat = tempOrderDetails.OrderAmount + tempOrderDetails.VatTotal;
                    tempOrderDetails.OrderFoodType = "Food";
                    tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;

                    tempDataGridView.Rows[tempRowIndex].Cells[2].Value = tempOrderDetails.VatTotal.ToString("F02");
                    tempDataGridView.Rows[tempRowIndex].Cells[3].Value = tempOrderDetails.OrderAmount.ToString("F02");

                    tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                }
                else
                {
                    //Insert into Order_details table
                    tempOrderDetails.OrderID = orderID;
                    tempOrderDetails.ProductID = 0;
                    tempOrderDetails.CategoryLevel = 0;
                    tempOrderDetails.OrderRemarks = CKeyBoardForm.Content;
                    tempOrderDetails.Product_Name = CKeyBoardForm.Content;
                    tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                    tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                    tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity*price;
                    tempOrderDetails.VatTotal = (addmisvat * tempOrderDetails.OrderAmount) / 100.0;
                    tempOrderDetails.Amount_with_vat = tempOrderDetails.OrderAmount + tempOrderDetails.VatTotal;

                    if (CKeyBoardForm.m_foodType == true)
                    {
                        tempOrderDetails.OrderFoodType = "Food";
                    }
                    else
                    {
                        tempOrderDetails.OrderFoodType = "Nonfood";
                    }

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                    {
                        tempOrderDetails = (COrderDetails)tempOrderManager.InsertOrderDetails(tempOrderDetails).Data;
                        string[] tempDataGridViewRow = new string[]
                                { CKeyBoardForm.Content,
                                  m_iSavedOrderedQty.ToString(),
                                  tempOrderDetails.VatTotal.ToString("F02"),
                                  tempOrderDetails.OrderAmount.ToString("F02"),
                                  "0",
                                  "0",
                                  Int64.MaxValue-1+"",
                                  tempOrderDetails.OrderDetailsID.ToString(),"0" //0 for printed item quantity
                                };
                        tempDataGridView.Rows.Add(tempDataGridViewRow);
                    }
                    else
                    {
                        tempOrderDetails.ItemName = CKeyBoardForm.Content;
                        tempOrderDetails = (COrderDetails)tempOrderManager.InsertOnlineOrderDetails(tempOrderDetails).Data;

                        string[] tempDataGridViewRow = new string[]
                                { CKeyBoardForm.Content,
                                  m_iSavedOrderedQty.ToString(),
                                   tempOrderDetails.VatTotal.ToString("F02"),
                                  tempOrderDetails.OrderAmount.ToString("F02"),
                                  "0",
                                  "0",
                                  tempOrderDetails.OnlineItemSequenceNumber.ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString(),"0" //0 for printed item quantity
                                };
                        tempDataGridView.Rows.Add(tempDataGridViewRow);
                    }
                }

                if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper()) //Rank is applicable only for local order only
                {
                    this.ConvertRank();
                }

                tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                tempDataGridView.Update();
                TotalAmountCalculation();
                m_iSavedOrderedQty = 1;
                g_FoodDataGridView.ClearSelection();
                g_BeverageDataGridView.ClearSelection();
            }
            catch (Exception exp)
            {
                Console.Write(exp.Message);
            }
        }
Beispiel #3
0
        private void g_PrintTokenButton_Click(object sender, EventArgs e)
        {
            try
            {
                CPrintMethods tempPrintMethods = new CPrintMethods();

                CKeyBoardForm tempKeyboardForm = new CKeyBoardForm("Bar Token Information", "Enter Customer Name");
                tempKeyboardForm.ShowDialog();

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

                CCalculatorForm tempCalculatorForm = new CCalculatorForm("Bar Token Information", "Enter Number of Guest");
                tempCalculatorForm.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;
                }
            }
            catch (Exception eee)
            {
            }
        }
Beispiel #4
0
        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)
            {
            }
        }
Beispiel #5
0
        private void g_MiscButton_Click(object sender, EventArgs e)
        {
            try
            {
                CKeyBoardForm tempKeyBoardForm = new CKeyBoardForm("Misc Item", "Enter Item Name or Description");
                tempKeyBoardForm.ShowDialog();

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

                if (CKeyBoardForm.Content.Equals(""))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error!", "Item Name cannot be Empty");
                    tempMessageBox.ShowDialog();
                    return;
                }
                CPriceCalculatorForm tempCalculatorForm = new CPriceCalculatorForm("Misc Item", "Enter Price");
                tempCalculatorForm.ShowDialog();

                if (CPriceCalculatorForm.inputResult.Equals("Cancel"))
                    return;

                if (CPriceCalculatorForm.inputResult.Equals("0.000"))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Error!", "Price cannot be zero.");
                    tempMessageBox.ShowDialog();
                    return;
                }

                NewOrder();

                COrderManager tempOrderManager = new COrderManager();
                COrderDetails tempOrderDetails = new COrderDetails();
                DataGridView tempDataGridView = g_FoodDataGridView;

                int tempResult = DataGridViewSearch(tempDataGridView, CKeyBoardForm.Content);
                if (tempResult != -1)
                {
                    //update Order_details table
                    int tempRowIndex = tempResult;
                    tempDataGridView.Rows[tempRowIndex].Cells[1].Value = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                    tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
                    tempOrderDetails.OrderID = orderID;
                    tempOrderDetails.ProductID = 0;
                    tempOrderDetails.CategoryLevel = 0;
                    tempOrderDetails.OrderRemarks = CKeyBoardForm.Content;
                    tempOrderDetails.OrderQuantity = Int32.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString());
                    tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(CPriceCalculatorForm.inputResult);
                    tempOrderDetails.OrderFoodType = "Nonfood";
                    tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                }
                else
                {
                    //Insert into Order_details table
                    tempOrderDetails.OrderID = orderID;
                    tempOrderDetails.ProductID = 0;
                    tempOrderDetails.CategoryLevel = 0;
                    tempOrderDetails.OrderRemarks = CKeyBoardForm.Content;
                    tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                    tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(CPriceCalculatorForm.inputResult);
                    tempOrderDetails.OrderFoodType = "Nonfood";
                    tempOrderDetails = (COrderDetails)tempOrderManager.InsertOrderDetails(tempOrderDetails).Data;

                    string[] tempDataGridViewRow = new string[]
                                { CKeyBoardForm.Content,
                                  m_iSavedOrderedQty.ToString(),
                                  CPriceCalculatorForm.inputResult,
                                  "0",
                                  "0",
                                  (Int64.MaxValue-1)+"",
                                  tempOrderDetails.OrderDetailsID.ToString()
                                };

                    tempDataGridView.Rows.Add(tempDataGridViewRow);

                }
                ConvertRank();
                tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                tempDataGridView.Update();
                TotalAmountCalculation();
                m_iSavedOrderedQty = 1;
                g_FoodDataGridView.ClearSelection();
            }
            catch (Exception eee)
            {
            }
        }
Beispiel #6
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());
            }
        }