using System; using System.Collections.Generic; using System.Linq; using System.Text; using BeWo.Data.Access; using BeWo.Data.Entities; using BeWo.Service.DCEntityMapper; using BS.Shared.Core; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; namespace BeWo.Service.Plugins { public class HomeContentGenerator : AbstractIDSpecificDefaultClass { public virtual IList GetHomeViewPanels() { return MapperFactory.HomeViewPanelDC_HomeViewPanel.MapToNewDCs( DAOFactory.GenericDAO.GetAllActive()); } public virtual List GetPersonsHavingBirthday(DateTime birthdayUntil) { return MapperFactory.CompactPersonDC_Person.MapToNewDCs( DAOFactory.SearchDAO.FindPersonsHavingBirthday(birthdayUntil)); } public virtual List GetExpiringSupportConcepts(long? employeeOid, DateTime expiredUntil) { var result = new List(); var list = DAOFactory.SearchDAO.FindExpiringSupportConcepts(employeeOid, DateTime.Now.Date, expiredUntil); var cs = new CustomerService(); foreach (var sc in list) { foreach (var c2s in sc.CostBearer2SupportConceptList) { var fsc = cs.CreateFlatSupportConcept(sc, c2s); if (fsc.EndDate.HasValue && fsc.EndDate.Value >= DateTime.Now.Date && fsc.EndDate.Value <= expiredUntil) { result.Add(fsc); } } } return result.OrderBy(s => s.EndDate).ToList(); } public virtual List GetTasksForEmployee(long employeeOid) { return MapperFactory.TaskDC_Task.MapToNewDCs(DAOFactory.SearchDAO.FindTasksForEmployee(employeeOid)); } public virtual List GetSupportConceptsWithConferenceDate(long? employeeOid, DateTime conferenceDateUntil) { return MapperFactory.CompactSupportConceptDC_SupportConcept.MapToNewDCs( DAOFactory.SearchDAO.FindSupportConceptsWithConferenceDate(employeeOid, conferenceDateUntil)); } } }