protected void ddlTipoEntrada_SelectedIndexChanged(object sender, EventArgs e) { Session["event_controle"] = ((DropDownList)sender); lblselect.Visible = false; if (ddlTipoEntrada.SelectedItem.Value.Equals("-1")) { txtPrecio.Text = "0"; txtTotal.Text = "0"; return; } int idTipoTicket = Int32.Parse(ddlTipoEntrada.SelectedItem.Value); int idEvento = Int32.Parse(lblIdEvento.Text); TiposTicketBLL bllTipos = new TiposTicketBLL(); TiposTicketBEL tipo = bllTipos.traerTiposTicketPorId(idTipoTicket); txtPrecio.Text = tipo.Precio.ToString(); int cant = Int32.Parse(txtCantEntradas.Text); txtTotal.Text = (tipo.Precio * cant).ToString(); AsientoBLL bllAsiento = new AsientoBLL(); ddlAsientos.DataSource = bllAsiento.traerAsientos(idEvento, tipo.IdTipoAsiento); ddlAsientos.DataValueField = "IdAsiento"; ddlAsientos.DataTextField = "Numero"; ddlAsientos.DataBind(); ddlAsientos.Items.Insert(0, new ListItem("..Seleccione..", "-1")); btnAgregarAsiento.Enabled = true; }
protected void txtCantEntradas_TextChanged(object sender, EventArgs e) { AsientoBLL bllAsiento = new AsientoBLL(); int precio = Int32.Parse(txtPrecio.Text); int cant = Int32.Parse(txtCantEntradas.Text); int IdTipoTicket = Int32.Parse(ddlTipoEntrada.SelectedItem.Value); if (IdTipoTicket == -1) { lblselect.Text = "Seleccione Tipo"; lblselect.Visible = true; return; } else { lblselect.Visible = false; int IdEvento = Int32.Parse(lblIdEvento.Text); TiposTicketBLL bllTipos = new TiposTicketBLL(); TiposTicketBEL tipo = bllTipos.traerTiposTicketPorId(IdTipoTicket); int cantMax = bllAsiento.traerAsientos(IdEvento, tipo.IdTipoAsiento).Count(); if (cant > cantMax) { txtCantEntradas.Text = "1"; lblErrCant.Text = "La cantidad ingresada no es valida"; lblErrCant.Visible = true; return; } else { lblErrCant.Visible = false; } if (Session["listaAsientos"] != null) { this.listaAsientos = (ArrayList)Session["listaAsientos"]; this.listaGrilla = (ArrayList)Session["listaGrilla"]; } else { this.listaAsientos = new ArrayList(); this.listaGrilla = new ArrayList(); } int indice = this.listaAsientos.Count; if (indice == 0 || indice <= cant) { txtTotal.Text = (precio * cant).ToString(); ddlAsientos.Visible = true; btnAgregarAsiento.Visible = true; } else { txtCantEntradas.Text = (cant - 1).ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { /// <summary> /// Trae los datos del tipo de ticket a modificar /// </summary> if (!IsPostBack) { TipoAsientoBLL asientosBLL = new TipoAsientoBLL(); if (Request.QueryString["id"] != null) { TiposTicketBLL tipoBLL = new TiposTicketBLL(); TiposTicketBEL tipo = tipoBLL.traerTiposTicketPorId(Int32.Parse(Request.QueryString["id"].ToString())); lblTitulo.Text = "Editar Tipo Ticket"; idTipoTicket.Text = tipo.IdTipoTicket.ToString(); txtPrecio.Text = tipo.Precio.ToString(); } ddlTipoAsiento.DataSource = asientosBLL.traerTiposAsientos(); ddlTipoAsiento.DataValueField = "IdTipoAsiento"; ddlTipoAsiento.DataTextField = "Nombre"; ddlTipoAsiento.DataBind(); } }