Beispiel #1
0
        public int modificarfoto(PropagandaBO bO, int id)
        {
            SqlCommand cmd = new SqlCommand("update Usuario set foto=@foto where id='" + id + "'");

            cmd.Parameters.Add("@foto", SqlDbType.Image).Value = Foto.ConvertirAFoto(bO.usuario.img);
            return(conex.EjecutarComando(cmd));
        }
        public ActionResult AgregarPropaganda(PropagandaBO obj)
        {
            int id      = (int)Session["id"];
            var agregar = (obj.id > 0) ? objDAO.actualizar(obj) : objDAO.agregarpropaganda(obj, id);

            return(Redirect("~/Comercio/Index"));
        }
Beispiel #3
0
        public int agregarpropaganda(PropagandaBO objbo, int usuario)
        {
            SqlCommand cmd = new SqlCommand("insert into Propaganda(idUsuario,foto,descripcion,status,fecha)values(@idusu,@foto,@des,@sta,@fecha)");

            cmd.Parameters.Add("@idusu", SqlDbType.Int).Value   = usuario;
            cmd.Parameters.Add("@foto", SqlDbType.Image).Value  = Foto.ConvertirAFoto(objbo.imagen);
            cmd.Parameters.Add("@des", SqlDbType.VarChar).Value = objbo.descripcion;
            cmd.Parameters.Add("@sta", SqlDbType.Bit).Value     = false;
            cmd.Parameters.Add("@fecha", SqlDbType.Date).Value  = DateTime.Now.ToShortDateString();
            return(conex.EjecutarComando(cmd));
        }
        public ActionResult modifcarfotoperfil(PropagandaBO obj)
        {
            int id    = (int)Session["id"];
            var fotos = objDAO.modificarfoto(obj, id);

            Session["foto"] = null;
            String foto = "data:image/jpeg;base64," + Convert.ToBase64String(objFoto.ConvertirAFoto(obj.usuario.img));

            Session["foto"] = foto;
            return(Redirect("~/Comercio/Index"));
        }
Beispiel #5
0
        public int actualizar(PropagandaBO objbo)
        {
            if (objbo.imagen == null)
            {
                SqlCommand cmd = new SqlCommand("update Propaganda set descripcion=@descrip where id=@id");
                cmd.Parameters.Add("@descrip", SqlDbType.VarChar).Value = objbo.descripcion;
                cmd.Parameters.Add("@id", SqlDbType.Int).Value          = objbo.id;

                return(conex.EjecutarComando(cmd));
            }
            else
            {
                SqlCommand cmd = new SqlCommand("update Propaganda set foto=@foto,descripcion=@descrip where id=@id");
                cmd.Parameters.Add("@foto", SqlDbType.Image).Value      = Foto.ConvertirAFoto(objbo.imagen);
                cmd.Parameters.Add("@descrip", SqlDbType.VarChar).Value = objbo.descripcion;
                cmd.Parameters.Add("@id", SqlDbType.Int).Value          = objbo.id;

                return(conex.EjecutarComando(cmd));
            }

            return(1);
        }