Exemplo n.º 1
0
        protected void Publicar_Noticia(object sender, EventArgs e)
        {
            var oNoticia = new Noticia()
            {
                Id          = (int)Session["idGrupo"],
                Titulo      = txt_titulo.Text,
                Cuerpo      = txt_cuerpo.Text,
                Fecha       = date_fecha.SelectedDate,
                Autor       = txt_autor.Text,
                IdCategoria = string.IsNullOrEmpty(ddl_categorias.SelectedValue) ? -1 : int.Parse(ddl_categorias.SelectedValue),
            };

            if (!string.IsNullOrEmpty(Request.QueryString.Get("isEdit")) && Request.QueryString.Get("isEdit").Equals("true"))
            {
                using (NoticiaBusiness n = new NoticiaBusiness())
                {
                    n.updateNoticia(oNoticia);
                }
                lbl_resultado.Text = "Noticia editada correctamente";
            }
            else
            {
                using (NoticiaBusiness n = new NoticiaBusiness())
                {
                    n.InsertNoticia(oNoticia);
                }
                lbl_resultado.Text = "Noticia publicada correctamente";
            }
        }
Exemplo n.º 2
0
        public void Publicar_Noticia(string titulo, DateTime fecha, string cuerpo, int idCat)
        {
            var oNoticia = new Noticia()
            {
                Titulo      = titulo,
                Cuerpo      = cuerpo,
                Fecha       = fecha,
                IdCategoria = idCat,
            };

            using (NoticiaBusiness n = new NoticiaBusiness())
            {
                n.InsertNoticia(oNoticia);
            }
        }
Exemplo n.º 3
0
        protected void Publicar_Noticia(object sender, EventArgs e)
        {
            var oNoticia = new Noticia()
            {
                Titulo      = txt_titulo.Text,
                Cuerpo      = txt_cuerpo.Text,
                Fecha       = date_fecha.SelectedDate,
                IdCategoria = string.IsNullOrEmpty(ddl_categorias.SelectedValue) ? -1 : int.Parse(ddl_categorias.SelectedValue),
            };

            using (NoticiaBusiness n = new NoticiaBusiness())
            {
                n.InsertNoticia(oNoticia);
            }
            lbl_resultado.Text = "Noticia publicada correctamente";
        }
Exemplo n.º 4
0
 protected void Publicar_Noticia(object sender, EventArgs e)
 {
     var oNoticia = new Noticia()
     {
         Titulo = txt_titulo.Text,
         Cuerpo = txt_cuerpo.Text,
         Fecha = date_fecha.SelectedDate,
         IdCategoria = int.Parse(ddl_categorias.SelectedValue)
     };
     using (NoticiaBusiness n = new NoticiaBusiness())
     {
         n.InsertNoticia(oNoticia);
     }
     lbl_resultado.Text = "Noticia publicada correctamente";            
     
 }