예제 #1
0
        public void ExecuteSaveEmployeeCommand(Object obj)
        {
            //var selectedEmp = employeeAreaViewModel.SelectedEmployee;

            //selectedEmp.BusinessUnitId = employeeAreaViewModel.SelectedBusinessUnit;

            foreach (Employee emp in employeeAreaViewModel.Employees)
            {
                foreach (Employee front in employeeAreaViewModel.entryEmployees)
                {
                    if (emp.Id == front.Id)
                    {
                        var result = socket.ChangeEmployee(front, emp);
                        if (result == false)
                        {
                            MessageBox.Show("Fehler beim Ändern des Mitarbeiters!");
                        }
                    }
                }
            }

            //for (int i = 0; i < employeeAreaViewModel.Employees.Count; i++)
            //{
            //    if (employeeAreaViewModel.entryEmployees[i] != employeeAreaViewModel.Employees[i])
            //    {
            //        var result = socket.ChangeEmployee(employeeAreaViewModel.entryEmployees[i], employeeAreaViewModel.Employees[i]);
            //        if (result == false) MessageBox.Show("Fehler beim Ändern des Mitarbeiters!");
            //    }
            //}

            parent.restartEmployeeCommand();
        }
예제 #2
0
        public void ExecuteSaveEmployeeCommand(Object obj)
        {
            var result = socket.ChangeEmployee(employeeAreaViewModel.SelectedEmployee);

            if (result == false)
            {
                MessageBox.Show("Fehler beim Ändern des Mitarbeiters!");
            }

            parent.restartEmployeeCommand();
        }
예제 #3
0
        private void ExecuteSaveEmployeeCommand(Object obj)
        {
            if ((fleetManagementViewModel.ActiveViewModel as EmployeesViewModel).SelectedEmployee != null)
            {
                //If Lists are equaly long
                if ((fleetManagementViewModel.ActiveViewModel as EmployeesViewModel).Employees.Count == (fleetManagementViewModel.ActiveViewModel as EmployeesViewModel).entryEmployees.Count)
                {
                    //Change every Input
                    for (int i = 0; i < (fleetManagementViewModel.ActiveViewModel as EmployeesViewModel).Employees.Count; i++)
                    {
                        socket.ChangeEmployee((fleetManagementViewModel.ActiveViewModel as EmployeesViewModel).entryEmployees[i], (fleetManagementViewModel.ActiveViewModel as EmployeesViewModel).Employees[i]);
                    }

                    //Fetch Employees
                    fleetManagementViewModel.ActiveViewModel = new EmployeesViewController().Initialize();
                    (fleetManagementViewModel.ActiveViewModel as EmployeesViewModel).Employees     = new ObservableCollection <Employee>(socket.GetAllEmployees());
                    (fleetManagementViewModel.ActiveViewModel as EmployeesViewModel).BusinessUnits = socket.GetAllBusinessUnits().ToList();

                    //Persist Entry State Employees
                    (fleetManagementViewModel.ActiveViewModel as EmployeesViewModel).entryEmployees = (fleetManagementViewModel.ActiveViewModel as EmployeesViewModel).Employees.ToList();
                }
            }
        }