Example #1
0
        public IHttpActionResult GenerarReporteAdministrarCursos([FromUri] CursoByFiltersCursoQuery query)
        {
            query.VieneParaExcel = 1;
            var queryResult = _queryDispatcher.Dispatch <CursoByFiltersCursoQuery, CursoByFiltersCursoQueryResult>(query);

            ReporteConfigDto _config = ReportesConfiguracion.GetReporteConfig(TiposReporte.AdministrarCursos.Value);

            byte[] bytes = ReportViewerUtil.GenerateReport(_config, queryResult.CursosDto, null);
            return(GenerateExcelFromReportViewer(bytes, _config.OutputFileName + "." + _config.Format));
        }
Example #2
0
        public IHttpActionResult ExportCertificadosCurso([FromUri] AsistenciaPersonalCursoQuery query)
        {
            List <PersonalAsistenciaDto> lista = new List <PersonalAsistenciaDto>();

            if (query.imprimirTodos)
            {
                AsistenciaPersonalCursoQueryResult queryResult = _queryDispatcher.Dispatch <AsistenciaPersonalCursoQuery, AsistenciaPersonalCursoQueryResult>(query);
                lista = queryResult.ListPersonal;
            }
            else
            {
                PersonalCertificadoQueryResult queryResult = _queryDispatcher.Dispatch <AsistenciaPersonalCursoQuery, PersonalCertificadoQueryResult>(query);
                lista = queryResult.ListPersonal;
            }
            CursoByIdQuery query2 = new CursoByIdQuery();

            query2.CursoId = query.CursoId;
            var queryResult2 = _queryDispatcher.Dispatch <CursoByIdQuery, CursoByIdQueryResult>(query2);

            DateTime fechaActual = DateTime.Now;
            string   nombreMes   = new DateTime(2015, fechaActual.Month, 1).ToString("MMMM", CultureInfo.CreateSpecificCulture("es"));

            nombreMes = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(nombreMes);
            string textoAgregado      = "";
            int    duracionTotalCurso = queryResult2.CursoDto.CantidadDias * (int)queryResult2.CursoDto.HorasPorDia;

            if (duracionTotalCurso > 0.0)
            {
                textoAgregado = "La capacitación tuvo una duración total de " + duracionTotalCurso + "hs. reloj y se llevó a cabo en el SUM de la Secretaría de Equidad y Promoción del Empleo.-";
            }
            else
            {
                textoAgregado = "La capacitación se llevó a cabo en el SUM de la Secretaría de Equidad y Promoción del Empleo.-";
            }

            List <ReportParameter> parametros = new List <ReportParameter>();

            parametros.Add(new ReportParameter("NombreCurso", queryResult2.CursoDto.NombreCurso));
            parametros.Add(new ReportParameter("Dia", fechaActual.Day.ToString()));
            parametros.Add(new ReportParameter("Mes", nombreMes));
            parametros.Add(new ReportParameter("Anio", fechaActual.Year.ToString()));
            parametros.Add(new ReportParameter("TextoAgregado", textoAgregado));

            ReporteConfigDto _config = ReportesConfiguracion.GetReporteConfig(TiposReporte.CertificadosPorCurso.Value);

            byte[] bytes = ReportViewerUtil.GenerateReport(_config, lista, parametros);
            return(Ok(bytes));
        }
Example #3
0
        public IHttpActionResult ExportListadoInscriptos([FromUri] ClaseByCursoQuery query)
        {
            var            queryResult = _queryDispatcher.Dispatch <ClaseByCursoQuery, ListadoInscriptosQueryResult>(query);
            CursoByIdQuery queryCurso  = new CursoByIdQuery();

            queryCurso.CursoId = query.CursoId;
            var queryResult2 = _queryDispatcher.Dispatch <CursoByIdQuery, CursoByIdQueryResult>(queryCurso);

            List <ReportParameter> parametros = new List <ReportParameter>();

            parametros.Add(new ReportParameter("NombreCurso", queryResult2.CursoDto.NombreCurso));
            ReporteConfigDto _config = ReportesConfiguracion.GetReporteConfig(TiposReporte.ListadoInscriptosCursos.Value);

            byte[] bytes = ReportViewerUtil.GenerateReport(_config, queryResult.ListPersonal, parametros);
            return(Ok(bytes));
        }
