private void ButtonClick(object sender, EventArgs e) { string clickedButton = (sender as Button).Text; switch (clickedButton) { case "Add Employee": MVCForm.DisposeView(this.view); AddEmployee addEmployeeDashboard = new AddEmployee(); AddEmployeeView addEmployeeView = new AddEmployeeView(); AddEmployeeController addEmployeeController = new AddEmployeeController(addEmployeeDashboard, addEmployeeView, this.curForm); addEmployeeController.DisplayView(); DisplayNavigation(); break; case "Edit Employee": MVCForm.DisposeView(this.view); EditEmployee editEmployeeDashboard = new EditEmployee(); EditEmployeeView editEmployeeView = new EditEmployeeView(); EditEmployeeController editEmployeeController = new EditEmployeeController(editEmployeeDashboard, editEmployeeView, this.curForm); editEmployeeController.DisplayView(); DisplayNavigation(); break; case "Delete Employee": MVCForm.DisposeView(this.view); DeleteEmployee deleteEmployeeDashboard = new DeleteEmployee(); DeleteEmployeeView deleteEmployeeView = new DeleteEmployeeView(); DeleteEmployeeController deleteEmployeeController = new DeleteEmployeeController(deleteEmployeeDashboard, deleteEmployeeView, this.curForm); deleteEmployeeController.DisplayView(); DisplayNavigation(); break; } }
public EditEmployeeController(EditEmployee model, EditEmployeeView view, Form curForm) { db = new LINQDataContext(); this.model = model; this.view = view; this.curForm = curForm; this.view.ComboName.SelectedIndexChanged += (sender, e) => comboName_SelectedIndexChanged(sender, e); this.view.BtnEdit.Click += (sender, e) => btnEdit_Click(sender, e); }
public void EditEmployee() { var editEmployee = new EditEmployeeView(); editEmployee.DataContext = new EditEmployeeViewModel(SelectedEmployee.Id) { CloseAction = ((EditEmployeeViewModel)editEmployee.DataContext).CloseAction }; editEmployee.ShowDialog(); _context = new BakeshopContext(); LoadEmployees(); }
/// <summary> /// Edit employee execute /// </summary> public void EditEmployeeExecute() { try { EditEmployeeView editEmployeeView = new EditEmployeeView(Employee); editEmployeeView.ShowDialog(); EmployeeList = service.GetAllEmployees(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void EditEmployeeExecute() { try { EditEmployeeView editUser = new EditEmployeeView(Employee); editUser.ShowDialog(); //invokes method to update a list of users EmployeeList = employees.GetEmployees(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public EditEmployeeViewModel(EditEmployeeView editEmployeeView, vwEmployee employeeToEdit) { this.editEmployeeView = editEmployeeView; this.employee = employeeToEdit; //gets employee initial values before editing CheckIsEmployeeChanged = new vwEmployee { Name = employeeToEdit.Name, Surname = employeeToEdit.Surname, JMBG = employeeToEdit.JMBG, BankAccountNumber = employeeToEdit.BankAccountNumber, Email = employeeToEdit.Email, Salary = employeeToEdit.Salary, Position = employeeToEdit.Position, Username = employeeToEdit.Username, Password = employeeToEdit.Password }; }
public EditEmployeeViewModel(EditEmployeeView editEmployeeView, vwEmployee employeeToEdit) { this.editEmployeeView = editEmployeeView; Employee = employeeToEdit; Sector = employeeToEdit.SectorName; GenderList = genders.GetAllGenders(); LocationList = locations.GetAllLocations(); ManagerList = employees.GetAllManagers(employee); //gets user initial values before editing OldEmployee = new vwEmployee { NameAndSurname = employeeToEdit.NameAndSurname, NumberOfIdentityCard = employeeToEdit.NumberOfIdentityCard, PhoneNumber = employeeToEdit.PhoneNumber, JMBG = employeeToEdit.JMBG, Gender = employeeToEdit.Gender, Sector = employeeToEdit.Sector, SectorName = employeeToEdit.SectorName, Location = employeeToEdit.Location, Manager = employeeToEdit.Manager }; }
public EditEmployeeViewModel(EditEmployeeView editEmployeeViewOpen, vwEmployee employeeToEdit) { editEmployeeView = editEmployeeViewOpen; this.employee = employeeToEdit; sector = employeeToEdit.SectorName; GenderList = serviceEmployee.GetAllGender(); LocationList = serviceEmployee.GetAllLocations(); ManagerList = serviceEmployee.GetAllManagers(employee); //gets user initial values before editing CheckIsEmployeeChanged = new vwEmployee { Name = employeeToEdit.Name, Surname = employeeToEdit.Surname, NumberOfIdentityCard = employeeToEdit.NumberOfIdentityCard, PhoneNumber = employeeToEdit.PhoneNumber, JMBG = employeeToEdit.JMBG, Gender = employeeToEdit.Gender, Sector = employeeToEdit.Sector, SectorName = employeeToEdit.SectorName, Location = employeeToEdit.Location, Manager = employee.Manager }; }