private void CaptureStockInfo() { int Quantity = Convert.ToInt32(txtQuantity.Text); try { GetStockDetails stocks = new GetStockDetails(txtProductID.Text, txtProductName.Text, txtDescription.Text, txtSupplierID.Text, txtCategoryID.Text, Quantity, txtUnitPrice.Text); } catch (Exception) { MessageBox.Show("Some form fields are not filled, \nfill appropriately and try again.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void UpdateStockWithQuantityAfterSale() { int Quantity, saleQuantity; string prodname; int availQuantity = 0; foreach (ListViewItem Item in listViewPurchase.Items) { prodname = Item.SubItems[0].Text; saleQuantity = Convert.ToInt32(Item.SubItems[1].Text); DataTable stocktable; UpdateStock stockupdate = new UpdateStock(); stockupdate.Kwrd = prodname; stocktable = stockupdate.dTable(); foreach (DataRow row in stocktable.Rows) { availQuantity = Convert.ToInt32(row["Quantity"]); } Quantity = availQuantity - saleQuantity; //MessageBox.Show(Convert.ToString(Quantity)); GetStockDetails update = new GetStockDetails(prodname, Quantity); } }