private void BtnUpdate_Click(object sender, EventArgs e) { ProductBAL PB = new ProductBAL(); if (TxtProductName.Text.Trim() != "") { PB.Product_Name = TxtProductName.Text.Trim(); if (CMBBrandValueMember != 0) { PB.Brand_ID = CMBBrandValueMember; if (TxtCost.Text.Trim() != "") { PB.Product_Cost = Convert.ToDecimal(TxtCost.Text.Trim()); if (TxtSellingRate.Text.Trim() != "") { PB.Selling_Rate = Convert.ToDecimal(TxtSellingRate.Text.Trim()); PB.Description = TxtDescription.Text.Trim(); PB.Product_ID = ProductID; ProductDAL PD = new ProductDAL(); int result = PD.UpdateProduct(PB); if (result > 0) { MessageBox.Show("Product Updated Successfully"); LoadDGVProducts(); } else { MessageBox.Show("Something Went Wrong"); } } else { MessageBox.Show("Please Enter the selling price of the product"); TxtSellingRate.Focus(); } } else { MessageBox.Show("Please Enter the Product Cost"); TxtCost.Focus(); } } else { MessageBox.Show("Please Select the Brand Name"); } } else { MessageBox.Show("Product Name cannot be blank"); TxtProductName.Focus(); } }