Beispiel #1
0
        public bool ModificarPanelInformativo(PanelInformativo Panel, HttpPostedFileBase file)
        {
            PanelInformativo PanelInformativo = ObtenerPanelInformativoByPanelInformativoId();

            if (PanelInformativo != null)
            {
                try
                {
                    byte[] imagenData = null;
                    using (var FotoCategoria = new BinaryReader(file.InputStream))
                    {
                        imagenData = FotoCategoria.ReadBytes(file.ContentLength);
                    }
                    PanelInformativo.Imagen     = imagenData;
                    PanelInformativo.ContetType = file.ContentType;
                    PanelInformativo.Estado     = Panel.Estado;

                    BD.Entry(PanelInformativo).State = EntityState.Modified;
                    BD.SaveChanges();
                    return(true);
                }
                catch (Exception error)
                {
                    Bll_File.EscribirLog(error.ToString());
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        public ActionResult PanelInformativoUpdt(PanelInformativo PanelInformativo, HttpPostedFileBase file)
        {
            //   Bll_Login.VerificarSesionActiva();

            ViewBag.Estado = new SelectList(FuncionesEnum.ListaEnum <EnumEstados>(), "Value", "Text", (int)PanelInformativo.Estado);

            if (ModelState.IsValid)
            {
                if (file != null && file.ContentLength > 0)
                {
                    Bll_PanelInformativo Bll_PanelInformativo = new Bll_PanelInformativo();

                    if (Bll_PanelInformativo.ModificarPanelInformativo(PanelInformativo, file))
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        return(View(PanelInformativo));
                    }
                }
                else
                {
                    return(View(PanelInformativo));
                }
            }
            else
            {
                return(View(PanelInformativo));
            }
        }
        public ActionResult ConvertirImagen(int PersonaId)
        {
            //   Bll_Login.VerificarSesionActiva();

            if (PersonaId == 0)// panel informativo siempre sera 0 (se reutilizo el metodo)
            {
                Bll_PanelInformativo Bll_PanelInformativo = new Bll_PanelInformativo();
                PanelInformativo     PanelInformativo     = Bll_PanelInformativo.ObtenerPanelInformativoByPanelInformativoId();
                if (PanelInformativo.Imagen != null)
                {
                    return(File(PanelInformativo.Imagen, PanelInformativo.ContetType));
                }
                else
                {
                    return(null);
                }
            }

            Bll_Personas Bll_Personas = new Bll_Personas();

            byte[] PersonaImagen = Bll_Personas.GetImagenByPersonaId(PersonaId);

            if (PersonaImagen != null)
            {
                if (PersonaImagen != null)
                {
                    return(File(PersonaImagen, "image/jpg"));
                }
                else
                {
                    return(null);
                }
            }
            return(null);
        }
Beispiel #4
0
        public ActionResult PanelInformativoUpdt()
        {
            //   Bll_Login.VerificarSesionActiva();
            Bll_PanelInformativo Bll_PanelInformativo = new Bll_PanelInformativo();
            PanelInformativo     PanelInformativo     = Bll_PanelInformativo.ObtenerPanelInformativoByPanelInformativoId();

            ViewBag.Estado = new SelectList(FuncionesEnum.ListaEnum <EnumEstados>(), "Value", "Text", (int)PanelInformativo.Estado);

            return(View(PanelInformativo));
        }
Beispiel #5
0
 public PanelInformativo ObtenerPanelInformativoByPanelInformativoId()
 {
     try
     {
         PanelInformativo PanelInformativo = BD.PanelInformativo.Where(x => x.PanelInformativoId == 1).FirstOrDefault();
         if (PanelInformativo != null)
         {
             return(PanelInformativo);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception error)
     {
         Bll_File.EscribirLog(error.ToString());
         return(null);
     }
 }