private void AddQuantityAtGodown_Click(object sender, EventArgs e) { int id = dataGridView2.SelectedRows.Count; if (id == 0) { MessageBox.Show("Please Select Product."); return; } if (QuantityTB.Text == "") { MessageBox.Show("Please Enter Quantity."); return; } ServiceReference1.Product p = products[dataGridView2.SelectedRows[0].Index]; p.QuantityAtGodown += Convert.ToInt32(QuantityTB.Text); p.TotalQuantity += Convert.ToInt32(QuantityTB.Text); ServiceReference1.ProductServiceClient client = new ServiceReference1.ProductServiceClient(); client.UpdateProductQuantityAtGodown(p.ProductId, p.QuantityAtGodown); client.UpdateProductTotalQuantity(p.ProductId, p.TotalQuantity); QuantityTB.Text = ""; }
private void UpdateValueBtn_Click(object sender, EventArgs e) { int count = dataGridView3.SelectedRows.Count; if (count == 0) { MessageBox.Show("Please Select Product."); ProductParameters.SelectedIndex = -1; return; } ServiceReference1.Product p = products[dataGridView3.SelectedRows[0].Index]; int id = ProductParameters.SelectedIndex; if (id == -1) { MessageBox.Show("Please Select Product Parameter."); ProductParameters.SelectedIndex = -1; return; } ServiceReference1.ProductServiceClient client = new ServiceReference1.ProductServiceClient(); if (id == 0) { if (UpdateValueTB.Text != p.ProductName) { p.ProductName = UpdateValueTB.Text; client.UpdateProductName(p.ProductId, p.ProductName); } } else if (id == 1) { if (Convert.ToInt32(UpdateValueTB.Text) != p.ProductPrice) { p.ProductPrice = Convert.ToInt32(UpdateValueTB.Text); client.UpdateProductPrice(p.ProductId, p.ProductPrice); } } else if (id == 2) { if (Convert.ToInt32(UpdateValueTB.Text) != p.QuantityAtShop) { p.TotalQuantity -= p.QuantityAtShop; p.QuantityAtShop = Convert.ToInt32(UpdateValueTB.Text); p.TotalQuantity += p.QuantityAtShop; client.UpdateProductQuantityAtShop(p.ProductId, p.QuantityAtShop); client.UpdateProductTotalQuantity(p.ProductId, p.TotalQuantity); } } else if (id == 3) { if (Convert.ToInt32(UpdateValueTB.Text) != p.QuantityAtGodown) { p.TotalQuantity -= p.QuantityAtGodown; p.QuantityAtGodown = Convert.ToInt32(UpdateValueTB.Text); p.TotalQuantity += p.QuantityAtGodown; client.UpdateProductQuantityAtGodown(p.ProductId, p.QuantityAtGodown); client.UpdateProductTotalQuantity(p.ProductId, p.TotalQuantity); } } else if (id == 4) { if (UpdateValueTB.Text != p.Description) { p.Description = UpdateValueTB.Text; client.UpdateProductDescription(p.ProductId, p.Description); } } }