Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                ViajeNegocio negocio = new ViajeNegocio();
                listaViajes          = negocio.listar2();
                dgvViajes.DataSource = listaViajes;
                dgvViajes.DataBind();

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

                //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;
            }
        }
Exemplo n.º 2
0
        public void btnGuardar_Click(object sender, EventArgs e)
        {
            ViajeNegocio negocio = new ViajeNegocio();

            try
            {
                viaje = new Viaje();

                viaje.CodViaje                   = txtCodViaje.Text.Trim();
                viaje.Chofer                     = new Chofer();
                viaje.Chofer.IdChofer            = int.Parse(ddlChoferes.SelectedValue);
                viaje.Micro                      = new Micro();
                viaje.Micro.IdMicro              = int.Parse(ddlMicros.SelectedValue);
                viaje.TerminalOrigen             = new Terminal();
                viaje.TerminalOrigen.IdTerminal  = int.Parse(ddlTerminalOrigen.SelectedValue);
                viaje.TerminalDestino            = new TerminalDestino();
                viaje.TerminalDestino.IdTerminal = int.Parse(ddlTerminalDestino.SelectedValue);
                viaje.FechaViaje                 = DateTime.Parse(txtFechaViaje.Text.ToString());
                viaje.Costo                      = Decimal.Parse(txtPrecio.Text);
                //chofer.Estado = txtEstado.Text.Trim();

                if (viaje.IdVIajes == 0)
                {
                    negocio.agregar(viaje);
                }


                Response.Redirect("Viajes.aspx");


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

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