protected void strNoticias_OnReadData(object sender, StoreReadDataEventArgs e) { try { int start = e.Start; int limit = NumInt.Init(e.Parameters.GetParameter("limit").Value); limit = limit == 0 ? e.Limit : limit; int page = (start / limit) + 1; co_re_noticias_no Nomina = new co_re_noticias_no(); Nomina.Pagina = page; Nomina.RegistrosPorPaginas = e.Limit; Nomina.ColumnaOrden = e.Sort[0].Property; Nomina.OrdenColumna = (FwpDataGridDataBound.Orden)Enum.Parse(typeof(FwpDataGridDataBound.Orden), e.Sort[0].Direction.ToString(), true); AgregarFiltros(ref Nomina); Nomina<co_re_noticias_no> data = new bf_re_noticias().GetNomina(Nomina); ICollection<object> list = new List<object>(); foreach (co_re_noticias_no no in data.DataSource) { list.Add(new { id_noticia = no.id_noticia, no_nodescripcion = no.no_nodescripcion, no_fechaPublicacion = no.no_fechaPublicacion.Fecha, no_vigente = no.no_vigente, no_titulo = no.no_titulo, no_bajadatitulo = no.no_bajadatitulo, no_fechaCreacion = no.no_fechaCreacion.Fecha, no_fechaExpiracion = no.no_fechaExpiracion.Fecha, id_noticiatipo = no.id_noticiatipo.id, noti_descripcion = no.id_noticiatipo.descripcion }); } strNoticias.DataSource = list; strNoticias.PageSize = limit; PageProxy pageProxy = strNoticias.Proxy[0] as PageProxy; if (pageProxy != null) pageProxy.Total = data.Registros; strNoticias.DataBind(); } catch (Exception ex) { Mensajes.Error(ex.Message); } }
protected void btnGuardar_Click(object sender, DirectEventArgs e) { try { String Mensaje; int idNoticia = hidID.Text.ValidaEntero("ID"); co_re_noticias no = new co_re_noticias(); if (idNoticia!=0) { no = new bf_re_noticias().GetData(idNoticia); Mensaje = ErrorText.REGISTRO_MODIFICADO; } else { Mensaje = ErrorText.REGISTRO_INGRESADO; no.no_fechaCreacion.Fecha = DateTime.Now; } no.no_titulo = txtTitulo.Text; no.no_bajadatitulo = txtSubtitulo.Text; no.no_fechaPublicacion.Fecha = (DateTime)txtFechaPublicacion.Value; no.no_fechaExpiracion.Fecha = (DateTime) txtFechaExpiracion.Value; no.id_noticiatipo.id = cmbNoticiasTipo.SelectedItem.Value.ValidaEntero(cmbNoticiasTipo.FieldLabel); no.no_nodescripcion = txtDescripcion.Text; no.no_vigente = EstadosRegistros.ConvertirAEstadosRegistros(chkVigente.Value); if (cmbNoticiasPublicacion.SelectedItem.Value!=null) { no.id_noticiapublicacion.id = cmbNoticiasPublicacion.SelectedItem.Value.ValidaEntero(cmbNoticiasTipo.FieldLabel); } no.no_destacado = EstadosRegistros.ConvertirAEstadosRegistros(chkDestacado.Value); no.no_orden = txtOrden.Text.ValidaEntero(txtOrden.FieldLabel); new bf_re_noticias().Save(no); Mensajes.Show("Mensaje",Mensaje,"CloseIframe();",MessageBox.Icon.INFO); } catch (Exception ex) { Mensajes.Error(ex.Message); } }
private void CompletarValores(string id) { try { int IdNoticia = id.ValidaEntero("ID"); co_re_noticias no = new bf_re_noticias().GetData(IdNoticia); txtTitulo.Text = no.no_titulo; txtSubtitulo.Text = no.no_bajadatitulo; txtFechaPublicacion.Value = no.no_fechaPublicacion.Fecha; txtFechaExpiracion.Value = no.no_fechaExpiracion.Fecha; txtDescripcion.Text = no.no_nodescripcion; cmbNoticiasTipo.SeleccionarOpcion(no.id_noticiatipo.id.ToString()); chkVigente.Value = EstadosRegistros.ConvertirABool(no.no_vigente); cmbNoticiasPublicacion.SeleccionarOpcion(no.id_noticiapublicacion.id.ToString()); chkDestacado.Value = EstadosRegistros.ConvertirABool(no.no_destacado); txtOrden.Text = no.no_orden.ToString(); } catch (Exception ex) { Mensajes.Error(ex.Message); } }