private void GenerateHtmlReport(ProgramacionReporte prog) { switch (prog.Report) { case ProgramacionReporte.Reportes.ReporteEventos: var vehiclesId = prog.GetParameters(ParameterType.Vehicle); //prog.Vehicles.Split(',').Select(v => Convert.ToInt32(v)).ToList(); var tiposMensajeId = prog.GetParameters(ParameterType.Message); //prog.MessageTypes.Split(',').Select(m => Convert.ToInt32(m)); var driversId = prog.GetParameters(ParameterType.Driver); //prog.Drivers.Split(',').Select(d => Convert.ToInt32(d)).ToList(); var fin = GetFinalDate(); var inicio = GetInitialDate(prog.Periodicity); var results = ReportFactory.MobileEventDAO.GetMobilesEvents(vehiclesId, tiposMensajeId, driversId, inicio, fin, 3); break; case ProgramacionReporte.Reportes.VerificadorVehiculos: var mobiles = DaoFactory.CocheDAO.GetList(new[] { prog.Empresa.Id }, new[] { prog.Linea != null ? prog.Linea.Id : 0 }, new[] { -1 }, // TipoVehiculo new[] { -1 }, // Transportista new[] { -1 }, // DEPARTAMENTOS new[] { -1 }, // CostCenter new[] { -1 }, // SUB CENTROS DE COSTO true, // DispositivosAsignados, false // SoloConGarmin ); var lastPositions = ReportFactory.MobilePositionDAO.GetMobilesLastPosition(mobiles); var activos = lastPositions.Count(p => p.EstadoReporte <= 2); var inactivos = lastPositions.Count(p => p.EstadoReporte > 2); SendVerificadorVehiculosHtmlReport(prog, activos, inactivos); break; default: break; } }
private IReportCommand GenerateReportCommand(ProgramacionReporte prog) { var idLinea = prog.Linea != null ? prog.Linea.Id : -1; switch (prog.Report) { case ProgramacionReporte.Reportes.ReporteEventos: return(ReportService.CreateEventReportCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, prog.GetParameters(ParameterType.Vehicle), GetFinalDate(), GetInitialDate(prog.Periodicity), prog.GetParameters(ParameterType.Message), prog.GetParameters(ParameterType.Vehicle))); case ProgramacionReporte.Reportes.KilometrosAcumulados: return(ReportService.CreateAccumulatedKilometersReportCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, GetFinalDate(), GetInitialDate(prog.Periodicity), prog.GetParameters(ParameterType.Vehicle))); case ProgramacionReporte.Reportes.ActividadVehicular: return(ReportService.CreateVehicleActivityReportCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, GetFinalDate(), GetInitialDate(prog.Periodicity), prog.GetParameters(ParameterType.Vehicle))); case ProgramacionReporte.Reportes.InfraccionesVehiculo: return(ReportService.CreateVehicleInfractionsReportCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, GetFinalDate(), GetInitialDate(prog.Periodicity), prog.GetParameters(ParameterType.Vehicle))); case ProgramacionReporte.Reportes.InfraccionesConductor: return(ReportService.CreateDriversInfractionsReportCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, GetFinalDate(), GetInitialDate(prog.Periodicity), prog.GetParameters(ParameterType.Driver), prog.Format)); case ProgramacionReporte.Reportes.EventosGeocercas: return(ReportService.CreateGeofenceEventsReportCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, GetFinalDate(), GetInitialDate(prog.Periodicity), prog.GetParameters(ParameterType.Vehicle), prog.GetParameters(ParameterType.Geofence), prog.Format)); case ProgramacionReporte.Reportes.TiempoAcumulado: return(ReportService.CreateMobilesTimeReportCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, GetFinalDate(), GetInitialDate(prog.Periodicity), prog.GetParameters(ParameterType.Vehicle))); case ProgramacionReporte.Reportes.VencimientoDocumentos: return(ReportService.CreateDocumentExpirationReportCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, GetFinalDate(), GetInitialDate(prog.Periodicity), prog.GetParameters(ParameterType.Document), prog.Format)); case ProgramacionReporte.Reportes.ReporteOdometros: return(ReportService.CreateOdometerReportCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, GetFinalDate(), GetInitialDate(prog.Periodicity), prog.GetParameters(ParameterType.Odometer), prog.GetParameters(ParameterType.Vehicle), prog.Format)); case ProgramacionReporte.Reportes.EstadoEntregas: return(ReportService.CreateDeliverStatusReportCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, GetFinalDate(), GetInitialDate(prog.Periodicity), prog.GetParameters(ParameterType.Vehicle))); case ProgramacionReporte.Reportes.TrasladosViaje: return(ReportService.CreateTransfersPerTripReportCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, GetFinalDate(), GetInitialDate(prog.Periodicity), prog.GetParameters(ParameterType.Vehicle))); case ProgramacionReporte.Reportes.ResumenRutas: return(ReportService.CreateSummaryRoutesReportCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, GetFinalDate(), GetInitialDate(prog.Periodicity), prog.GetParameters(ParameterType.Vehicle))); case ProgramacionReporte.Reportes.VerificadorVehiculos: return(ReportService.CreateVehicleVerifierCommand(prog.Id, prog.Empresa.Id, idLinea, prog.Mail, prog.GetParameters(ParameterType.Carrier), prog.GetParameters(ParameterType.CostCenter), prog.GetParameters(ParameterType.VehicleType))); case ProgramacionReporte.Reportes.EjecucionReportes: return(ReportService.CreateExecutionReportCommand()); default: return(null); } }