Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                PasajeNegocio negocio = new PasajeNegocio();
                listaPasajes          = negocio.listar2();
                dgvPasajes.DataSource = listaPasajes;
                dgvPasajes.DataBind();

                Session[Session.SessionID + "listaPasajes"] = listaPasajes;

                //cboti.DataSource = listaPokemons;
                //cboPokemons.DataBind();


                //cboPokemons.Items.Add("Rojo");
                //cboPokemons.Items.Add("Azul");
                //cboPokemons.Items.Add("Verde");

                if (!IsPostBack)
                { //pregunto si es la primera carga de la page
                  //txtNumeroPokemon.Text = "150";
                  //cbotipoArt.DataSource = listaArticulos;
                  //cbotipoArt.DataBind();

                    //esto es lo que necesitamos para el repeater.
                    //repetidor.DataSource = listaPokemons;
                    //repetidor.DataBind();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public void btnGuardar_Click(object sender, EventArgs e)
        {
            PasajeNegocio negocio = new PasajeNegocio();

            try
            {
                pasaje = new Pasaje();

                pasaje.CodBoleto      = txtCodBoleto.Text.Trim();
                pasaje.Viaje          = new Viaje();
                pasaje.Viaje.IdVIajes = int.Parse(ddlViajes.SelectedValue);

                decimal costoViaje = negocio.averiguarPrecio(pasaje.Viaje.IdVIajes);

                pasaje.CantBoletos = int.Parse(txtCantBoletos.Text);

                int cantbol = int.Parse(txtCantBoletos.Text);

                pasaje.PrecioTotal = cantbol * (costoViaje);
                //chofer.Estado = txtEstado.Text.Trim();

                if (pasaje.IdBoleto == 0)
                {
                    negocio.agregar(pasaje);
                }


                Response.Redirect("Pasajes.aspx");


                //else
                //    negocio.modificar(articulo);

                //Dispose();
            }
            catch (Exception EX)
            {
                throw EX;
            }
        }