public static void AddCustomerToList(List <Customer> newCustomers, CheckedListBox clbCurrentCustomerList, int amountOfPersons, TextBox surname, TextBox lastName, ComboBox sex, NumericUpDown age, TextBox address, TextBox postalCode, TextBox mobileNr) { if (newCustomers.Count < amountOfPersons) { newCustomers.Add(NewCustomerListHandling.AddCustomerInfo(newCustomers, surname, lastName, sex, age, address, postalCode, mobileNr)); foreach (Customer customer in newCustomers) { if (customer.CustomerNr == newCustomers.Count()) { clbCurrentCustomerList.Items.Add(customer.Surname + " " + customer.Lastname); } } } else { MessageBox.Show("Max customers reached."); } }
private void deleteCustomer_Click(object sender, EventArgs e) { NewCustomerListHandling.DeleteCustomerFromNewList(clbCurrentCustomerList, NewCustomers); }
private void btnAddCustomer_Click(object sender, EventArgs e) { NewCustomerListHandling.AddCustomerToList(NewCustomers, clbCurrentCustomerList, amountOfPersons, tbSurname, tbLastName, comboBoxSex, nudAge, tbAddress, tbPostalCode, tbMobileNr); }