Example #4
0
        public IHttpActionResult GenerarReporteAsistenciaPorCusro([FromUri] AsistenciaPersonalCursoQuery query)
        {
            var queryResult = _queryDispatcher.Dispatch <AsistenciaPersonalCursoQuery, AsistenciaPersonalCursoQueryResult>(query);

            CursoByIdQuery cursoQuery = new CursoByIdQuery();

            cursoQuery.CursoId = query.CursoId;
            var queryResult2 = _queryDispatcher.Dispatch <CursoByIdQuery, CursoByIdQueryResult>(cursoQuery);

            List <ReportParameter> parametros = new List <ReportParameter>();

            parametros.Add(new ReportParameter("NombreCurso", queryResult2.CursoDto.NombreCurso));
            ReporteConfigDto _config = ReportesConfiguracion.GetReporteConfig(TiposReporte.AsistenciaPorCurso.Value);

            byte[] bytes = ReportViewerUtil.GenerateReport(_config, queryResult.ListPersonal, parametros);
            return(GenerateExcelFromReportViewer(bytes, _config.OutputFileName + queryResult2.CursoDto.NombreCurso + "." + _config.Format));
        }
Example #5
0
        private void GenerarReporteAsync(ReportesPendientesDto _reportesPendientesDto, ReporteConfigDto _config)
        {
            String _nombreArchivo = String.Empty;

            //Se anexa a loa parámetros el id de proceso y luego se obtiene un array de todos los parámetros.
            String _params = _reportesPendientesDto.StringProcedimiento + "," + _reportesPendientesDto.ProcesoId;

            ParametrosSeparados = _params.Split(',');

            Boolean _ok  = false;
            object  _dto = null;

            try
            {
                _reportesPendientesDto.NombreProceso = _reportesPendientesDto.NombreProceso.ToUpper();
                _repositoryLocalScheme = new RepositoryLocalScheme();

                //3)Se llama al procedimiento correspondiente al reporte asociado al proceso.

                //Madres beneficiarios
                if (_reportesPendientesDto.NombreProceso.Equals(TiposReporte.MadresBeneficiarios.Value.ToUpper()))
                {
                    _dto = GenerarReporteMadresBeneficiarios <MadresBeneficiariosDto>(_config);
                }
                //Socio ambiental
                else if (_reportesPendientesDto.NombreProceso.Equals(TiposReporte.SocioAmbiental.Value.ToUpper()))
                {
                    _dto = GenerarReporteSocioAmbiental <SocioAmbientalDto>(_config);
                }

                //Info Global
                else if (_reportesPendientesDto.NombreProceso.Equals(TiposReporte.InfoGlobal.Value.ToUpper()))
                {
                    _dto = GenerarReporteInfoGloabal <InfoGlobalDto>(_config);
                }

                //GrupoFamiliar
                else if (_reportesPendientesDto.NombreProceso.Equals(TiposReporte.GrupoFamiliar.Value.ToUpper()))
                {
                    _dto = GenerarReporteGrupoFamiliar <GrupoFamiliarDto>(_config);
                }

                //Personal por sala
                else if (_reportesPendientesDto.NombreProceso.Equals(TiposReporte.PersonalPorSala.Value.ToUpper()))
                {
                    _dto = GenerarReportePersonalPorSala <PersonalPorSalaDto>(_config);
                }

                //Producto por Sala
                else if (_reportesPendientesDto.NombreProceso.Equals(TiposReporte.ProductoPorSala.Value.ToUpper()))
                {
                    _dto = GenerarReporteProductorPorSala <ProductosPorSalaDto>(_config);
                }

                //Productor por familia PDF
                else if (_reportesPendientesDto.NombreProceso.Equals(TiposReporte.ProductoPorFamiliaPDF.Value.ToUpper()))
                {
                    _dto = GenerarReporteProductorPorFamiliaPDF <ProductoXFamiliaXSalaDto>(_config);
                }

                //Productor por familia EXCEL
                else if (_reportesPendientesDto.NombreProceso.Equals(TiposReporte.ProductoPorFamiliaExcel.Value.ToUpper()))
                {
                    _dto = GenerarReporteProductorPorFamiliaExcel <ProductoXFamiliaXSalaDto>(_config);
                }

                //Provision de producto
                else if (_reportesPendientesDto.NombreProceso.Equals(TiposReporte.ProvisionDeProducto.Value.ToUpper()))
                {
                    _dto = GenerarReporteProvisionDeProducto <ProvisionProductosReporteDto>(_config);
                }

                //Provision de producto especiales
                else if (_reportesPendientesDto.NombreProceso.Equals(TiposReporte.ProvisionDeProductoCE.Value.ToUpper()))
                {
                    _dto = GenerarReporteProvisionDeProductoCE <ProvisionProductosReporteDto>(_config);
                }

                //Salas cuna
                else if (_reportesPendientesDto.NombreProceso.Equals(TiposReporte.SalasCuna.Value.ToUpper()))
                {
                    _dto = GenerarReporteSalasCuna(_config);
                }

                //Beneficiario
                else if (_reportesPendientesDto.NombreProceso.Equals(TiposReporte.Beneficiario.Value.ToUpper()))
                {
                    _dto = GenerarReporteBeneficiario <BeneficiarioReporteDto>(_config);
                }

                if (_dto != null)
                {
                    List <ReportParameter> _reportParams = DeterminarParametros(_reportesPendientesDto);

                    //4)Creo el reporte en disco
                    ReportViewerUtil.GenerateAndPersist(_config, ref _nombreArchivo, _dto, _reportParams);
                    _ok = true;
                }
            }
            catch (Exception e)
            {
                Console.Write(e);
            }
            finally
            {
                FinalizarProceso(_reportesPendientesDto.ProcesoId, _ok);
                EnviarMail(_reportesPendientesDto.Cuil, _ok, _nombreArchivo, _params, _config.AsuntoEmail);
            }
        }
