private void EmployeeDetailsEditButtonClick(object sender, EventArgs e) { var selectedEmployee = SelectedItem as Employee; if (selectedEmployee == null) { return; } Close(); var employeeEditForm = new EmployeeEditForm(ProjectRepository, EmployeeRepository) { SelectedEmployee = selectedEmployee }; employeeEditForm.EditedEmployeeSetText(); employeeEditForm.RefreshList(); employeeEditForm.ShowDialog(); }
private void EditEmployeeClick(object sender, EventArgs e) { var selectedEmployee = employeesListBox.SelectedItem as Employee; if (selectedEmployee == null) { var errorForm = new ErrorForm("You must select employee to edit"); errorForm.ShowDialog(); return; } var employeeEditForm = new EmployeeEditForm(ProjectRepository, EmployeeRepository) { SelectedEmployee = selectedEmployee }; employeeEditForm.EditedEmployeeSetText(); employeeEditForm.RefreshList(); employeeEditForm.ShowDialog(); AddRefreshList(); }