private void btnDelRow_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (DataGridViewRow row in dgvInvoice.SelectedRows)
                {
                    dgvInvoice.Rows.Remove(row);
                    double addSum = 0.0;

                    for (int x = 0; x < dgvInvoice.Rows.Count; x++)
                    {
                        addSum = addSum + Convert.ToDouble(dgvInvoice.Rows[x].Cells[3].Value);
                    }

                    txtGTotal.Text = Convert.ToString(addSum);

                    String updateQuery = "UPDATE products SET QUANTITY = QUANTITY + '" + txtq1.Text + "' WHERE PRODUCT_NAME = '" + txtpn1.Text + "' ";

                    dbConnect connect = new dbConnect();
                    connect.Update(updateQuery);
                }



                txtq1.Text = "";
                loadPsProduct();
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }
        }
        private void btnCart_Emp_Click(object sender, EventArgs e)
        {
            Int32.TryParse(txt_Qty.Text, out int quantity);
            Int32.TryParse(txtActualQty.Text, out int totalQuantity);

            //quantity <= totalQuantity && quantity > 0 && txt_Qty.Text != ""

            try
            {
                if (quantity <= totalQuantity && quantity > 0 && txt_Qty.Text != "")
                {
                    Double.TryParse(txt_Price.Text, out Double price);
                    Double.TryParse(txt_Qty.Text, out Double qty);
                    Int32.TryParse(txt_Qty.Text, out int qty_1);

                    double total = price * qty;

                    string stringTotal = total.ToString();

                    //MessageBox.Show(txt_Qty.Text + ' ' + txtActualQty.Text);

                    dgvInvoice.Rows.Add(txt_Pname.Text, txt_Price.Text, txt_Qty.Text, stringTotal);

                    double addSum = 0.0;

                    for (int x = 0; x < dgvInvoice.Rows.Count; x++)
                    {
                        addSum = addSum + Convert.ToDouble(dgvInvoice.Rows[x].Cells[3].Value);
                    }

                    txtGTotal.Text = Convert.ToString(addSum);

                    String updateQuery = "UPDATE products SET QUANTITY = QUANTITY - '" + qty_1 + "' WHERE PRODUCT_ID = '" + txt_pid.Text + "' ";

                    dbConnect connect = new dbConnect();
                    connect.Update(updateQuery);
                }
                else
                {
                    MessageBox.Show("Invalid value for the quantity");
                }
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message);
            }

            txt_Qty.Text = "";
            loadPsProduct();
        }
        private void btnU_Price_Click(object sender, EventArgs e)
        {
            String updateQuery = "UPDATE products SET PRICE = '" + txtPrice.Text + "' WHERE PRODUCT_ID= '" + txtPID.Text + "' ";

            if (txtPrice.Text != "" && txtPID.Text != "")
            {
                dbConnect connect = new dbConnect();
                connect.Update(updateQuery);
            }

            else
            {
                MessageBox.Show("Invalid Entry");
            }
            loadProduct();
        }