Example #1
0
        private void Category3Button_Click(object sender, EventArgs e)
        {
            //get item qty

            CCategoryButton tempCategory3Button = (CCategoryButton)sender;
            RMSGlobal.m_sellinginvalue = tempCategory3Button.SellingQuantityorWeight; //Used to identify the product whether sold in quantity or weight

            int tempCategory3ID = tempCategory3Button.CategoryID;
            if (m_bItemDescriptionClicked)
            {
                string tempItemDescription = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3ID)[0]["description"].ToString();
                if (!tempItemDescription.Equals(""))
                {
                    CMessageBox tempMessageBox = new CMessageBox("Item Description", tempItemDescription);
                    tempMessageBox.ShowDialog();
                }
                else
                {
                    CMessageBox tempMessageBox = new CMessageBox("Item Description", "No information available.");
                    tempMessageBox.ShowDialog();
                }
                m_bItemDescriptionClicked = false;
                return;
            }

            int tempFoodType = int.Parse(Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3ID)[0].GetParentRow(Program.initDataSet.Relations["category2_to_category3"])["cat2_type"].ToString());
            DataGridView tempDataGridView = new DataGridView();
            if (tempFoodType == 0)
            {
                tempDataGridView = g_BeverageDataGridView;
            }
            else
            {
                tempDataGridView = g_FoodDataGridView;
            }

            DataRow[] tempDataRowArray = Program.initDataSet.Tables["Category4"].Select("cat3_id = " + tempCategory3ID.ToString());

            category4ButtonList.Clear();

            COrderInfoDAO aOrderInfoDao = new COrderInfoDAO();
            COrderInfo aCOrderInfo = aOrderInfoDao.GetOrderInfoByOrderID(orderID);

            if (tempDataRowArray.Length != 0)
            {

                foreach (DataRow tempDataRow in tempDataRowArray)
                {
                    if (Int32.Parse(tempDataRow["status"].ToString()) == 0)
                    {
                        continue;
                    }
                    CCategoryButton tempCategoryButton = new CCategoryButton();
                    tempCategoryButton.CategoryID = int.Parse(tempDataRow["cat4_id"].ToString());
                    tempCategoryButton.CategoryOrder = int.Parse(tempDataRow["cat4_order"].ToString());
                    tempCategoryButton.CategoryLevel = 4;
                    tempCategoryButton.Text = tempDataRow["cat4_name"].ToString();
                    tempCategoryButton.BackColor = tempCategory3Button.BackColor;
                    category4ButtonList.Add(tempCategoryButton);
                }

                keyboardForm.Hide();
                CCategory4Form tempCategory4Form = new CCategory4Form(tempCategory3ID, category4ButtonList, tempCategory3Button.Text);
                tempCategory4Form.ShowDialog();

                CCategoryButton tempCategory4Button = CCategory4Form.m_cbResult;
                m_iSavedOrderedQty = CCategory4Form.ItemQTY;
                if (tempCategory4Button == null)
                {
                    return;
                }
                else   //insert into table and datagridview
                {
                    DataRow[] temp2DataRowArray = Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempCategory4Button.CategoryID.ToString());
                    if (temp2DataRowArray.Length != 0)
                    {
                        //category4 + categpry3
                        string ItemName = temp2DataRowArray[0]["cat4_name"].ToString() + " " + tempCategory3Button.Text;
                        string tableTypePrice = string.Empty;
                        if (m_iType == m_cCommonConstants.TableType)
                        {
                            tableTypePrice = temp2DataRowArray[0]["table_price"].ToString();
                        }
                        else if (m_iType == m_cCommonConstants.TakeAwayType)
                        {
                            tableTypePrice = temp2DataRowArray[0]["tw_price"].ToString();
                        }

                        int tempSearchResult = FindExistingItem(tempDataGridView, ItemName);

                        // vat_included
                        double vatRate = 0;
                        bool vat_included = false;
                        double vatAmountRate = 0;
                        try
                        {
                            vatRate = Convert.ToDouble(temp2DataRowArray[0]["vat_Rate"].ToString());
                            vat_included = Convert.ToBoolean(temp2DataRowArray[0]["vat_included"].ToString());

                            if (vat_included)
                            {
                                vatAmountRate = (Double.Parse(tableTypePrice) * vatRate) / 100;

                                // tableTypePrice = (Double.Parse(tableTypePrice) - vatAmountRate).ToString();
                                tableTypePrice = Convert.ToDouble(tableTypePrice).ToString();
                            }
                            else
                            {
                                vatAmountRate = 0.00;
                            }

                        }
                        catch (Exception ex) { }

                        COrderManager tempOrderManager = new COrderManager();
                        COrderDetails tempOrderDetails = new COrderDetails();

                        if (tempSearchResult != -1)
                        {
                            int tempRowIndex = tempSearchResult;
                            int qty = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                            tempDataGridView.Rows[tempRowIndex].Cells[1].Value = qty;
                            tempDataGridView.Rows[tempRowIndex].Cells[3].Value = ((double)(Double.Parse(tableTypePrice) * qty)).ToString("F02");
                            //update Order_details table
                            tempOrderDetails.OrderID = orderID;
                            tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[7].Value.ToString());
                            tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
                            tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
                            tempOrderDetails.OrderQuantity = qty;
                            tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
                            tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                            tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                            tempOrderDetails.OnlineItemSequenceNumber = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
                            tempOrderDetails.PrintedQuantity = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[8].Value.ToString());

                            if (aCOrderInfo.VatComplementory) vatRate =vatAmountRate= 0;
                            if (vat_included)
                            {
                                // tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * vatAmountRate;
                                tempOrderDetails.VatTotal = qty * vatAmountRate;
                                tempDataGridView.Rows[tempRowIndex].Cells[2].Value = qty * vatAmountRate;
                            }
                            else
                            {
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                            }

                            if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                            {
                                tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                            }
                            else
                            {
                                tempOrderManager.UpdateOnlineOrderDetails(tempOrderDetails);//for online orders
                            }
                        }
                        else
                        {
                            //Insert into Order_details table
                            tempOrderDetails.OrderID = orderID;
                            tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
                            tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
                            tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                            tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                            tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                            tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                            tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
                          //  tempOrderDetails.Product_Name = temp2DataRowArray[0]["cat3_name"].ToString();
                            if (aCOrderInfo.VatComplementory) vatRate = 0;
                            if (vat_included)
                            {
                                tempOrderDetails.VatTotal = 0;
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                                // tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * vatAmountRate;
                            }
                            else
                            {
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                            }

                            tempOrderDetails.Amount_with_vat = tempOrderDetails.OrderAmount + tempOrderDetails.VatTotal;

                            string category1ID = this.GetCategory1ID(tempOrderDetails.ProductID, tempOrderDetails.CategoryLevel);
                            //Int32 cat1Order = this.GetCategory1OrderNumber(Convert.ToInt32(category1ID)); // Change by Mithu

                            if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                            {
                                tempOrderDetails = (COrderDetails)tempOrderManager.InsertOrderDetails(tempOrderDetails).Data;
                                string[] tempDataGridViewRow = new string[]
                                { ItemName,
                                  m_iSavedOrderedQty.ToString(),
                                  ((double)tempOrderDetails.VatTotal).ToString("F02"),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory4Button.CategoryID.ToString(),
                                  "4",
                                  temp2DataRowArray[0]["cat4_rank"].ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString(),
                                  "0",
                                  tempOrderDetails.UnitPrice.ToString("F2")
                                };

                                tempDataGridView.Rows.Add(tempDataGridViewRow);
                            }
                            else //For online orders
                            {
                                tempOrderDetails.ItemName = ItemName;
                                tempOrderDetails = (COrderDetails)tempOrderManager.InsertOnlineOrderDetails(tempOrderDetails).Data;
                                string[] tempDataGridViewRow = new string[]
                                { ItemName,
                                  m_iSavedOrderedQty.ToString(),
                                  ((double)tempOrderDetails.VatTotal).ToString("F02"),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory4Button.CategoryID.ToString(),
                                  "4",
                                  tempOrderDetails.OnlineItemSequenceNumber.ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString(),"0",
                                  tempOrderDetails.UnitPrice.ToString("F2")
                                };

                                tempDataGridView.Rows.Add(tempDataGridViewRow);
                            }
                        }

                        if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper()) //If local orders are considered
                        {
                            this.ConvertRank();
                        }

                        tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);

                        tempDataGridView.Update();
                        TotalAmountCalculation();
                    }
                }
            }
            else //There is no category4
            {
                keyboardForm.Hide();
                try
                {
                    CCalculatorForm tempCalculatorForm = new CCalculatorForm("Order Quantity", "Item Quantity");
                    tempCalculatorForm.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);
                }

                DataGridViewRow tempDataGridViewRow = new DataGridViewRow();
                tempDataGridViewRow.CreateCells(tempDataGridView);

                DataRow[] temp2DataRowArray = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3Button.CategoryID.ToString());
                if (temp2DataRowArray.Length != 0)
                {
                    string tableTypePrice = string.Empty;
                    if (m_iType == m_cCommonConstants.TableType)
                    {
                        tableTypePrice = temp2DataRowArray[0]["table_price"].ToString();
                    }
                    else if (m_iType == m_cCommonConstants.TakeAwayType)
                    {
                        tableTypePrice = temp2DataRowArray[0]["tw_price"].ToString();
                    }

                    // vat_included
                    double vatRate = 0;
                    bool vat_included = false;
                    double vatAmountRate = 0;

                    try
                    {
                        vatRate = Convert.ToDouble(temp2DataRowArray[0]["vat_Rate"].ToString());
                        vat_included = Convert.ToBoolean(temp2DataRowArray[0]["vat_included"].ToString());

                        if (vat_included)
                        {
                            vatAmountRate = (Double.Parse(tableTypePrice) * vatRate) / 100;

                            // tableTypePrice = (Double.Parse(tableTypePrice) - vatAmountRate).ToString();
                            tableTypePrice = Convert.ToDouble(tableTypePrice).ToString();
                        }
                        else
                        {
                            vatAmountRate = 0.00;
                        }

                    }
                    catch (Exception ex) { }

                    COrderManager tempOrderManager = new COrderManager();
                    COrderDetails tempOrderDetails = new COrderDetails();

                    int tempResult = FindExistingItem(tempDataGridView, temp2DataRowArray[0]["cat3_name"].ToString());
                    if (tempResult != -1)
                    {
                        //update Order_details table
                        int tempRowIndex = tempResult;
                        int qty = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                        tempDataGridView.Rows[tempRowIndex].Cells[1].Value = qty;
                        tempDataGridView.Rows[tempRowIndex].Cells[3].Value = ((double)(Double.Parse(tableTypePrice) * qty)).ToString("F02");
                        tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[7].Value.ToString());
                        tempOrderDetails.OrderID = orderID;
                        tempOrderDetails.ProductID = tempCategory3Button.CategoryID;
                        tempOrderDetails.CategoryLevel = tempCategory3Button.CategoryLevel;
                        tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
                        tempOrderDetails.OrderQuantity = qty;
                        tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                        tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                        tempOrderDetails.OnlineItemSequenceNumber = Convert.ToInt64("0" + tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
                        tempOrderDetails.PrintedQuantity = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[8].Value.ToString());
                        if (aCOrderInfo.VatComplementory) vatAmountRate = 0;
                        if (vat_included)
                        {
                            tempOrderDetails.VatTotal = qty * vatAmountRate;
                            tempDataGridView.Rows[tempRowIndex].Cells[2].Value = tempOrderDetails.VatTotal;
                        }
                        else
                        {
                            tempOrderDetails.VatTotal = 0.00;
                        }

                        if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                        {
                            tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                        }
                        else
                        {
                            tempOrderManager.UpdateOnlineOrderDetails(tempOrderDetails);
                        }

                    }
                    else
                    {
                        //Insert into Order_details table
                        tempOrderDetails.OrderID = orderID;
                        tempOrderDetails.ProductID = tempCategory3Button.CategoryID;
                        tempOrderDetails.CategoryLevel = tempCategory3Button.CategoryLevel;
                        tempOrderDetails.UnitPrice = Convert.ToDouble(tableTypePrice);
                        tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                        tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                        tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                        tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                        tempOrderDetails.Product_Name = temp2DataRowArray[0]["cat3_name"].ToString();
                        tempOrderDetails.UOM = temp2DataRowArray[0]["uom"].ToString();
                        tempOrderDetails.Product_Type = temp2DataRowArray[0]["productType"].ToString();
                        if (aCOrderInfo.VatComplementory) vatRate = vatAmountRate = 0;
                        try
                        {
                            if (vat_included)
                            {
                                tempOrderDetails.VatTotal = 0;
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                                // tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * vatAmountRate;
                            }
                            else
                            {
                                tempOrderDetails.VatTotal = tempOrderDetails.OrderAmount * (vatRate / 100);
                            }
                        }
                        catch { }

                        try
                        {
                            tempOrderDetails.Amount_with_vat = tempOrderDetails.OrderAmount + tempOrderDetails.VatTotal;

                        }
                        catch { }

                        string category1ID = this.GetCategory1ID(tempOrderDetails.ProductID, tempOrderDetails.CategoryLevel);
                        Int32 cat1Order = this.GetCategory1OrderNumber(Convert.ToInt32(category1ID));

                        if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                        {
                            tempOrderDetails = (COrderDetails)tempOrderManager.InsertOrderDetails(tempOrderDetails).Data;
                            string[] temp2DataGridViewRow = new string[]
                                { temp2DataRowArray[0]["cat3_name"].ToString(),
                                  m_iSavedOrderedQty.ToString(),
                                  tempOrderDetails.VatTotal.ToString("F2"),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory3Button.CategoryID.ToString(),
                                  "3",
                                  temp2DataRowArray[0]["cat3_rank"].ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString(),"0",
                                    tempOrderDetails.UnitPrice.ToString("F2")
                                };
                            tempDataGridView.Rows.Add(temp2DataGridViewRow);
                        }
                        else
                        {
                            tempOrderDetails.ItemName = temp2DataRowArray[0]["cat3_name"].ToString();
                            tempOrderDetails = (COrderDetails)tempOrderManager.InsertOnlineOrderDetails(tempOrderDetails).Data;
                            string[] temp2DataGridViewRow = new string[]
                                {temp2DataRowArray[0]["cat3_name"].ToString(),
                                  m_iSavedOrderedQty.ToString(),
                                    tempOrderDetails.VatTotal.ToString(),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory3Button.CategoryID.ToString(),
                                  "3",
                                  tempOrderDetails.OnlineItemSequenceNumber.ToString(),//For online order sequence number is category rank.
                                  tempOrderDetails.OrderDetailsID.ToString(),"0", //0 For first time.
                                  tempOrderDetails.UnitPrice.ToString("F2")
                                };
                            tempDataGridView.Rows.Add(temp2DataGridViewRow);
                        }
                    }

                    if (m_orderUserName.Replace(" ", "").ToUpper() != "Web User".Replace(" ", "").ToUpper())
                    {
                        this.ConvertRank();
                    }
                    tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                    try
                    {
                        tempDataGridView.Update();
                    }
                    catch { }
                        TotalAmountCalculation();

                }
            }
            g_FoodDataGridView.ClearSelection();
            g_BeverageDataGridView.ClearSelection();
            m_iSavedOrderedQty = 1;

            keyboardForm.Hide();

            this.SetPrintedItemBackColor();
        }
