Example #1
0
        void BtScheduleGuardarClick(object sender, EventArgs e)
        {
            var reporte = GetReportType();
            var empresa = GetEmpresa();
            var linea   = GetLinea();

            var prog = new ProgramacionReporte
            {
                ReportName  = SendReportTextBoxReportName.Text,
                Report      = reporte,
                Periodicity = CbSchedulePeriodicidad.SelectedValue[0],
                Mail        = TxtScheduleMail.Text,
                Empresa     = empresa ?? linea.Empresa,
                Created     = DateTime.Now,
                Description = GetDescription(reporte + " " + CbSchedulePeriodicidad.SelectedValue),
                Active      = false,
                Format      = RadioButtonHtml.Checked
                            ? ProgramacionReporte.FormatoReporte.Html
                            : ProgramacionReporte.FormatoReporte.Excel
            };

            prog.AddParameterList(GetVehicleList(), ParameterType.Vehicle);
            prog.AddParameterList(GetDriverList(), ParameterType.Driver);
            prog.AddParameterList(GetMessageTypeList(), ParameterType.Message);

            DAOFactory.ProgramacionReporteDAO.Save(prog);

            ModalSchedule.Hide();

            SendConfirmationMail(reporte, prog.Description);
        }
Example #2
0
        protected void BtScheduleGuardarClick(object sender, EventArgs e)
        {
            var reporte = ProgramacionReporte.Reportes.VerificadorVehiculos;
            var empresa = GetEmpresa();
            var linea   = GetLinea();

            var prog = new ProgramacionReporte
            {
                ReportName  = SendReportTextBoxReportName.Text,
                Report      = reporte,
                Periodicity = CbSchedulePeriodicidad.SelectedValue[0],
                Mail        = TxtScheduleMail.Text,
                Empresa     = empresa ?? linea.Empresa,
                Created     = DateTime.Now,
                Description = GetDescription(reporte + " " + CbSchedulePeriodicidad.SelectedValue),
                Active      = false,
                Format      = RadioButtonHtml.Checked
                                ? ProgramacionReporte.FormatoReporte.Html
                                : ProgramacionReporte.FormatoReporte.Excel
            };

            prog.AddParameterList(ddlCostCenter.SelectedValues, ParameterType.CostCenter);
            prog.AddParameterList(ddlTransportista.SelectedValues, ParameterType.Carrier);
            prog.AddParameterList(ddlTipoVehiculo.SelectedValues, ParameterType.VehicleType);

            DAOFactory.ProgramacionReporteDAO.Save(prog);

            ModalSchedule.Hide();
            SendConfirmationMail(reporte, prog.Description);
        }
Example #3
0
        private void SendVerificadorVehiculosHtmlReport(ProgramacionReporte programacion, int activos, int inactivos)
        {
            var configFile = Config.Mailing.VerificadorVehiculosMailingConfiguration;

            if (string.IsNullOrEmpty(configFile))
            {
                throw new Exception("No pudo cargarse configuraciĆ³n de mailing");
            }

            var sender = new MailSender(configFile);

            var parametros = new List <string> {
                programacion.ReportName, activos.ToString("#0"), inactivos.ToString("#0")
            };

            SendMailToAllDestinations(sender, parametros, programacion.Mail);
        }
Example #4
0
        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;
            }
        }
Example #5
0
        public ProgramacionReporteVo(ProgramacionReporte progReporte)
        {
            switch (progReporte.Periodicity)
            {
            case 'D': Periodicidad = CultureManager.GetLabel("DIARIO"); break;

            case 'S': Periodicidad = CultureManager.GetLabel("SEMANAL"); break;

            case 'M': Periodicidad = CultureManager.GetLabel("MENSUAL"); break;
            }
            switch (progReporte.Format)
            {
            case ProgramacionReporte.FormatoReporte.Excel: Formato = "Excel Completo"; break;

            case ProgramacionReporte.FormatoReporte.Html: Formato = "Email Resumido"; break;

            default: Formato = "Ninguno"; break;
            }
            Id         = progReporte.Id;
            Reporte    = CultureManager.GetLabel(progReporte.Report);
            ReportName = progReporte.ReportName;
            Mail       = progReporte.Mail;
            Estado     = progReporte.Active ? CultureManager.GetLabel("ACTIVE") : CultureManager.GetLabel("INACTIVE");
        }
Example #6
0
        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);
            }
        }