public static IEnumerable <ReportComplaintRow> GetComplaintsExcelFileRows(ReportComplaintModel complaintModel, ReportType reportType) { var isBroker = EnumHelper.Parent <ReportType, ReportGroup>(reportType) == ReportGroup.BrokerReport; NullCheckHelper.ArgumentCheckNull(complaintModel, nameof(GetComplaintsExcelFileRows), nameof(StatisticsService)); return(complaintModel.Complaints .Select(c => new ReportComplaintRow { OrderNumber = c.OrderNumber, ReportDate = c.ReportDate, BrokerName = c.BrokerName, Language = c.Language, Region = c.Region, Status = c.ComplaintStatus.GetDescription(), InterpreterId = c.InterpreterId, AssignmentDate = c.AssignmentDate, CustomerName = c.CustomerName, AssignmentType = c.AssignmentType.GetDescription(), InterpreterCompetenceLevel = (CompetenceAndSpecialistLevel?)c.CompetenceLevel ?? CompetenceAndSpecialistLevel.NoInterpreter, ComplaintType = c.ComplaintType.GetDescription(), CustomerUnitName = c.CustomerUnitName, ReportPersonToDisplay = c.ReportPerson, Department = c.Department, ReferenceNumber = c.ReferenceNumber, InterpreterLocation = c.InterpreterLocation.HasValue ? ((InterpreterLocation)c.InterpreterLocation.Value).GetDescription() : string.Empty, AllowExceedingTravelCost = c.AllowExceedingTravelCost.HasValue ? isBroker ? EnumHelper.Parent <AllowExceedingTravelCost, TrueFalse>(c.AllowExceedingTravelCost.Value).GetDescription() : c.AllowExceedingTravelCost.Value.GetDescription() : string.Empty }).ToList().OrderBy(row => row.OrderNumber)); }
public ReportComplaintModel GetComplaints(DateTimeOffset start, DateTimeOffset end, int?organisationId, IEnumerable <int> localAdminCustomerUnits = null, int?brokerId = null) { var complaints = _dbContext.Complaints.GetComplaintsForReports(start.Date, end.Date, organisationId, localAdminCustomerUnits, brokerId); return(ReportComplaintModel.GetModelFromComplaints(complaints, brokerId.HasValue)); }