private void createBtn_Click(object sender, EventArgs e)
        {
            Software.Model.Food food = new Software.Model.Food();
            try
            {
                food.Name         = nameBox.Text;
                food.Price        = Convert.ToInt32(priceBox.Text);
                food.Description  = descriptionBox.Text;
                food.Availability = infoGroup.Controls.OfType <RadioButton>()
                                    .FirstOrDefault(r => r.Checked).Text;
                food.Type_Id       = ((Software.Model.Food_Type)typeComboBox.SelectedItem).Id;
                food.Discount_Rate = Convert.ToInt32(discountBox.Text);
                food.Other_Charges = Convert.ToInt32(chargesBox.Text);
                //food.Stock_Count = Convert.ToInt32(stockBox.Text);
                food.Picture = pictureBox.ImageLocation;

                Software.Database.SQL.FoodDB.InsertFood(food);
                MetroFramework.MetroMessageBox.Show(this, "Data has been inserted!", "Successfully Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Close();
            }
            catch (Exception ex)
            {
                MetroFramework.MetroMessageBox.Show(this, "Your data could not be inserted!", "Invalid data!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void updateBtn_Click(object sender, EventArgs e)
        {
            int selectedRowIndex = 0;

            if (table.SelectedCells.Count > 0)
            {
                Software.Model.Food food = new Software.Model.Food();

                selectedRowIndex = table.SelectedCells[0].RowIndex;
                DataGridViewRow selectedRow = table.Rows[selectedRowIndex];

                try
                {
                    food.Id            = Convert.ToInt32(Convert.ToString(selectedRow.Cells["Id"].Value));
                    food.Name          = nameBox.Text;
                    food.Price         = Convert.ToInt32(priceBox.Text);
                    food.Description   = descriptionBox.Text;
                    food.Type_Id       = ((Software.Model.Food_Type)typeComboBox.SelectedItem).Id;
                    food.Discount_Rate = Convert.ToInt32(discountBox.Text);
                    food.Availability  = infoGroup.Controls.OfType <RadioButton>()
                                         .FirstOrDefault(r => r.Checked).Text;
                    food.Other_Charges = Convert.ToInt32(chargesBox.Text);
                    //food.Stock_Count = Convert.ToInt32(stockBox.Text);
                    food.Picture = pictureBox.ImageLocation;
                    Software.Database.SQL.FoodDB.UpdateFood(food);
                    MetroFramework.MetroMessageBox.Show(this, "Your data has been updated.", "Successfully Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    MetroFramework.MetroMessageBox.Show(this, "Your data could not be updated.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MetroFramework.MetroMessageBox.Show(this, "You must select a row to update its value!", "Invalid Selection");
            }

            DoRefresh();
            table.CurrentCell = table.Rows[selectedRowIndex].Cells[0];
            table.Rows[selectedRowIndex].Selected = true;
        }