private void AddBtn_Click(object sender, EventArgs e) { purchaseOrderAddModifyForm addForm = new purchaseOrderAddModifyForm(); addForm.addPurchase = true; DialogResult result = addForm.ShowDialog(); if (result == DialogResult.OK) { purchaseOrder = addForm.purchaseOrder; purchaseOrderIDTextBox.Text = purchaseOrder.purchaseOrderID.ToString(); this.Display(); } }
private void EditBtn_Click(object sender, EventArgs e) { if (purchaseOrderIDTextBox.Text.Length == 0) { MessageBox.Show("Please select an order first."); return; } int purchaseOrderID = Convert.ToInt32(purchaseOrderIDTextBox.Text); this.GetPurchase(purchaseOrderID); purchaseOrderAddModifyForm modifyPurchase = new purchaseOrderAddModifyForm(); modifyPurchase.addPurchase = false; modifyPurchase.purchaseOrder = this.purchaseOrder; DialogResult result = modifyPurchase.ShowDialog(); if (result == DialogResult.OK) { purchaseOrder = modifyPurchase.purchaseOrder; this.Display(); } else if (result == DialogResult.Retry) { this.GetPurchase(purchaseOrder.purchaseOrderID); if (purchaseOrder != null) { this.Display(); } else { this.ClearControls(); } } }