static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); f = new form(); Application.Run(f); }
private void btnSubmit_Click(object sender, EventArgs e) { if (list.Count == 0) { lbWarning.Text = "Empty Part"; } else { XuLy.addPurchaseOrder(1, int.Parse(cbbSuppliers.SelectedValue.ToString()), int.Parse(cbbWarehouse.SelectedValue.ToString()), dtpDate.Value, list); form f = new form(); f.Show(); Program.list = XuLy.getInventoryManagementView(); Program.f.viewInventoryTable(Program.list); lbWarning.Text = ""; this.Close(); } }
private void btnSubmit_Click(object sender, EventArgs e) { if (list.Count == 0) { lbWarning.Text = "Empty Part"; } else { if ((int)cbbSourceWarehouse.SelectedValue == (int)cbbDestinationWarehouse.SelectedValue) { lbWarning.Text = "Source and the Destination Warehouses can't be the same"; } else { bool validAmount = true; for (int i = 0; i < list.Count; i++) { float R = XuLy.getReceivedAmount((int)cbbSourceWarehouse.SelectedValue, (int)cbbPartName.SelectedValue, cbbBatchNumber.Enabled == true ? cbbBatchNumber.SelectedValue.ToString() : ""); float T = XuLy.getTransferredAmount((int)cbbSourceWarehouse.SelectedValue, (int)cbbPartName.SelectedValue, cbbBatchNumber.Enabled == true ? cbbBatchNumber.SelectedValue.ToString() : ""); if (R - T - list[i].Amount < 0) { MessageBox.Show("Max amount of " + list[i].PartName + " [" + list[i].BatchNumber + "]" + ": " + (R - T), ""); validAmount = false; viewDGV(); dgvWarehouseManagement.ClearSelection(); dgvWarehouseManagement.Rows[i].Selected = true; break; } } if (!validAmount) { } else { XuLy.addWarehouseManagement(2, (int)cbbSourceWarehouse.SelectedValue, (int)cbbDestinationWarehouse.SelectedValue, dtpDate.Value, list); form f = new form(); f.Show(); Program.list = XuLy.getInventoryManagementView(); Program.f.viewInventoryTable(Program.list); lbWarning.Text = ""; this.Close(); } } } }