private void update_stocks() { stocks = new classes.Inventory_Stocks(); stocks.quantity = Convert.ToInt32(txtNewStock.Text); stocks.unit_of_measurement = cbUnit.Text; if (stocks.create_stocks()) { if (stocks.update_stock(productinformation_id)) { MessageBox.Show("Stocks has been updated!", "Update Stocks", MessageBoxButtons.OK, MessageBoxIcon.Question); frmViewItem.instance.display_selected_inventory(inventory_id); this.Close(); } } else { return; } }
private void btnSave_Click(object sender, EventArgs e) { //MessageBox.Show(quantity.ToString() + " " + unit_of_measurement); classes.Inventory_Stocks stocks = new classes.Inventory_Stocks(); stocks.quantity = quantity; stocks.unit_of_measurement = unit_of_measurement; if (stocks.create_stocks()) { if (hasCapacity == true) { classes.Inventory_Capacity cp = new classes.Inventory_Capacity(); cp.capacity = capacity; cp.capacity_size = capacity_size; cp.create_capacity(); } classes.Inventory_ProductInformation pi = new classes.Inventory_ProductInformation(); pi.inventory_type = inventory_type; pi.item_name = item_name; pi.description = description; pi.brand = brand; pi.model = model; pi.serial_number = serial_number; pi.hasCapacity = hasCapacity; pi.expire_at = date_expired; if (pi.create_product_information()) { classes.Inventory inv = new classes.Inventory(); inv.category_id = category_id; inv.category_name = category_name; inv.supplier_id = supplier_id; inv.supplier_name = supplier_name; inv.property_number = property_number; inv.department_id = department_id; inv.department_name = department_name; inv.status = status; inv.date_acquired = date_acquired; if (inv.create_inventory()) { MessageBox.Show(item_name + " has been added", "Inventory", MessageBoxButtons.OK, MessageBoxIcon.Information); admin.inv.ucInventory.instance.display_inventory_data(); ((Form)this.TopLevelControl).Close(); } else { return; } } else { return; } } else { return; } }