using System; using System.Collections.Generic; using System.IO; using System.Linq; using BeWo.Data; using BeWo.Data.Access; using BeWo.Data.Entities; using BeWo.Service.Core; using BeWo.Service.DCEntityMapper; using BeWo.Service.MessageContracts; using BS.Shared; using BS.Shared.Core; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; using BS.Shared.Extensions; using BS.Shared.Services; using Utils = BeWo.Service.Core.Utils; namespace BeWo.Service.Plugins { public class EmployeeService : AbstractIDSpecificDefaultClass { public virtual long InsertNewEmployee(EmployeeDC pEmployeeDC) { Employee lEmployee = MapperFactory.EmployeeDC_Employee.MapToNewEntity(pEmployeeDC); DAOFactory.GenericDAO.Insert(lEmployee); return lEmployee.Oid.Value; } public virtual List GetAllActiveEmployeesCompact() { return MapperFactory.CompactEmployeeDC_Employee.MapToNewDCs(DAOFactory.GenericDAO.GetAllActive()); } public virtual List GetAllActiveAndArchivedEmployeesCompact() { return MapperFactory.CompactEmployeeDC_Employee.MapToNewDCs(DAOFactory.GenericDAO.GetAllActiveAndArchived()); } public virtual List GetAllTeamsCompact() { if (Utils.UserHasRight(LoggedInUserOperationContextExt.Current.User, UserRightType.TeamView_ViewAll)) { return MapperFactory.CompactTeamDC_Team.MapToNewDCs(DAOFactory.GenericDAO.GetAllActive()); } if (Utils.UserHasRight(LoggedInUserOperationContextExt.Current.User, UserRightType.TeamView_ViewMyTeams)) { var teams = DAOFactory.SearchDAO.FindAllActiveTeamsOfEmployee(LoggedInUserOperationContextExt.Current.User.Employee.Oid.Value); return MapperFactory.CompactTeamDC_Team.MapToNewDCs(teams); } return new List(); } //Für Main Navigation View public virtual List GetAllCompactEmployees() { var employees = DAOFactory.GenericDAO.GetAll(); return MapperFactory.CompactEmployeeDC_Employee.MapToNewDCs(employees); } } }