//List<Category> categories; public AdminForm() { workerPresenter = new WorkerPresenter(); categoryPresenter = new CategoriesPresenter(); carsPresenter = new CarsPresenter(); InitializeComponent(); workerCounter = int.Parse(workerPresenter.getAmountOfUsers()); fillWorkerListBox(workerCounter); }
private void buttonAddWorker_Click(object sender, EventArgs e) { string name = textBoxAddWorkerName.Text; string surname = textBoxAddWorkerSurname.Text; string login = textBoxAddWorkerLogin.Text; string password = textBoxAddWorkerPassword.Text; int newID; bool isAdmin = checkBoxIsAdmin.Checked; // нужно добавить на форму штуку if (textBoxAddWorkerName.Text == "" || textBoxAddWorkerSurname.Text == "" || textBoxAddWorkerLogin.Text == "" || textBoxAddWorkerPassword.Text == "") { MessageBox.Show("Fill all fields!"); } else { if (workerPresenter.addWorker(name, surname, login, password, isAdmin) == false) { MessageBox.Show("Worker is not created!"); } else { MessageBox.Show("Worker is created!"); workerCounter++; newID = int.Parse(workerPresenter.getAmountOfUsers()) - 1; listBox1.Items.Insert(workerCounter - 1, newID + " " + textBoxAddWorkerName.Text + " " + textBoxAddWorkerSurname.Text); textBoxAddWorkerName.Clear(); textBoxAddWorkerSurname.Clear(); textBoxAddWorkerLogin.Clear(); textBoxAddWorkerPassword.Clear(); } } //listBox1.Items.Insert(0, name + " " + surname); }