private void btnModify_Click(object sender, EventArgs e) { frmModifyCustomer modifyCustomerForm = new frmModifyCustomer(); modifyCustomerForm.addCustomer = false; modifyCustomerForm.customer = customer; DialogResult result = modifyCustomerForm.ShowDialog(); if (result == DialogResult.OK) { customer = modifyCustomerForm.customer; this.DisplayCustomer(); } else if (result == DialogResult.Retry) { this.GetCustomer(customer.CustomerId); if (customer != null) { this.DisplayCustomer(); } else { this.ClearControls(); } } }
private void btnAdd_Click(object sender, EventArgs e) { frmModifyCustomer addCustomerForm = new frmModifyCustomer(); addCustomerForm.addCustomer = true; DialogResult result = addCustomerForm.ShowDialog(); if (result == DialogResult.OK) { customer = addCustomerForm.customer; txtCustomerId.Text = customer.CustomerId.ToString(); this.DisplayCustomer(); } }