private void DelProductBtn_Click(object sender, EventArgs e) { int index = dataGridViewProducts.CurrentCell.RowIndex; Product product = new Product(); product.SetValues( Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["Id"].Value), dataGridViewProducts.Rows[index].Cells["Title"].Value.ToString(), Convert.ToDouble(dataGridViewProducts.Rows[index].Cells["PurchasePrice"].Value), Convert.ToDouble(dataGridViewProducts.Rows[index].Cells["Markup"].Value), Convert.ToDouble(dataGridViewProducts.Rows[index].Cells["Price"].Value), Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["DepartmentId"].Value), Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["ProduserId"].Value), Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["Quantity"].Value), Convert.ToBoolean(dataGridViewProducts.Rows[index].Cells["CriticalQ"].Value)); client.DelProduct(product); //_waitForResponse.WaitOne(); }
private void OnEditProduct(object sender, EventArgs e) { int index = dataGridViewProducts.CurrentCell.RowIndex; Product product = new Product(); product.SetValues( Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["Id"].Value), dataGridViewProducts.Rows[index].Cells["Title"].Value.ToString(), Convert.ToDouble(dataGridViewProducts.Rows[index].Cells["PurchasePrice"].Value), Convert.ToDouble(dataGridViewProducts.Rows[index].Cells["Markup"].Value), Convert.ToDouble(dataGridViewProducts.Rows[index].Cells["Price"].Value), Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["DepartmentId"].Value), Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["ProduserId"].Value), Convert.ToInt32(dataGridViewProducts.Rows[index].Cells["Quantity"].Value), Convert.ToBoolean(dataGridViewProducts.Rows[index].Cells["CriticalQ"].Value)); SetProduct(product); }