/// <summary> /// Adds a new customer. /// </summary> private void addToolStripMenuItem_Click(object sender, EventArgs e) { using (var form = new FormCustomer()) { if (form.ShowDialog() == DialogResult.OK) { // Redisplay list of customers _customersPresenter.Display(); } } }
/// <summary> /// Edits an existing customer record. /// </summary> private void editToolStripMenuItem_Click(object sender, EventArgs e) { // Check if a node is selected (and not the root) if (treeViewCustomer.SelectedNode == null || treeViewCustomer.SelectedNode.Text == "Customers") { MessageBox.Show("No customer is currently selected", "Edit Customer", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } using (var form = new FormCustomer()) { var customer = treeViewCustomer.SelectedNode.Tag as CustomerModel; form.CustomerId = customer.CustomerId; if (form.ShowDialog() == DialogResult.OK) { // Redisplay list of customers _customersPresenter.Display(); } } }
/// <summary> /// Edits an existing customer record. /// </summary> private void editToolStripMenuItem_Click(object sender, EventArgs e) { // Check if a node is selected (and not the root) if (treeViewCustomer.SelectedNode == null || treeViewCustomer.SelectedNode.Text == "Customers") { MessageBox.Show("No customer is currently selected", "Edit Customer", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } using (FormCustomer form = new FormCustomer()) { CustomerModel customer = treeViewCustomer.SelectedNode.Tag as CustomerModel; form.CustomerId = customer.CustomerId; if (form.ShowDialog() == DialogResult.OK) { // Redisplay list of customers _customersPresenter.Display(); } } }
/// <summary> /// Adds a new customer. /// </summary> private void addToolStripMenuItem_Click(object sender, EventArgs e) { using (FormCustomer form = new FormCustomer()) { if (form.ShowDialog() == DialogResult.OK) { // Redisplay list of customers _customersPresenter.Display(); } } }