Example #6
0
        public IHttpActionResult GenerarReporteBeneficiarios([FromUri] BeneficiarioReporteQuery query)
        {
            if (query.SalaCunaId != null || !String.IsNullOrEmpty(query.Codigo))
            {
                BeneficiarioReporteQueryResult queryResult = _queryDispatcher.Dispatch <BeneficiarioReporteQuery, BeneficiarioReporteQueryResult>(query);
                ReportDataSource dsBeneficiario            = new ReportDataSource("DSBeneficiario", queryResult.Beneficiarios);
                //String _params = JsonHelper.GetJsonStringFromObject(queryResult);

                Boolean          _ok            = false;
                String           _nombreArchivo = String.Empty;
                ReporteConfigDto _config        = ReportesConfiguracion.GetReporteConfig(TiposReporte.Beneficiario.Value);
                try
                {
                    byte[] bytes = ReportViewerUtil.GenerateAndPersist(_config, ref _nombreArchivo, queryResult.Beneficiarios, null);
                    GenerateExcelFromReportViewer(bytes, _config.OutputFileName + "." + _config.Format);
                    _ok = true;
                }
                catch (Exception e) {
                    Console.Write(e);
                }
                finally{
                    EnviarMail(GetUsuarioLogueado().Cuil.ToString(), _ok, _nombreArchivo, "", _config.AsuntoEmail);
                }
            }
            else
            {
                StringBuilder builder   = new StringBuilder();
                long          tickDesde = (query.FechaDesde != null ? query.FechaDesde.Value : DateTimeHelper.GetMinDateTimeNullable(query.FechaDesde)).Ticks;
                builder.Append(tickDesde);
                builder.Append(",");
                long tickHasta = (query.FechaHasta == null && query.FechaDesde != null ? DateTime.Today : DateTimeHelper.GetMinDateTimeNullable(query.FechaHasta)).Ticks;
                builder.Append(tickHasta);
                builder.Append(",");
                builder.Append(query.PersonaJuridicaId != null ? query.PersonaJuridicaId.Value : -1);
                builder.Append(",");
                builder.Append(query.SalaCunaId != null ? query.SalaCunaId.Value : -1);
                builder.Append(",");
                builder.Append(query.Codigo);
                builder.Append(",");
                builder.Append(query.NroDocumento);
                builder.Append(",");
                builder.Append(query.DadosBaja ? 'S' : 'N');
                builder.Append(",");
                builder.Append(query.DepartamentoId != null ? query.DepartamentoId.Value : -1);
                builder.Append(",");
                builder.Append(query.LocalidadId != null ? query.LocalidadId.Value : -1);
                builder.Append(",");
                builder.Append(query.BarrioId != null ? query.BarrioId.Value : -1);
                builder.Append(",");
                builder.Append(query.SituacionCritica);
                builder.Append(",");
                builder.Append(query.TipoBeneficiario != null ? query.TipoBeneficiario : "0");
                builder.Append(",");
                builder.Append(query.TipoDocumentoId);
                builder.Append(",");
                builder.Append(query.PageNumber != null ? query.PaginationFrom.Value : 0);
                builder.Append(",");
                builder.Append(query.PageNumber != null ? query.PaginationTo.Value : 10000);

                ActualizarReporteCommand command = new ActualizarReporteCommand();
                command.IdEstado      = (int)EstadoReporteEnum.Pendiente;
                command.StringProceso = builder.ToString();
                command.IdUsuario     = GetUsuarioLogueado().Id;
                command.NombreProceso = TiposReporte.Beneficiario.Value;
                _commandDispatcher.Dispatch <ActualizarReporteCommand>(command);
            }

            var respuesta = new { mensaje = _mensaje + GetEmailUsuarioLogueado() };

            return(Ok(respuesta));
        }