public NewEmployeeForm(NewEmployeeFormController controller) { InitializeComponent(); _controller = controller; yearComboBox.Items.AddRange(Enumerable.Range(1950, 50).Cast <object>().ToArray()); monthComboBox.Items.AddRange(Enumerable.Range(1, 12).Cast <object>().ToArray()); dayComboBox.Items.AddRange(Enumerable.Range(1, 30).Cast <object>().ToArray()); _controller.PropertyChanged += _controller_PropertyChanged; }
private void newEmployeeButton_Click(object sender, EventArgs e) { if (_controller.SelectedDepartment == null) { return; } var newEmployeeController = new NewEmployeeFormController(); var newEmployeeForm = new NewEmployeeForm(newEmployeeController); if (newEmployeeForm.ShowDialog() == DialogResult.OK) { var newEmployee = newEmployeeController.Employee; _controller.AddEmployee(newEmployee); } ShowEmployees(); }