Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /// <summary>
            /// Carga la grilla con los tipos de tickets registrados
            /// </summary>
            if (!IsPostBack)
            {
                int idEvento = 0;

                /// <summary>
                /// Revisa si el id del evento es distinto de null para traer los datos
                /// </summary>
                if (Request.QueryString["idEvento"] != null)
                {
                    Session["idEvento"] = Request.QueryString["idEvento"].ToString();
                    idEvento            = Int32.Parse(Request.QueryString["idEvento"].ToString());
                }
                /// <summary>
                /// Si el id es null redirecciona a la pagina Eventos.aspx
                /// </summary>
                else
                {
                    Response.Redirect("Eventos.aspx");
                    return;
                }
                TiposTicketBLL tipoBLL = new TiposTicketBLL();
                grvTipos.DataSource = tipoBLL.traerTiposTicket(idEvento);
                grvTipos.DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            /// <summary>
            /// Carga la pagina con los datos del evento a comprar
            /// </summary>
            if (!IsPostBack)
            {
                TiposTicketBLL bllTipos   = new TiposTicketBLL();
                EventoBLL      bllEvento  = new EventoBLL();
                RecintoBLL     bllRecinto = new RecintoBLL();
                AsientoBLL     bllAsiento = new AsientoBLL();
                /// <summary>
                /// El usuario debe estar registrado para comprar entradas
                /// </summary>
                if (Request.QueryString["evento"] != null)
                {
                    if (Session["usuarioConectado"] == null)
                    {
                        Response.Write("<script>alert('Necesitas iniciar sesión para comprar');window.location='Registro.aspx';</script>");
                        return;
                    }
                    int idEvento = Int32.Parse(Request.QueryString["evento"].ToString());

                    EventoBEL  evento  = bllEvento.traerEventoId(idEvento);
                    RecintoBEL recinto = bllRecinto.traerRecintoPorId(evento.IdRecinto);
                    this.listaAsientos       = new ArrayList();
                    this.listaGrilla         = new ArrayList();
                    Session["listaAsientos"] = this.listaAsientos;
                    Session["listaGrilla"]   = this.listaGrilla;

                    ddlTipoEntrada.DataSource     = bllTipos.traerTiposTicket(idEvento);
                    ddlTipoEntrada.DataValueField = "IdTipoTicket";
                    ddlTipoEntrada.DataTextField  = "Descripcion";
                    ddlTipoEntrada.DataBind();
                    ddlTipoEntrada.Items.Insert(0, new ListItem("..Seleccione..", "-1"));

                    lblTitulo.Text            = evento.Nombre;
                    imgEvento.ImageUrl        = evento.Imagen;
                    lblContenido.Text         = evento.Descripcion;
                    imgRecinto.ImageUrl       = recinto.ImagenRecinto;
                    lblIdEvento.Text          = idEvento.ToString();
                    lblIdRecinto.Text         = evento.IdRecinto.ToString();
                    btnAgregarAsiento.Enabled = false;
                    btnPagar.Enabled          = false;
                    lblErrCant.Visible        = false;
                    lblselect.Visible         = false;
                }
                else
                {
                    Response.Redirect("EventosSemana.aspx");
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Elimina o modifica el tipo de ticket
        /// </summary>
        protected void grvTipos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            TiposTicketBLL tipoBLL = new TiposTicketBLL();

            /// <summary>
            /// Modifica el tipo de ticket
            /// </summary>
            if (e.CommandName.Equals("modificar"))
            {
                Response.Redirect(string.Format("AgregarTiposTicket.aspx?id={0}", e.CommandArgument.ToString()), false);
            }
            /// <summary>
            /// Elimina el tipo de ticket
            /// </summary>
            else if (e.CommandName.Equals("Eliminar"))
            {
                int idEvento = Int32.Parse(Session["idEvento"].ToString());
                tipoBLL.eliminarTiposTicket(Int32.Parse(e.CommandArgument.ToString()));
                grvTipos.DataSource = tipoBLL.traerTiposTicket(idEvento);
                grvTipos.DataBind();
            }
        }