コード例 #1
0
        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;
            }
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        public void EditEmployee()
        {
            var editEmployee = new EditEmployeeView();

            editEmployee.DataContext = new EditEmployeeViewModel(SelectedEmployee.Id)
            {
                CloseAction = ((EditEmployeeViewModel)editEmployee.DataContext).CloseAction
            };
            editEmployee.ShowDialog();
            _context = new BakeshopContext();
            LoadEmployees();
        }
コード例 #4
0
 /// <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());
     }
 }
コード例 #5
0
 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());
     }
 }
コード例 #6
0
 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
     };
 }
コード例 #7
0
 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
     };
 }
コード例 #8
0
 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
     };
 }