Example #2
0
        private void txtBoxSearchItem_TextChanged(object sender, EventArgs e)
        {
            try
            {
                string searchKeey = ((TextBox)sender).Text;

                DataRow[] tempDataRowArray = Program.initDataSet.Tables["Category3"].Select("cat3_name like '" + searchKeey + "%'");

                category3ButtonList.Clear();
                foreach (DataRow tempDataRow in tempDataRowArray)
                {
                    if (Int32.Parse(tempDataRow["status"].ToString()) == 0)
                    {
                        continue;
                    }

                    CCategoryButton tempCategoryButton = new CCategoryButton();
                    tempCategoryButton.CategoryID = int.Parse(tempDataRow["cat3_id"].ToString());
                    tempCategoryButton.CategoryOrder = int.Parse(tempDataRow["cat3_order"].ToString());
                    tempCategoryButton.CategoryLevel = 3;
                    tempCategoryButton.SellingQuantityorWeight = Convert.ToString(tempDataRow["selling_in"]);

                    tempCategoryButton.Text = tempDataRow["cat3_name"].ToString();

                    //set btn color

                    DataRow[] tempDataRowsFromCat2 = Program.initDataSet.Tables["Category2"].Select("cat2_id =" + tempDataRow["cat2_id"].ToString());

                    string clorcode = tempDataRowsFromCat2[0]["cat2_color"].ToString();
                    tempCategoryButton.BackColor = Color.FromArgb(Int32.Parse(clorcode.Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
                            Int32.Parse(clorcode.Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
                            Int32.Parse(clorcode.Substring(5, 2), System.Globalization.NumberStyles.HexNumber));

                    // tempCategoryButton.BackColor = tempCategory2Button.BackColor;
                    tempCategoryButton.Width = 130;
                    tempCategoryButton.FlatAppearance.BorderColor = Color.Black;
                    tempCategoryButton.FlatStyle = FlatStyle.Popup;

                    tempCategoryButton.Click += new EventHandler(Category3Button_Click);
                    category3ButtonList.Add(tempCategoryButton);
                }
                m_iNavigationCategory3Point = 0;
                g_ItemSelectionFlowLayoutPanel.Controls.Clear();

                for (int iterator = 0; iterator < m_food_item_panel_capacity && iterator < category3ButtonList.Count; iterator++)
                {
                    g_ItemSelectionFlowLayoutPanel.Controls.Add(category3ButtonList[iterator]);
                }

                if (category3ButtonList.Count > m_food_item_panel_capacity)
                {
                    g_Category3NextButton.Enabled = true;
                }
                else
                {
                    g_Category3NextButton.Enabled = false;
                }

                if (m_iNavigationCategory3Point > 0)
                {
                    g_Category3PreviousButton.Enabled = true;
                }
                else
                {
                    g_Category3PreviousButton.Enabled = false;
                }
            }
            catch (Exception exp)
            {
                Console.Write(exp.Message);
            }
        }
Example #3
0
        private void Category2Button_Click(object sender, EventArgs e)
        {
            try
            {
                CCategoryButton tempCategory2Button = (CCategoryButton)sender;
                int tempCategory2ID = tempCategory2Button.CategoryID;

                DataRow[] tempDataRowArray = Program.initDataSet.Tables["Category3"].Select("cat2_id = " + tempCategory2ID.ToString());
                category3ButtonList.Clear();
                foreach (DataRow tempDataRow in tempDataRowArray)
                {
                    if (Int32.Parse(tempDataRow["status"].ToString()) == 0)
                    {
                        continue;
                    }

                    CCategoryButton tempCategoryButton = new CCategoryButton();
                    tempCategoryButton.CategoryID = int.Parse(tempDataRow["cat3_id"].ToString());
                    tempCategoryButton.CategoryOrder = int.Parse(tempDataRow["cat3_order"].ToString());
                    tempCategoryButton.CategoryLevel = 3;
                    tempCategoryButton.SellingQuantityorWeight = Convert.ToString(tempDataRow["selling_in"]);

                    tempCategoryButton.Text = tempDataRow["cat3_name"].ToString();
                    tempCategoryButton.BackColor = tempCategory2Button.BackColor;
                    tempCategoryButton.Width = 130;
                    tempCategoryButton.FlatAppearance.BorderColor = Color.Black;
                    tempCategoryButton.FlatStyle = FlatStyle.Popup;

                    if (tempDataRow["productType"].ToString()=="Finished")
                    {
                    tempCategoryButton.Click += new EventHandler(Category3Button_Click);
                    category3ButtonList.Add(tempCategoryButton);
                    }
                }
                m_iNavigationCategory3Point = 0;
                g_ItemSelectionFlowLayoutPanel.Controls.Clear();

                for (int iterator = 0; iterator < m_food_item_panel_capacity && iterator < category3ButtonList.Count; iterator++)
                {
                    g_ItemSelectionFlowLayoutPanel.Controls.Add(category3ButtonList[iterator]);
                }

                if (category3ButtonList.Count > m_food_item_panel_capacity)
                {
                    g_Category3NextButton.Enabled = true;
                }
                else
                {
                    g_Category3NextButton.Enabled = false;
                }

                if (m_iNavigationCategory3Point > 0)
                {
                    g_Category3PreviousButton.Enabled = true;
                }
                else
                {
                    g_Category3PreviousButton.Enabled = false;
                }
            }
            catch (Exception exp)
            {
                Console.Write(exp.Message);
            }
        }
Example #4
0
        private void parentCategoryButton_Click(object sender, EventArgs e)
        {
            try
            {
                category2ButtonList.Clear();
                g_ItemSelectionFlowLayoutPanel.Controls.Clear();
                CCategoryButton parentCategoryButton = (CCategoryButton)sender;
                int parentCategoryButtonID = parentCategoryButton.CategoryID;
                // MessageBox.Show(parentCategoryButton.Text);
                CDalConfig oTempDal = ConfigManager.GetConfig<CDalConfig>();
                String tempConnStr = oTempDal.ConnectionString;
                SqlConnection conn = new SqlConnection(tempConnStr);
                DataTable table = new DataTable();
                try
                {
                    string sql = "select c2.cat2_id,c2.cat2_name,c2.cat2_order,c2.cat2_color from  category2 c2,category1 c1 where c1.cat1_id=c2.cat1_id and c1.parent_cat_id=" + parentCategoryButtonID;

                    if (conn.State != ConnectionState.Open)
                        conn.Open();
                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sql, tempConnStr);

                    SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

                    table.Locale = System.Globalization.CultureInfo.InvariantCulture;

                    dataAdapter.Fill(table);

                    dataAdapter.Dispose();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    if (conn.State == ConnectionState.Open)
                        conn.Close();
                }

                if (table != null)
                {
                    //DataSet dsCategory2 = table[0];

                    foreach (DataRow tempDataRow in table.Rows)
                    {
                        CCategoryButton tempCategoryButton = new CCategoryButton();
                        tempCategoryButton.CategoryID = int.Parse(tempDataRow["cat2_id"].ToString());
                        tempCategoryButton.CategoryOrder = int.Parse(tempDataRow["cat2_order"].ToString());
                        tempCategoryButton.CategoryLevel = 2;

                        tempCategoryButton.Text = tempDataRow["cat2_name"].ToString();
                        tempCategoryButton.Width = 110;//new at 05.03.2010                // OLD CATEGORY2 SIZE
                        tempCategoryButton.Height = tempCategoryButton.Height - 1;

                        //tempCategoryButton.Text = tempDataRow["cat2_name"].ToString();
                        //    h= 160;//new at 05.03.2010                     //  OLD CATEGORY2 SIZE  MITHU
                        //tempCategoryButton.Height = tempCategoryButton.Height + 10;

                        try
                        {
                            tempCategoryButton.BackColor = Color.FromArgb(Int32.Parse(tempDataRow["cat2_color"].ToString().Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
                                Int32.Parse(tempDataRow["cat2_color"].ToString().Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
                                Int32.Parse(tempDataRow["cat2_color"].ToString().Substring(5, 2), System.Globalization.NumberStyles.HexNumber));
                        }
                        catch (Exception exp)
                        {
                            Console.Write(exp.Message);
                        }
                        //tempCategoryButton.BackColor = Color.FromName(tempDataRow["cat2_color"].ToString());
                        tempCategoryButton.Click += new EventHandler(Category2Button_Click);
                        category2ButtonList.Add(tempCategoryButton);
                    }
                    #region "Added by Baruri at 14.10.2008 for resolving the navigation point"
                    if (m_iNavigationPoint != 0)
                    {
                        g_Category2Panel.Controls.Clear();
                        for (int counter = 0; counter < m_category_panel_capacity; counter++)
                        {
                            if (category2ButtonList.Count > (m_category_panel_capacity * m_iNavigationPoint + counter))
                            {
                                g_Category2Panel.Controls.Add(category2ButtonList[(m_category_panel_capacity * m_iNavigationPoint + counter)]);
                            }
                        }

                        if (m_iNavigationPoint < (category2ButtonList.Count / m_category_panel_capacity))
                        {
                            if ((m_iNavigationPoint + 1) == (category2ButtonList.Count / m_category_panel_capacity) && (category2ButtonList.Count % m_category_panel_capacity) == 0)
                            {
                                g_NextButton.Enabled = false;
                            }
                            else
                            {
                                g_NextButton.Enabled = true;
                            }
                        }
                        else
                            g_NextButton.Enabled = false;

                        if (m_iNavigationPoint > 0)
                            g_PreviousButton.Enabled = true;
                        else
                            g_PreviousButton.Enabled = false;
                    }

                    else
                    {
                        g_Category2Panel.Controls.Clear();
                        for (int counter = 0; counter < m_category_panel_capacity && counter < category2ButtonList.Count; counter++)
                        {
                            g_Category2Panel.Controls.Add(category2ButtonList[counter]);
                        }

                        if (category2ButtonList.Count > m_category_panel_capacity)
                            g_NextButton.Enabled = true;
                        else
                            g_NextButton.Enabled = false;
                        g_PreviousButton.Enabled = false;
                    }
                    #endregion
                    // this.LoadStatusBar();
                }
            }
            catch (Exception exp)
            {
                Console.Write(exp.Message);
            }
        }
Example #5
0
        private void Init()
        {
            try
            {
                m_sDiscountType = "Fixed";
                m_dDiscountAmount = 0;

                parentCategoryButtonList = new List<CCategoryButton>();

                category2ButtonList = new List<CCategoryButton>();
                category3ButtonList = new List<CCategoryButton>();
                category4ButtonList = new List<CCategoryButton>();
                m_cCommonConstants = ConfigManager.GetConfig<CCommonConstants>();

                //New Addition at 04/08/2011
                String ConnectionString = m_cCommonConstants.DBConnection;
                SqlDataAdapter daParentCategory = new SqlDataAdapter(SqlQueries.GetQuery(Query.ParentCategoryGetAll), ConnectionString);
                daParentCategory.Fill(dsParentCategory, "ParentCategory");
                daParentCategory.Dispose();
                //New Addition at 08/08/2008
                SqlDataAdapter daCategory3 = new SqlDataAdapter(SqlQueries.GetQuery(Query.Category3GetAll), ConnectionString);
                daCategory3.Fill(dsCategory3, "Category3");
                daCategory3.Dispose();

                SqlDataAdapter daCategory4 = new SqlDataAdapter(SqlQueries.GetQuery(Query.Category4GetAll), ConnectionString);
                daCategory4.Fill(dsCategory4, "Category4");
                daCategory4.Dispose();

                SqlDataAdapter tempSqlDataAdapter5 = new SqlDataAdapter(SqlQueries.GetQuery(Query.Category2GetAll), ConnectionString);
                tempSqlDataAdapter5.Fill(dsCategory2, "Category2");
                tempSqlDataAdapter5.Dispose();

                SqlDataAdapter tempSqlDataAdapter6 = new SqlDataAdapter(SqlQueries.GetQuery(Query.Category1GetAll), ConnectionString);
                tempSqlDataAdapter6.Fill(dsCategory1, "Category1");
                tempSqlDataAdapter6.Dispose();

                if (m_cCommonConstants.UserInfo == null)
                    return;

                //Remove Items .This code will be optimized later
                CUserManager tempUserManager = new CUserManager();
                /*CUserAccess tempUserAccess2 = (CUserAccess)tempUserManager.GetUserAccess(m_cCommonConstants.UserInfo).Data;
                if (tempUserAccess2.RemoveItems == 1)
                    g_RemoveButton.Enabled = true;
                 else
                    g_RemoveButton.Enabled = false;*/

                if (m_iType == m_cCommonConstants.TableType)
                    this.g_ConvertButton.Text = "";
                else if (m_iType == m_cCommonConstants.TakeAwayType)
                    this.g_ConvertButton.Text = "Convert to Table";
                // For Food Menu @Mahmud
                foreach (DataRow tempDataRow in Program.initDataSet.Tables["ParentCategory"].Rows)
                {
                    CCategoryButton tempCategoryButton = new CCategoryButton();
                    tempCategoryButton.CategoryID = int.Parse(tempDataRow["parent_cat_id"].ToString());
                    tempCategoryButton.CategoryOrder = int.Parse(tempDataRow["parent_cat_order"].ToString());
                    tempCategoryButton.CategoryLevel = 0;
                    tempCategoryButton.Text = tempDataRow["parent_cat_name"].ToString();

                    tempCategoryButton.Width = 110;//new at 05.03.2010            //   OLD PARENT CATEGORY SIZE AND COLOR
                    tempCategoryButton.Height = tempCategoryButton.Height - 1;
                    tempCategoryButton.BackColor = Color.LightSeaGreen;//Parent colour Change

                    ////tempCategoryButton.Width = 170;
                    ////tempCategoryButton.Height = tempCategoryButton.Height + 10;         // CHANGE MITHU
                    ////tempCategoryButton.BackColor = Color.Firebrick;

                    //#try
                    //#{
                    //# tempCategoryButton.BackColor = Color.FromArgb(Int32.Parse(tempDataRow["cat2_color"].ToString().Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
                    //#  Int32.Parse(tempDataRow["cat2_color"].ToString().Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
                    //#  Int32.Parse(tempDataRow["cat2_color"].ToString().Substring(5, 2), System.Globalization.NumberStyles.HexNumber));
                    //#}
                    //#catch (Exception exp)
                    //#{
                    //# Console.Write(exp.Message);
                    //#}
                    //tempCategoryButton.BackColor = Color.FromName(tempDataRow["cat2_color"].ToString());

                    tempCategoryButton.Click += new EventHandler(parentCategoryButton_Click);
                    parentCategoryButtonList.Add(tempCategoryButton);
                }
                // For Food Menu @Mahmud
                foodMenuPanal.Controls.Clear();

                foreach (CCategoryButton pcb in parentCategoryButtonList)
                {
                 //   foodMenuPanal.Controls.Add(pcb);

                    if (m_iParentNavigationPoint != 0)
                    {
                        foodMenuPanal.Controls.Clear();
                        for (int counter = 0; counter < m_capacity; counter++)
                        {
                            if (parentCategoryButtonList.Count > (m_capacity * m_iParentNavigationPoint + counter))
                            {
                                foodMenuPanal.Controls.Add(parentCategoryButtonList[(m_capacity * m_iParentNavigationPoint + counter)]);
                            }
                        }

                        if (m_iParentNavigationPoint < (parentCategoryButtonList.Count / m_capacity))
                        {
                            if ((m_iParentNavigationPoint + 1) == (parentCategoryButtonList.Count / m_capacity) && (parentCategoryButtonList.Count % m_capacity) == 0)
                            {
                                btnNextParent.Enabled = false;
                            }
                            else
                            {
                                btnNextParent.Enabled = true;
                            }
                        }
                        else
                            btnNextParent.Enabled = false;

                        if (m_iParentNavigationPoint > 0)
                            btnPrevParent.Enabled = true;
                        else
                            btnPrevParent.Enabled = false;
                    }

                    else
                    {
                        foodMenuPanal.Controls.Clear();
                        for (int counter = 0; counter < m_capacity && counter < parentCategoryButtonList.Count; counter++)
                        {
                            foodMenuPanal.Controls.Add(parentCategoryButtonList[counter]);
                        }

                        if (parentCategoryButtonList.Count > m_capacity)
                            btnNextParent.Enabled = true;
                        else
                            btnNextParent.Enabled = false;
                        btnPrevParent.Enabled = false;
                    }
                 //   #endregion

                }

                this.LoadStatusBar();

                if (m_customerEditStatus == true)//If customer edit button is pressed.This function is called for getting the latest information after modification
                {
                    this.FillSummary();
                    m_customerEditStatus = false;
                }
            }
            catch (Exception exp)
            {
                Console.Write(exp.Message);
            }
        }
Example #6
0
        public CBarServiceForm()
        {
            InitializeComponent();

            m_bOrderState = false;
            m_cCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
            m_iType = m_cCommonConstants.TabsType;
            FillRMSDataGridView();
            category2ButtonList = new List<CCategoryButton>();
            category3ButtonList = new List<CCategoryButton>();
            category4ButtonList = new List<CCategoryButton>();

            try
            {
                m_cCommonConstants = ConfigManager.GetConfig<CCommonConstants>();
                this.ActivateButtons();

                if (m_cCommonConstants.UserInfo == null)
                    return;

                this.g_ConvertButton.Text = "Convert to Table";

                foreach (DataRow tempDataRow in Program.initDataSet.Tables["Category2"].Rows)
                {
                    if (int.Parse(tempDataRow["cat2_type"].ToString()) == 1)
                        continue;

                    CCategoryButton tempCategoryButton = new CCategoryButton();
                    tempCategoryButton.CategoryID = int.Parse(tempDataRow["cat2_id"].ToString());
                    tempCategoryButton.CategoryOrder = int.Parse(tempDataRow["cat2_order"].ToString());
                    tempCategoryButton.CategoryLevel = 2;
                    tempCategoryButton.Text = tempDataRow["cat2_name"].ToString();
                    try
                    {
                        tempCategoryButton.BackColor = Color.FromArgb(Int32.Parse(tempDataRow["cat2_color"].ToString().Substring(1, 2), System.Globalization.NumberStyles.HexNumber),
                            Int32.Parse(tempDataRow["cat2_color"].ToString().Substring(3, 2), System.Globalization.NumberStyles.HexNumber),
                            Int32.Parse(tempDataRow["cat2_color"].ToString().Substring(5, 2), System.Globalization.NumberStyles.HexNumber));
                    }
                    catch (Exception eeee)
                    {
                    }
                    //tempCategoryButton.BackColor = Color.FromName(tempDataRow["cat2_color"].ToString());
                    tempCategoryButton.Click += new EventHandler(Category2Button_Click);
                    category2ButtonList.Add(tempCategoryButton);
                }

                g_Category2Panel.Controls.Clear();
                for (int counter = 0; counter < CATEGORY2PANEL_CAPACITY && counter < category2ButtonList.Count; counter++)
                {
                    g_Category2Panel.Controls.Add(category2ButtonList[counter]);
                }

                if (category2ButtonList.Count > CATEGORY2PANEL_CAPACITY)
                    g_NextButton.Enabled = true;
                else
                    g_NextButton.Enabled = false;

                g_PreviousButton.Enabled = false;
                LoadStatusBar();
            }
            catch (Exception eee)
            {
            }
        }
Example #7
0
        private void Category3Button_Click(object sender, EventArgs e)
        {
            try
            {
                CCategoryButton tempCategory3Button = (CCategoryButton)sender;
                int tempCategory3ID = tempCategory3Button.CategoryID;

                if (m_bItemDescriptionClicked)
                {
                    string tempItemDescription = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3ID)[0]["description"].ToString();
                    CMessageBox tempMessageBox = new CMessageBox("Item Description", tempItemDescription);
                    tempMessageBox.ShowDialog();
                    m_bItemDescriptionClicked = false;
                    return;
                }

                int tempFoodType = int.Parse(Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3ID)[0].GetParentRow(Program.initDataSet.Relations["category2_to_category3"])["cat2_type"].ToString());
                DataGridView tempDataGridView = new DataGridView();
                tempDataGridView = g_FoodDataGridView;

                DataRow[] tempDataRowArray = Program.initDataSet.Tables["Category4"].Select("cat3_id = " + tempCategory3ID.ToString());
                category4ButtonList.Clear();
                if (tempDataRowArray.Length != 0)
                {
                    foreach (DataRow tempDataRow in tempDataRowArray)
                    {
                        CCategoryButton tempCategoryButton = new CCategoryButton();
                        tempCategoryButton.CategoryID = int.Parse(tempDataRow["cat4_id"].ToString());
                        tempCategoryButton.CategoryOrder = int.Parse(tempDataRow["cat4_order"].ToString());
                        tempCategoryButton.CategoryLevel = 4;
                        tempCategoryButton.Text = tempDataRow["cat4_name"].ToString();
                        tempCategoryButton.BackColor = tempCategory3Button.BackColor;
                        category4ButtonList.Add(tempCategoryButton);
                    }

                    CCategory4Form tempCategory4Form = new CCategory4Form(tempCategory3ID, category4ButtonList, tempCategory3Button.Text);
                    tempCategory4Form.ShowDialog();
                    CCategoryButton tempCategory4Button = CCategory4Form.m_cbResult;
                    if (tempCategory4Button == null)
                        return;
                    else   //insert into table and datagridview
                    {
                        NewOrder();

                        DataRow[] temp2DataRowArray = Program.initDataSet.Tables["Category4"].Select("cat4_id = " + tempCategory4Button.CategoryID.ToString());
                        if (temp2DataRowArray.Length != 0)
                        {
                            //category4 + categpry3
                            string ItemName = temp2DataRowArray[0]["cat4_name"].ToString() + " " + tempCategory3Button.Text;
                            string tableTypePrice = string.Empty;
                            tableTypePrice = temp2DataRowArray[0]["bar_price"].ToString();
                            int tempSearchResult = DataGridViewSearch(tempDataGridView, ItemName);

                            COrderManager tempOrderManager = new COrderManager();
                            COrderDetails tempOrderDetails = new COrderDetails();

                            if (tempSearchResult != -1)
                            {
                                int tempRowIndex = tempSearchResult;
                                int qty = int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                                tempDataGridView.Rows[tempRowIndex].Cells[1].Value = qty;
                                tempDataGridView.Rows[tempRowIndex].Cells[2].Value = ((double)(Double.Parse(tableTypePrice) * qty)).ToString("F02");
                                //update Order_details table
                                tempOrderDetails.OrderID = orderID;
                                tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
                                tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
                                tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
                                tempOrderDetails.OrderQuantity = qty;
                                tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                                tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                                tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                                tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                            }
                            else
                            {
                                //Insert into Order_details table
                                tempOrderDetails.OrderID = orderID;
                                tempOrderDetails.ProductID = tempCategory4Button.CategoryID;
                                tempOrderDetails.CategoryLevel = tempCategory4Button.CategoryLevel;
                                tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                                tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                                tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                                tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                                CResult oResult = tempOrderManager.InsertOrderDetails(tempOrderDetails);
                                if (oResult.IsSuccess && oResult.Data != null)
                                {
                                    tempOrderDetails = (COrderDetails)oResult.Data;
                                }

                                string[] tempDataGridViewRow = new string[]
                                { ItemName,
                                  m_iSavedOrderedQty.ToString(),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory4Button.CategoryID.ToString(),
                                  "4",
                                  temp2DataRowArray[0]["cat4_rank"].ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString()
                                };

                                tempDataGridView.Rows.Add(tempDataGridViewRow);
                            }
                            ConvertRank();
                            tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                            tempDataGridView.Update();
                            TotalAmountCalculation();
                        }
                    }
                }
                else //There is no category4
                {
                    NewOrder();
                    DataGridViewRow tempDataGridViewRow = new DataGridViewRow();
                    tempDataGridViewRow.CreateCells(tempDataGridView);

                    DataRow[] temp2DataRowArray = Program.initDataSet.Tables["Category3"].Select("cat3_id = " + tempCategory3Button.CategoryID.ToString());

                    if (temp2DataRowArray.Length != 0)
                    {
                        string tableTypePrice = string.Empty;
                        tableTypePrice = temp2DataRowArray[0]["bar_price"].ToString();

                        COrderManager tempOrderManager = new COrderManager();
                        COrderDetails tempOrderDetails = new COrderDetails();

                        int tempResult = DataGridViewSearch(tempDataGridView, temp2DataRowArray[0]["cat3_name"].ToString());
                        if (tempResult != -1)
                        {
                            //update Order_details table
                            int tempRowIndex = tempResult;
                            int qty=int.Parse(tempDataGridView.Rows[tempRowIndex].Cells[1].Value.ToString()) + m_iSavedOrderedQty;
                            tempDataGridView.Rows[tempRowIndex].Cells[1].Value = qty;
                            tempDataGridView.Rows[tempRowIndex].Cells[2].Value = ((double)(Double.Parse(tableTypePrice) * qty)).ToString("F02");
                            tempOrderDetails.OrderDetailsID = Int64.Parse(tempDataGridView.Rows[tempRowIndex].Cells[6].Value.ToString());
                            tempOrderDetails.OrderID = orderID;
                            tempOrderDetails.ProductID = tempCategory3Button.CategoryID;
                            tempOrderDetails.CategoryLevel = tempCategory3Button.CategoryLevel;
                            tempOrderDetails.OrderQuantity = qty;
                            tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                            tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                            tempOrderManager.UpdateOrderDetails(tempOrderDetails);
                        }
                        else
                        {
                            //Insert into Order_details table
                            tempOrderDetails.OrderID = orderID;
                            tempOrderDetails.ProductID = tempCategory3Button.CategoryID;
                            tempOrderDetails.CategoryLevel = tempCategory3Button.CategoryLevel;
                            tempOrderDetails.OrderQuantity = m_iSavedOrderedQty;
                            tempOrderDetails.OrderAmount = tempOrderDetails.OrderQuantity * Double.Parse(tableTypePrice);
                            tempOrderDetails.OrderFoodType = tempFoodType == 1 ? ("Food") : ("Nonfood");
                            tempOrderDetails.ItemOrderTime = DateTime.Now.Ticks;
                            CResult oResult = tempOrderManager.InsertOrderDetails(tempOrderDetails);
                            if (oResult.IsSuccess && oResult.Data != null)
                            {
                                tempOrderDetails = (COrderDetails)oResult.Data;
                            }

                            string[] temp2DataGridViewRow = new string[]
                                { temp2DataRowArray[0]["cat3_name"].ToString(),
                                  m_iSavedOrderedQty.ToString(),
                                  ((double)(Double.Parse(tableTypePrice)*m_iSavedOrderedQty)).ToString("F02"),
                                  tempCategory3Button.CategoryID.ToString(),
                                  "3",
                                  temp2DataRowArray[0]["cat3_rank"].ToString(),
                                  tempOrderDetails.OrderDetailsID.ToString()
                                };

                            tempDataGridView.Rows.Add(temp2DataGridViewRow);
                        }
                        ConvertRank();
                        tempDataGridView.Sort(tempDataGridView.Columns[5], ListSortDirection.Ascending);
                        tempDataGridView.Update();
                        TotalAmountCalculation();
                    }
                }
                m_iSavedOrderedQty = 1;
                g_FoodDataGridView.ClearSelection();
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Example #8
0
        private void Category2Button_Click(object sender, EventArgs e)
        {
            try
            {
                CCategoryButton tempCategory2Button = (CCategoryButton)sender;
                int tempCategory2ID = tempCategory2Button.CategoryID;

                DataRow[] tempDataRowArray = Program.initDataSet.Tables["Category3"].Select("cat2_id = " + tempCategory2ID.ToString());
                category3ButtonList.Clear();
                foreach (DataRow tempDataRow in tempDataRowArray)
                {
                    CCategoryButton tempCategoryButton = new CCategoryButton();
                    tempCategoryButton.CategoryID = int.Parse(tempDataRow["cat3_id"].ToString());
                    tempCategoryButton.CategoryOrder = int.Parse(tempDataRow["cat3_order"].ToString());
                    tempCategoryButton.CategoryLevel = 3;
                    tempCategoryButton.Text = tempDataRow["cat3_name"].ToString();
                    tempCategoryButton.BackColor = tempCategory2Button.BackColor;
                    tempCategoryButton.Click += new EventHandler(Category3Button_Click);
                    category3ButtonList.Add(tempCategoryButton);
                }
                m_iNavigationCategory3Point = 0;
                g_ItemSelectionFlowLayoutPanel.Controls.Clear();
                for (int buttonCounter = 0; buttonCounter < CATEGORY3PANEL_CAPACITY && buttonCounter < category3ButtonList.Count; buttonCounter++)
                {
                    g_ItemSelectionFlowLayoutPanel.Controls.Add(category3ButtonList[buttonCounter]);
                }

                if (category3ButtonList.Count > CATEGORY3PANEL_CAPACITY)
                    g_Category3NextButton.Enabled = true;
                else
                    g_Category3NextButton.Enabled = false;

                if (m_iNavigationCategory3Point > 0)
                    g_Category3PreviousButton.Enabled = true;
                else
                    g_Category3PreviousButton.Enabled = false;
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }