Exemple #1
0
        public HttpResponseMessage GrabarReporteEditado(EDReporte Reporte)
        {
            try
            {
                LNReporte logica    = new LNReporte();
                var       resultado = logica.GuardarReporteEditado(Reporte);


                if (resultado != null)
                {
                    var response = Request.CreateResponse <EDReporte>(HttpStatusCode.Created, resultado);

                    return(response);
                }
                else
                {
                    var response = Request.CreateResponse(HttpStatusCode.ExpectationFailed);
                    return(response);
                }
            }
            catch (Exception ex)
            {
                var response = Request.CreateResponse(HttpStatusCode.InternalServerError);
                return(response);
            }
        }
Exemple #2
0
        public ActionResult VerReporte(EDReporte reporte)
        {
            var usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current);

            if (usuarioActual == null)
            {
                ViewBag.Mensaje = "El usuario no ha iniciado sesión el sistema";
                return(RedirectToAction("Login", "Home"));
            }
            //var fechaInicio = reporte.fechaInicio;
            reporte.nitEmpresa    = usuarioActual.NitEmpresa;
            ViewBag.sedes         = new SelectList(sedeServicio.SedesPorEmpresa(usuarioActual.IdEmpresa), "Pk_Id_Sede", "Nombre_Sede");
            ViewBag.FKTipoReporte = new SelectList(db.Tbl_Tipo_Reporte, "Pk_Id_Tipo_Reporte", "Descripcion_Tipo_Reporte");


            ServiceClient.EliminarParametros();
            var result = ServiceClient.RealizarPeticionesArrayPostJsonRest <EDReporte>(UrlServicioParticipacion, CapacidadVerReportesFiltrados, reporte);

            if (!reporte.CedulaQuienReporta.Equals("") || !reporte.FKTipoReporte.Equals("") || reporte.sedes != null || !(reporte.fechaFin.Year == 1))
            {
                resReporte = reporte;
            }
            if (result.Count() == 0)
            {
                ViewBag.MensajeError = "No se encontraron registros, que cumplan con la búsqueda";
            }

            return(View("VisualizarReporte", result.ToList()));
        }
Exemple #3
0
        public EDReporte generarEDReporte(int id)
        {
            var usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current);

            rep = new EDReporte();
            EDActividadesActosInseguros actividades = new EDActividadesActosInseguros();


            ServiceClient.EliminarParametros();
            ServiceClient.AdicionarParametro("id", id);
            // var result = ServiceClient.ObtenerObjetoJsonRestFul<EDReporte>(UrlServicioParticipacion, CapacidadDescargarPDFPorReporte, RestSharp.Method.GET);
            var reporte = ServiceClient.ObtenerArrayJsonRestFul <EDReporte>(UrlServicioParticipacion, CapacidadDescargarPDFPorReporte, RestSharp.Method.GET);

            ServiceClient.EliminarParametros();
            ServiceClient.AdicionarParametro("id", id);
            // var result = ServiceClient.ObtenerObjetoJsonRestFul<EDReporte>(UrlServicioParticipacion, CapacidadDescargarPDFPorReporte, RestSharp.Method.GET);
            var activi = ServiceClient.ObtenerArrayJsonRestFul <EDActividadesActosInseguros>(UrlServicioParticipacion, CapacidadObtenerActividadesEmpresa, RestSharp.Method.GET);
            List <EDActividadesActosInseguros> actividadesPlanAccion = activi.ToList();

            ServiceClient.EliminarParametros();
            ServiceClient.AdicionarParametro("id", id);
            // var result = ServiceClient.ObtenerObjetoJsonRestFul<EDReporte>(UrlServicioParticipacion, CapacidadDescargarPDFPorReporte, RestSharp.Method.GET);
            var imagenes = ServiceClient.ObtenerArrayJsonRestFul <EDImagenesReportes>(UrlServicioParticipacion, CapacidadObtenerImagenesEmpresa, RestSharp.Method.GET);


            List <EDImagenesReportes> imagenesPlanAccion = imagenes.ToList();

            foreach (var repor in reporte)
            {
                rep.nombreProceso      = repor.nombreProceso;
                rep.FKSede             = repor.FKSede;
                rep.FKTipoReporte      = repor.FKTipoReporte;
                rep.FK_Proceso         = repor.FK_Proceso;
                rep.IdReportes         = repor.IdReportes;
                rep.nitEmpresa         = repor.nitEmpresa;
                rep.tipo               = repor.tipo;
                rep.FechaOcurrencia    = repor.FechaOcurrencia;
                rep.AreaLugar          = repor.AreaLugar;
                rep.CausaReporte       = repor.CausaReporte;
                rep.SugerenciasReporte = repor.SugerenciasReporte;
                rep.CedulaQuienReporta = repor.CedulaQuienReporta;
                rep.NombreQuienReporta = repor.NombreQuienReporta;
                rep.RazonSocialEmpresa = repor.RazonSocialEmpresa;
                rep.fechaSistena       = repor.fechaSistena;
                rep.sede               = repor.sede;
                rep.nombreProceso      = repor.nombreProceso;
                rep.DescripcionReporte = repor.DescripcionReporte;
                rep.actividades        = actividadesPlanAccion;
                rep.imagenesReporte    = imagenesPlanAccion;
                rep.ConsecutivoReporte = repor.ConsecutivoReporte;
                rep.medioAcceso        = repor.medioAcceso;
            }
            return(rep);
        }
Exemple #4
0
        public ActionResult VisualizarReporte()
        {
            EDReporte reporte       = new EDReporte();
            var       usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current);

            if (usuarioActual == null)
            {
                ViewBag.Mensaje = "El usuario no ha iniciado sesión el sistema";
                return(RedirectToAction("Login", "Home"));
            }

            ViewBag.sedes         = new SelectList(sedeServicio.SedesPorEmpresa(usuarioActual.IdEmpresa), "Pk_Id_Sede", "Nombre_Sede");
            ViewBag.FKTipoReporte = new SelectList(db.Tbl_Tipo_Reporte, "Pk_Id_Tipo_Reporte", "Descripcion_Tipo_Reporte");

            reporte.CedulaQuienReporta = 1;


            var result = ServiceClient.RealizarPeticionesArrayPostJsonRest <EDReporte>(UrlServicioParticipacion, CapacidadVerReportesFiltrados, reporte);

            return(View(result.ToList()));
        }
Exemple #5
0
 public HttpResponseMessage ObtenerActividadesPorBusqueda(EDReporte reporte)
 {
     try
     {
         var logica = new LNReporte();
         var result = logica.ObtenerActividadesPorBusqueda(reporte);
         if (result != null)
         {
             var response = Request.CreateResponse(HttpStatusCode.OK, result);
             return(response);
         }
         else
         {
             var response = Request.CreateResponse(HttpStatusCode.ExpectationFailed);
             return(response);
         }
     }
     catch (Exception ex)
     {
         var response = Request.CreateResponse(HttpStatusCode.InternalServerError);
         return(response);
     }
 }
Exemple #6
0
        public FileResult DescargarReporteExcelCondiciones(EDReporte reporte)
        {
            reporte = resReporte;

            List <EDReporte> listaReportes = new List <EDReporte>();
            List <EDActividadesActosInseguros> listaActividades = new List <EDActividadesActosInseguros>();
            var usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current);


            ServiceClient.EliminarParametros();
            var resultReporte = ServiceClient.RealizarPeticionesArrayPostJsonRest <EDReporte>(UrlServicioParticipacion, CapacidadVerReportesFiltrados, reporte);

            listaReportes = resultReporte.ToList();
            ServiceClient.EliminarParametros();
            var resultActividades = ServiceClient.RealizarPeticionesArrayPostJsonRest <EDActividadesActosInseguros>(UrlServicioParticipacion, CapacidadVerActividadesFiltrados, reporte);

            listaActividades = resultActividades.ToList();
            var result = lnReporte.ObtenerReporteExcel(listaReportes, listaActividades);

            //ServiceClient.AdicionarParametro("rep", resultReporte.ToList());
            //var result = ServiceClient.ObtenerObjetoJsonRestFul<byte[]>(UrlServicioParticipacion, CapacidadDescargarExcelReportesCondicionesInseguras, RestSharp.Method.POST);

            return(File(result, "application/vnd.ms-excel", "ReporteDeCondicionesInseguras" + DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "") + ".xlsx"));
        }
Exemple #7
0
 public List <EDActividadesActosInseguros> ObtenerActividadesPorBusqueda(EDReporte reporte)
 {
     return(Reportes.ObtenerActividadesPorBusqueda(reporte));
 }
Exemple #8
0
 public List <EDReporte> ObteneReportesPorBusqueda(EDReporte reporte)
 {
     return(Reportes.ObteneReportesPorBusqueda(reporte));
 }
Exemple #9
0
 public EDReporte GuardarReporteEditado(EDReporte Reporte)
 {
     return(Reportes.GuardarReporteEditado(Reporte));
 }
Exemple #10
0
 public EDReporte GuardarReporte(EDReporte Reporte)
 {
     return(Reportes.GuardarReporte(Reporte));
 }
Exemple #11
0
        public ActionResult GuardarReporteCondicionesInseguras(EDReporte varReporte, List <HttpPostedFileBase> files, List <EDActividadesActosInseguros> actividades)
        {
            List <string> imagenes = new List <string>();

            varReporte.actividades = actividades;
            EDImagenesReportes img = new EDImagenesReportes();


            var usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current);

            if (usuarioActual == null)
            {
                ViewBag.Mensaje = "El usuario no ha iniciado sesión el sistema";
                return(RedirectToAction("Login", "Home"));
            }

            ServiceClient.EliminarParametros();
            ServiceClient.AdicionarParametro("nit", usuarioActual.NitEmpresa);
            var reporte = ServiceClient.ObtenerArrayJsonRestFul <EDReporte>(UrlServicioParticipacion, CapacidadObtenerReporteEmpresa, RestSharp.Method.GET);


            var           path            = "";
            var           ruta            = rutaImagenesReportesCI + usuarioActual.NitEmpresa;
            var           rutaImagen      = "";
            var           rutaGuardar     = "";
            List <string> imagenesGuardar = new List <string>();

            for (int i = 0; i < Request.Files.Count; i++)
            {
                HttpPostedFileBase ima = Request.Files[i] as HttpPostedFileBase;


                if (ima.ContentLength == 0)
                {
                }

                if (Path.GetExtension(ima.FileName).ToLower() == ".jpg" || Path.GetExtension(ima.FileName).ToLower() == ".png" ||
                    Path.GetExtension(ima.FileName).ToLower() == ".bmp" || Path.GetExtension(ima.FileName).ToLower() == ".gif" ||
                    Path.GetExtension(ima.FileName).ToLower() == ".tiff" || Path.GetExtension(ima.FileName).ToLower() == ".jpeg"
                    )
                {
                    if (!Directory.Exists(ruta))
                    {
                        System.IO.Directory.CreateDirectory(Server.MapPath(ruta));
                    }


                    rutaImagen  = Guid.NewGuid() + ima.FileName;
                    path        = Path.Combine(Server.MapPath(ruta), rutaImagen);
                    rutaGuardar = rutaImagen;
                    imagenes.Add(rutaGuardar);
                    imagenesGuardar.Add(path);
                    // ima.SaveAs(path);
                }
                else
                {
                    ServiceClient.EliminarParametros();
                    ServiceClient.AdicionarParametro("nit", usuarioActual.NitEmpresa);

                    ViewBag.MensajeError = "Error al almacenar, Formato de carga incorrecto";

                    return(View("Index", reporte.ToList()));
                }
            }



            varReporte.imagenes = imagenes;

            ServiceClient.EliminarParametros();

            var result = ServiceClient.RealizarPeticionesPostJsonRestFul <EDReporte>(UrlServicioParticipacion, CapacidadGuardarReporte, varReporte);

            if (result != null)
            {
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    //HttpPostedFileBase ima = Request.Files[i] as HttpPostedFileBase;


                    Image imagenRedimensionada = RedimensionarImagen(Request.Files[i].InputStream);


                    imagenRedimensionada.Save(imagenesGuardar[i]);
                }

                List <Proceso> procesos = procesoServicios.ObtenerProcesosPrincipales(usuarioActual.IdEmpresa);
                ViewBag.RazonSocialEmpresa = usuarioActual.RazonSocialEmpresa;
                ViewBag.nitEmpresa         = usuarioActual.NitEmpresa;
                ViewBag.Procesos           = new SelectList(procesos, "Pk_Id_Proceso");
                ViewBag.fechaSistena       = DateTime.Now.ToString("dd/MM/yyyy").Replace('-', '/');
                ViewBag.FKSede             = new SelectList(sedeServicio.SedesPorEmpresa(usuarioActual.IdEmpresa), "Pk_Id_Sede");
                ViewBag.FKTipoReporte      = new SelectList(db.Tbl_Tipo_Reporte, "Pk_Id_Tipo_Reporte");

                ViewBag.MensajeGuardar = "El reporte de incidentes fu\u00e9 almacenado satisfactoramiente";

                //RedirectToAction("CrearReporte", "Reporte");
            }
            else
            {
                ViewBag.MensajeError = "No se pudo  almacenar el reporte de incidenetes";

                return(View("Index", reporte.ToList()));
            }


            ServiceClient.EliminarParametros();
            ServiceClient.AdicionarParametro("nit", usuarioActual.NitEmpresa);
            var reporte2 = ServiceClient.ObtenerArrayJsonRestFul <EDReporte>(UrlServicioParticipacion, CapacidadObtenerReporteEmpresa, RestSharp.Method.GET);


            return(View("Index", reporte2.ToList()));
        }
Exemple #12
0
        public ActionResult GuardarReporteEditado(EDReporte varReporte, List <HttpPostedFileBase> files, List <EDActividadesActosInseguros> actividades)
        {
            List <string> listaImagenes      = new List <string>();
            var           agregarActividades = false;
            var           usuarioActual      = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current);

            if (usuarioActual == null)
            {
                ViewBag.mensaje1 = "Debe Registrarse para Ingresar a este Modulo.";
                return(RedirectToAction("Login", "Home"));
            }
            nitEmpresa = usuarioActual.NitEmpresa;
            ServiceClient.EliminarParametros();
            ServiceClient.AdicionarParametro("nit", usuarioActual.NitEmpresa);

            var reporte = ServiceClient.ObtenerArrayJsonRestFul <EDReporte>(UrlServicioParticipacion, CapacidadObtenerReporteEmpresa, RestSharp.Method.GET);

            ServiceClient.EliminarParametros();
            ServiceClient.AdicionarParametro("id", varReporte.IdReportes);
            // var result = ServiceClient.ObtenerObjetoJsonRestFul<EDReporte>(UrlServicioParticipacion, CapacidadDescargarPDFPorReporte, RestSharp.Method.GET);
            var activi = ServiceClient.ObtenerArrayJsonRestFul <EDActividadesActosInseguros>(UrlServicioParticipacion, CapacidadObtenerActividadesEmpresa, RestSharp.Method.GET);
            List <EDActividadesActosInseguros> actividadesPlanAccion = activi.ToList();



            ServiceClient.EliminarParametros();
            ServiceClient.AdicionarParametro("id", varReporte.IdReportes);
            // var result = ServiceClient.ObtenerObjetoJsonRestFul<EDReporte>(UrlServicioParticipacion, CapacidadDescargarPDFPorReporte, RestSharp.Method.GET);
            var imagenes = ServiceClient.ObtenerArrayJsonRestFul <EDImagenesReportes>(UrlServicioParticipacion, CapacidadObtenerImagenesEmpresa, RestSharp.Method.GET);
            List <EDImagenesReportes> imagenesPlanAccion = imagenes.ToList();

            varReporte.imagenesReporte = imagenesPlanAccion;
            varReporte.actividades     = actividadesPlanAccion;
            if (varReporte.actividades.Count() == 0)
            {
                varReporte.actividades = actividades;
            }
            var           path            = "";
            var           ruta            = rutaImagenesReportesCI + usuarioActual.NitEmpresa;
            var           rutaImagen      = "";
            var           rutaGuardar     = "";
            List <string> imagenesGuardar = new List <string>();

            for (int i = 0; i < Request.Files.Count; i++)
            {
                HttpPostedFileBase ima = Request.Files[i] as HttpPostedFileBase;

                if (ima.ContentLength == 0)
                {
                }
                if (ima.ContentLength > 0)
                {
                    if (Path.GetExtension(ima.FileName).ToLower() == ".jpg" || Path.GetExtension(ima.FileName).ToLower() == ".png" ||
                        Path.GetExtension(ima.FileName).ToLower() == ".bmp" || Path.GetExtension(ima.FileName).ToLower() == ".gif" ||
                        Path.GetExtension(ima.FileName).ToLower() == ".tiff" || Path.GetExtension(ima.FileName).ToLower() == ".jpeg"
                        )
                    {
                        if (!Directory.Exists(ruta))
                        {
                            System.IO.Directory.CreateDirectory(Server.MapPath(ruta));
                        }
                        rutaImagen  = Guid.NewGuid() + ima.FileName;
                        path        = Path.Combine(Server.MapPath(ruta), rutaImagen);
                        rutaGuardar = rutaImagen;

                        listaImagenes.Add(rutaGuardar);
                        imagenesGuardar.Add(path);
                        // ima.SaveAs(path);
                    }
                    else
                    {
                        ViewBag.MensajeError = "Error al almacenar, Formato de carga incorrecto";

                        return(View("Index", reporte.ToList()));
                    }
                }
            }
            varReporte.imagenes = listaImagenes;

            ServiceClient.EliminarParametros();
            var result = ServiceClient.RealizarPeticionesPostJsonRestFul <EDReporte>(UrlServicioParticipacion, CapacidadGuardarReporteEditado, varReporte);

            if (result != null)
            {
                if (imagenesGuardar.Count() > 0)
                {
                    for (int i = 0; i < Request.Files.Count; i++)
                    {
                        //HttpPostedFileBase ima = Request.Files[i] as HttpPostedFileBase;
                        Image imagenRedimensionada = RedimensionarImagen(Request.Files[i].InputStream);


                        imagenRedimensionada.Save(imagenesGuardar[i]);
                    }
                }
                ViewBag.MensajeExitoso = "El reporte de incidentes fué actualizado satisfactoramiente";

                //RedirectToAction("CrearReporte", "Reporte");
            }
            else
            {
                ViewBag.MensajeError = "No se pudo  actualizar  el reporte de incidentes";

                //RedirectToAction("CrearReporte", "Reporte");
            }

            ServiceClient.EliminarParametros();
            ServiceClient.AdicionarParametro("nit", usuarioActual.NitEmpresa);

            var reporte2 = ServiceClient.ObtenerArrayJsonRestFul <EDReporte>(UrlServicioParticipacion, CapacidadObtenerReporteEmpresa, RestSharp.Method.GET);

            return(View("Index", reporte2.ToList()));
        }
Exemple #13
0
        public ActionResult DescargarPDFPorReporte(int id)
        {
            var usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current);

            if (usuarioActual == null)
            {
                ViewBag.mensaje1 = "Debe Registrarse para Ingresar a este Modulo.";
                return(RedirectToAction("Login", "Home"));
            }

            EDReporte reporte = generarEDReporte(id);
            //string SwitchNombreEmpresa = usuarioActual.RazonSocialEmpresa;
            //string SwitchNitEmpresa = usuarioActual.NitEmpresa;
            //string SwitchNombreDocumento = "Reporte de Condiciones y Actos Inseguros";
            //var uriFooter = new Uri(Url.Action("Footer", "Reporte", null, Request.Url.Scheme));
            //var clean1 = uriFooter.GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped);
            //var uriHeader = new Uri(Url.Action("Header", "Reporte", new { NombreEmpresa = SwitchNombreEmpresa, NitEmpresa = SwitchNitEmpresa, NombreInforme = SwitchNombreDocumento }, Request.Url.Scheme));
            //var clean2 = uriHeader.GetComponents(UriComponents.AbsoluteUri & ~UriComponents.Port, UriFormat.UriEscaped);

            ///Prueba Pdf en Blanco
            string EncodedRazonSocial   = System.Net.WebUtility.UrlEncode(usuarioActual.RazonSocialEmpresa);
            string EncodedNit           = System.Net.WebUtility.UrlEncode(usuarioActual.NitEmpresa);
            string EncodedNombreInforme = System.Net.WebUtility.UrlEncode("Reporte de Condiciones y Actos Inseguros");

            var footurl   = "https://alissta.gov.co/Acciones/Footer";
            var headerurl = "https://alissta.gov.co/Acciones/Header?NombreEmpresa=" + EncodedRazonSocial + "&NitEmpresa=" + EncodedNit + "&NombreInforme=" + EncodedNombreInforme;

            string cusomtSwitches = string.Format("--footer-line --print-media-type --allow {0} --footer-html {0} --header-line --print-media-type --allow {1} --header-html {1} --header-spacing 5", footurl, headerurl);

            ///FIN Prueba Pdf en Blanco
            // string cusomtSwitches = string.Format("--footer-line --print-media-type --allow {0} --footer-html {0} --header-line --print-media-type --allow {1} --header-html {1} --header-spacing 5", uriFooter, uriHeader);
            documento = rep.CedulaQuienReporta;
            ObtenerSiarp(Convert.ToString(documento));
            ViewBag.Cargo        = cargo.ToLower();
            ViewBag.Nombre       = nombre.ToLower();
            ViewBag.fechaSistena = reporte.fechaSistena;
            ViewBag.rutaAbsoluta = rutaImagenesReportesCIA + usuarioActual.NitEmpresa + "/";



            //List<Proceso> procesos = procesoServicios.ObtenerProcesosPrincipales(usuarioActual.IdEmpresa);


            //List<Proceso> subProcesos = procesoServicios.ObtenerSubProcesos(reportes.FK_Proceso);
            //ViewBag.Procesos = new SelectList(procesos, "Pk_Id_Proceso", "Descripcion_Proceso", reportes.Procesos.Fk_Id_Proceso);

            //ViewBag.FK_Proceso = new SelectList(db.Tbl_Procesos, "Pk_Id_Proceso", "Descripcion_Proceso", reportes.FK_Proceso);


            Reporte reportes = db.Tbl_Reportes.Find(id);

            if (reporte.FK_Proceso != null)
            {
                ViewBag.FK_Proceso = reporte.nombreProceso;
            }
            else
            {
                ViewBag.FK_Proceso = "NA";
            }


            ViewBag.FechaOcurrencia = reporte.FechaOcurrencia.ToString("dd/MM/yyyy").Replace('-', '/');
            if (reporte.medioAcceso == false)
            {
                ViewBag.Origen = "Alissta WEB";
            }
            else
            {
                ViewBag.Origen = "Alissta APP";
            }
            ViewBag.ruta = rutaImagenesReportesCI + usuarioActual.NitEmpresa + "/";
            return(new Rotativa.PartialViewAsPdf("ReporteCondicionesInsegurasPDF", reporte)
            {
                FileName = "ReporteCondicionesActosInseguros" + DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "") + ".pdf",
                PageOrientation = Orientation.Landscape,
                CustomSwitches = cusomtSwitches
            });
        }
Exemple #14
0
        public ActionResult Edit(int id)
        {
            EDReporte reporte       = generarEDReporte(id);
            var       usuarioActual = ObtenerUsuarioEnSesion(System.Web.HttpContext.Current);

            if (usuarioActual == null)
            {
                ViewBag.mensaje1 = "Debe Registrarse para Ingresar a este Modulo.";
                return(RedirectToAction("Login", "Home"));
            }
            //List<Proceso> procesos = procesoServicios.ObtenerProcesosPrincipales(usuarioActual.IdEmpresa);


            //List<Proceso> subProcesos = procesoServicios.ObtenerSubProcesos(reportes.FK_Proceso);
            //ViewBag.Procesos = new SelectList(procesos, "Pk_Id_Proceso", "Descripcion_Proceso", reportes.Procesos.Fk_Id_Proceso);

            var resultTipoReporte = ServiceClient.ObtenerArrayJsonRestFul <EDTipoReporte>(UrlServicioParticipacion, CapacidadObtenerTipoReporte, RestSharp.Method.GET);



            //Reporte reportes = db.Tbl_Reportes.Find(id);


            //Reporte reportes = db.Tbl_Reportes.Find(id);


            if (reporte.FK_Proceso != null)
            {
                var            fkProceso = (reporte.Procesos == null) ? 0 : reporte.FK_Proceso;
                List <Proceso> procesos  = procesoServicios.ObtenerProcesosPrincipales(usuarioActual.IdEmpresa);
                Proceso        proceso   = procesoServicios.ObtenerProceso((int)fkProceso);
                ViewBag.Procesos = new SelectList(procesos, "Pk_Id_Proceso", "Descripcion_Proceso", reporte.FK_Proceso);
            }
            else
            {
                List <Proceso> procesos = procesoServicios.ObtenerProcesosPrincipales(usuarioActual.IdEmpresa);
                ViewBag.Procesos = new SelectList(procesos, "Pk_Id_Proceso", "Descripcion_Proceso");
            }

            //if(reporte.FK_Proceso!=null)
            //{
            //    var fkProceso = (reporte.FK_Proceso == null) ? 0:reporte.FK_Proceso;
            //List<Proceso> procesos = procesoServicios.ObtenerProcesosPrincipales(usuarioActual.IdEmpresa);
            //Proceso proceso = procesoServicios.ObtenerProceso((int)fkProceso);
            //List<Proceso> subProcesos = procesoServicios.ObtenerSubProcesos(proceso.Procesos.Pk_Id_Proceso);
            //ViewBag.Procesos = new SelectList(procesos, "Pk_Id_Proceso", "Descripcion_Proceso", proceso.Fk_Id_Proceso);
            //ViewBag.FK_Proceso = new SelectList(subProcesos, "Pk_Id_Proceso", "Descripcion_Proceso", reporte.FK_Proceso);
            //}
            //else
            //{
            //    //ServiceClient.EliminarParametros();
            //    //ServiceClient.AdicionarParametro("NIT", usuarioActual.NitEmpresa);
            //    //var resultProceso = ServiceClient.ObtenerArrayJsonRestFul<EDProceso>(urlServicioEmpresas, CapacidadObtenerprocesosEmpresa, RestSharp.Method.GET);

            //    //ViewBag.Procesos = resultProceso.Select(p => new SelectListItem()
            //    //{
            //    //    Value = p.Id_Proceso.ToString(),
            //    //    Text = p.Descripcion
            //    //}).ToList();


            //    List<Proceso> procesos = procesoServicios.ObtenerProcesosPrincipales(usuarioActual.IdEmpresa);
            //    ViewBag.Procesos = new SelectList(procesos, "Pk_Id_Proceso", "Descripcion_Proceso");


            //}

            ViewBag.idReporte = reporte.IdReportes;
            ViewBag.FKSede    = new SelectList(sedeServicio.SedesPorEmpresa(usuarioActual.IdEmpresa), "Pk_Id_Sede", "Nombre_Sede", reporte.FKSede);

            if (reporte.medioAcceso)
            {
                ViewBag.MedioAcceso = '1';
            }
            else
            {
                ViewBag.MedioAcceso = '0';
            }


            ViewBag.FKTipoReporte   = new SelectList(resultTipoReporte.ToList(), "IdTipoReporte", "DescripcionTipoReporte", reporte.FKTipoReporte);
            ViewBag.Cedula          = reporte.CedulaQuienReporta;
            ViewBag.Consecutivo     = reporte.ConsecutivoReporte;
            ViewBag.fechaSistena    = DateTime.Now.ToString("dd/MM/yyyy").Replace('-', '/');
            ViewBag.FechaOcurrencia = reporte.FechaOcurrencia.ToString("dd/MM/yyyy").Replace('-', '/');
            ViewBag.Descripcion     = reporte.DescripcionReporte;
            ViewBag.Causa           = reporte.CausaReporte;
            ViewBag.Sugerencia      = reporte.SugerenciasReporte;
            ObtenerSiarp(Convert.ToString(reporte.CedulaQuienReporta));
            ViewBag.Cargo  = cargo.ToLower();
            ViewBag.Nombre = nombre.ToLower();
            ViewBag.ruta   = rutaImagenesReportesCI + usuarioActual.NitEmpresa + "/";
            return(View(reporte));
        }