示例#1
0
        LocationDto ConvertToLocationDto(tblLocation location)
        {
            LocationDto locationDto = new LocationDto();

            locationDto.Location = string.Format("{0} {1} {2} {3}", location.Street, location.Number,
                                                 location.City, location.Country);
            locationDto.ID = location.LocationID;

            return(locationDto);
        }
示例#2
0
        public EditEmployeeViewModel(EditEmployee editEmployeeOpen, EmployeeDto employeeEdit)
        {
            eventObject  = new EventClass();
            editEmployee = editEmployeeOpen;

            Employee = employeeEdit;

            selctedLocation = new LocationDto();

            StartDate = (DateTime)employee.DateOfBirth;
            Sector    = employee.SectorName;

            locationService = new LocationService();
            employeeService = new EmployeeService();

            sectorService = new SectorService();

            potentialManagersInDb = employeeService.GetAllPotentialMenagers();
            PotentialMenagers     = ConvertManagerListToDto(potentialManagersInDb);
            PotentialMenagers     = PotentialMenagers.Where(x => x.ID != Employee.EmployeeID).ToList();

            locations = locationService.GetAllLocations().ToList();

            tblLocation locataionForPresent = locationService.GetLocationByID((int)Employee.LocationID);

            tblEmployee managerToPresent = null;

            if (Employee.ManagerId != null)
            {
                managerToPresent = employeeService.GetEmployeeByID((int)Employee.ManagerId);
            }

            LocationList = ConvertLocationDtoList(locations);

            SelctedLocation = LocationList.Where(x => x.ID == locataionForPresent.LocationID).FirstOrDefault();
            LocationList.OrderByDescending(x => x.Location);
            LocationList.Reverse();

            //if (managerToPresent!=null)
            //{
            //    SelectedMenager = PotentialMenagers.Where(x=>x.ID==Employee.ManagerId).FirstOrDefault();
            //}



            eventObject.ActionPerformed += ActionPerformed;

            oldEmployee           = new EmployeeDto();
            oldEmployee.FirstName = employee.FirstName;
            oldEmployee.LastName  = employee.LastName;
            oldEmployee.JMBG      = employee.JMBG;
        }