protected void Page_Load(object sender, EventArgs e) { /// <summary> /// Carga la grilla con todos los eventos registrados /// </summary> if (!IsPostBack) { EventoBLL evBLL = new EventoBLL(); //UsuarioBEL usuario = new UsuarioBEL(); UsuarioBEL usuario = (UsuarioBEL)Session["usuarioConectado"]; grvEventos.DataSource = evBLL.traerEventos(usuario.Rut); grvEventos.DataBind(); RecintoBLL recBLL = new RecintoBLL(); ddlRecintos.DataSource = recBLL.traerRecintos(); ddlRecintos.DataValueField = "IdRecinto"; ddlRecintos.DataTextField = "NombreRecinto"; ddlRecintos.DataBind(); ddlRecintos.Items.Insert(0, new ListItem("..Seleccione Recinto..", "-1")); TipoEventoBLL tipBLL = new TipoEventoBLL(); ddlTipoEventos.DataSource = tipBLL.listaDeTiposEventos(); ddlTipoEventos.DataValueField = "IdTipoEvento"; ddlTipoEventos.DataTextField = "DescripcionTipoEvento"; ddlTipoEventos.DataBind(); ddlTipoEventos.Items.Insert(0, new ListItem("..Seleccione Tipo Evento..", "-1")); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnCambioDePagina(object sender, GridViewPageEventArgs e) { grvTipos.PageIndex = e.NewPageIndex; TipoEventoBLL tipoEventosBLL = new TipoEventoBLL(); grvTipos.DataSource = tipoEventosBLL.listaDeTiposEventos(); grvTipos.DataBind(); }
private void CarregaComboTipoEvento() { IEnumerable <TipoEvento> tipoEventos = TipoEventoBLL.ListarTipoEventos(); cbxTipoEvento.Items.Add(""); foreach (var item in tipoEventos) { cbxTipoEvento.Items.Add(new ListItem(item.Descricao, item.TipoEvento_ID.ToString())); } cbxTipoEvento.SelectedIndex = -1; }
protected void Page_Load(object sender, EventArgs e) { /// <summary> /// Carga la grilla con todos los tipos de eventos registrados /// </summary> if (!IsPostBack) { TipoEventoBLL tipoEventosBLL = new TipoEventoBLL(); grvTipos.DataSource = tipoEventosBLL.listaDeTiposEventos(); grvTipos.DataBind(); } }
private void cargarDDL() { TipoEventoBLL tipo = new TipoEventoBLL(); List <TipoEventoBEL> tipos = new List <TipoEventoBEL>(); tipos = tipo.listaDeTiposEventos(); ddlFiltro.DataTextField = "DescripcionTipoEvento"; ddlFiltro.DataValueField = "IdTipoEvento"; ddlFiltro.DataSource = tipos; ddlFiltro.DataBind(); ddlFiltro.Items.Insert(0, new ListItem("¿Qué quieres ver?", "-5")); }
protected void Page_Load(object sender, EventArgs e) { /// <summary> /// Carga los datos si se requiere actualiar o editar /// </summary> if (!IsPostBack) { if (Request.QueryString["id"] != null) { lblTitulo.Text = "Modificar Tipo Evento"; TipoEventoBLL tipoBLL = new TipoEventoBLL(); TipoEventoBEL tipoBEL = tipoBLL.taerEnventoPorId(Int32.Parse(Request.QueryString["id"])); txtNombre.Text = tipoBEL.DescripcionTipoEvento; idTipoEvento.Text = tipoBEL.IdTipoEvento.ToString(); } } }
/// <summary> /// Modifica o Elimina el tipo de evento seleccionado /// </summary> protected void grvTipos_RowCommand(object sender, GridViewCommandEventArgs e) { TipoEventoBLL eventoBLL = new TipoEventoBLL(); if (e.CommandName.Equals("modificar")) { Response.Redirect(string.Format("AgregarTipoEvento.aspx?id={0}", e.CommandArgument.ToString()), false); } else if (e.CommandName.Equals("Eliminar")) { eventoBLL.eliminarTipoEvento(Int32.Parse(e.CommandArgument.ToString())); /// <summary> /// Carga la grilla con todos los tipos de eventos registrados /// </summary> TipoEventoBLL tipoEventosBLL = new TipoEventoBLL(); grvTipos.DataSource = tipoEventosBLL.listaDeTiposEventos(); grvTipos.DataBind(); } }
/// <summary> /// Guarda los datos entregados por el usuario /// </summary> protected void btnGuardar_Click(object sender, EventArgs e) { TipoEventoBEL tipoEvento = new TipoEventoBEL(); tipoEvento.DescripcionTipoEvento = txtNombre.Text; TipoEventoBLL tipevebll = new TipoEventoBLL(); if (lblTitulo.Text == "Modificar Tipo Evento") { tipoEvento.IdTipoEvento = Int32.Parse(idTipoEvento.Text); tipevebll.editarTipoEvento(tipoEvento); Response.Write("<script>alert('Datos modificados correctamente'); window.location='TiposEventos.aspx';</script>"); } else { tipevebll.agregarTipoEvento(tipoEvento); Response.Write("<script>alert('Se agregó correctamente');window.location='TiposEventos.aspx';</script>"); txtNombre.Text = String.Empty; } }