/// <summary> /// button to edit customer and saves changes to db /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void editCustomerButton_Click(object sender, EventArgs e) { CreateCustomer window = new CreateCustomer(); window.createCustomerButtonOK.Text = "Gem"; window.cprBox.Enabled = false; var test = ListViewBox.SelectedItems; window.cprBox.Text = test[0].SubItems[0].Text; window.firstNameBox.Text = test[0].SubItems[1].Text; window.LastNameBox.Text = test[0].SubItems[2].Text; foreach (var s in _controller.GetCustomers()) { if (test[0].SubItems[0].Text.Equals(s.CS_CPRNO)) { window.adressBox.Text = s.CS_ADRESS1; window.phoneBox.Text = s.CS_PHONEMOBILE; window.emailBox.Text = s.CS_EMAIL; } } window.ShowDialog(); if (window.createCustomerButtonOK.DialogResult == DialogResult.OK) { ListViewBox.Items.Clear(); FillInView(); } }
/// <summary> /// opens the CreateCustomer view to create a new customer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void createCustomerButton_Click(object sender, EventArgs e) { //opret ikke eksisterende kunde CreateCustomer window = new CreateCustomer(); window.createCustomerButtonOK.Text = "Opret"; //window.ShowDialog(); if (window.ShowDialog() == DialogResult.OK) { ListViewBox.Items.Clear(); FillInView(); window.Close(); } }