using System; using System.Collections.Generic; using System.Linq; using BeWo.Data.Access; using BeWo.Data.Entities; using BeWo.Data.ICD10; using BeWo.Service.DCEntityMapper; using BS.Shared; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; namespace BeWo.Report.ReportObjects { public class EmployeeCustomerListRO : AbstractBeWoReportObject { public EmployeeDC Employee { get; set; } public IList CustomerList { get; set; } public static EmployeeCustomerListRO Create(long? employeeOid) { var emp = DAOFactory.GenericDAO.LoadByID(employeeOid.Value); var empDc = MapperFactory.EmployeeDC_Employee.MapToNewDC(emp); var result = new EmployeeCustomerListRO(); result.Employee = empDc; result.CustomerList = new List(); foreach (var e2c in emp.Employee2CustomerList) { if (e2c.Customer.IsActive == ActivationTypeId.Active) { Employee2CustomerDetail e2cDetail = new Employee2CustomerDetail(); e2cDetail.Notiz = e2c.Notice; foreach (var v2o in e2c.ValueList) { if (v2o.Entry.Type == ValueListEntryType.StaffRoleType) { e2cDetail.Rolle = v2o.Entry.Value; } } e2cDetail.Customer = MapperFactory.CompactCustomerDC_Customer.MapToNewDC(e2c.Customer); result.CustomerList.Add(e2cDetail); } } //result.Notice = pDC.Notice; result.CustomerList = result.CustomerList.OrderBy(c => c.Customer.LastNameFirstName).ToList(); return result; } } public class Employee2CustomerDetail { public String Rolle { get; set; } public String Notiz { get; set; } public CompactCustomerDC Customer { get; set; } } }