protected void Page_Load(object sender, EventArgs e) { Seguridad(consPalabraClave); if (Request.QueryString.AllKeys.Contains("id")) { HttpContext.Current.Session["GestionReCallAgregar_id"] = Request.QueryString.Get("id"); tbl_Recall obj = WebService.RecuperarTodaReCall().FirstOrDefault(x => x.rec_id == Convert.ToInt32(HttpContext.Current.Session["GestionReCallAgregar_id"])); HttpContext.Current.Session["GestionReCallAgregar_obj"] = obj; } if (!IsPostBack) { } }
public static bool?CambiarPublicarReCall(int rec_id) { bool?resultado = null; try { tbl_Recall o = null; db_KellerhoffEntities ctx = new db_KellerhoffEntities(); o = ctx.tbl_Recall.FirstOrDefault(x => x.rec_id == rec_id); o.rec_visible = !o.rec_visible; ctx.SaveChanges(); resultado = true; } catch (Exception ex) { return(null); } return(resultado); }
public void AgregarHtmlOculto() { string resultado = string.Empty; if (HttpContext.Current.Session["GestionReCallAgregar_id"] != null) { resultado += "<input type=\"hidden\" id=\"hidden_rec_id\" value=\"" + Server.HtmlEncode(HttpContext.Current.Session["GestionReCallAgregar_id"].ToString()) + "\" />"; } if (HttpContext.Current.Session["GestionReCallAgregar_obj"] != null) { tbl_Recall o = (tbl_Recall)HttpContext.Current.Session["GestionReCallAgregar_obj"]; resultado += "<input type=\"hidden\" id=\"hidden_titulo\" value=\"" + Server.HtmlEncode(o.rec_titulo) + "\" />"; resultado += "<input type=\"hidden\" id=\"hidden_descr\" value=\"" + Server.HtmlEncode(o.rec_descripcion) + "\" />"; resultado += "<input type=\"hidden\" id=\"hidden_descrReducido\" value=\"" + Server.HtmlEncode(o.rec_descripcionReducido) + "\" />"; resultado += "<input type=\"hidden\" id=\"hidden_FechaNoticia\" value=\"" + Server.HtmlEncode(o.rec_FechaNoticia == null ? "" : o.rec_FechaNoticia.Value.ToString("dd'/'MM'/'yyyy")) + "\" />"; } Response.Write(resultado); }
public static bool?EliminarReCall(int rec_id) { bool?resultado = null; try { tbl_Recall o = null; KellerhoffEntities ctx = new KellerhoffEntities(); o = ctx.tbl_Recall.FirstOrDefault(x => x.rec_id == rec_id); ctx.tbl_Recall.Remove(o); ctx.SaveChanges(); resultado = true; } catch (Exception ex) { return(null); } return(resultado); }
public static bool?InsertarActualizarReCall(int rec_id, string rec_titulo, string rec_descripcion, string rec_descripcionReducido, string rec_descripcionHTML, DateTime?rec_FechaNoticia, DateTime?rec_FechaFinNoticia) { bool?resultado = null; try { tbl_Recall o = null; db_KellerhoffEntities ctx = new db_KellerhoffEntities(); if (rec_id == 0) { o = ctx.tbl_Recall.Create(); o.rec_visible = true; } else { o = ctx.tbl_Recall.FirstOrDefault(x => x.rec_id == rec_id); } o.rec_titulo = rec_titulo; o.rec_descripcion = rec_descripcion; o.rec_descripcionReducido = rec_descripcionReducido; o.rec_descripcionHTML = rec_descripcionHTML; o.rec_FechaNoticia = rec_FechaNoticia; o.rec_FechaFinNoticia = rec_FechaFinNoticia; o.rec_Fecha = DateTime.Now; // o.hsl_idRecursoDoc = hsl_idRecursoDoc; //o.hsl_idRecursoImgPC = hsl_idRecursoImgPC; //o.hsl_idRecursoImgMobil = hsl_idRecursoImgMobil; if (rec_id == 0) { ctx.tbl_Recall.Add(o); } ctx.SaveChanges(); resultado = true; } catch (Exception ex) { return(null); } return(resultado); }
//public static List<tbl_Recall> RecuperarTodaReCall() //{ // List<tbl_Recall> resultado = null; // try // { // KellerhoffEntities ctx = new KellerhoffEntities(); // resultado = ctx.tbl_Recall.ToList(); // } // catch (Exception ex) // { // return null; // } // return resultado; //} public static List <tbl_Recall> RecuperarTodaReCall() { List <tbl_Recall> resultado = null; try { DataTable tb = capaLogRegistro.RecuperarTodaReCall_aux(); if (tb != null) { resultado = new List <tbl_Recall>(); foreach (DataRow item in tb.Rows) { tbl_Recall o = new tbl_Recall(); if (item.Table.Columns.Contains("rec_id") && item["rec_id"] != DBNull.Value) { o.rec_id = Convert.ToInt32(item["rec_id"]); } if (item.Table.Columns.Contains("rec_titulo") && item["rec_titulo"] != DBNull.Value) { o.rec_titulo = Convert.ToString(item["rec_titulo"]); } if (item.Table.Columns.Contains("rec_descripcion") && item["rec_descripcion"] != DBNull.Value) { o.rec_descripcion = Convert.ToString(item["rec_descripcion"]); } if (item.Table.Columns.Contains("rec_descripcionReducido") && item["rec_descripcionReducido"] != DBNull.Value) { o.rec_descripcionReducido = Convert.ToString(item["rec_descripcionReducido"]); } if (item.Table.Columns.Contains("rec_descripcionHTML") && item["rec_descripcionHTML"] != DBNull.Value) { o.rec_descripcionHTML = Convert.ToString(item["rec_descripcionHTML"]); } if (item.Table.Columns.Contains("rec_FechaNoticia") && item["rec_FechaNoticia"] != DBNull.Value) { o.rec_FechaNoticia = Convert.ToDateTime(item["rec_FechaNoticia"]); } if (item.Table.Columns.Contains("rec_FechaFinNoticia") && item["rec_FechaFinNoticia"] != DBNull.Value) { o.rec_FechaFinNoticia = Convert.ToDateTime(item["rec_FechaFinNoticia"]); } if (item.Table.Columns.Contains("rec_Fecha") && item["rec_Fecha"] != DBNull.Value) { o.rec_Fecha = Convert.ToDateTime(item["rec_Fecha"]); } if (item.Table.Columns.Contains("rec_visible") && item["rec_visible"] != DBNull.Value) { o.rec_visible = Convert.ToBoolean(item["rec_visible"]); } resultado.Add(o); } } //KellerhoffEntities ctx = new KellerhoffEntities(); //resultado = ctx.tbl_Recall.ToList(); } catch (Exception ex) { return(null); } return(resultado); }