コード例 #1
0
 public void cargarGrilla(bool elim)
 {
     gvViajes.DataSource = GestorABMViaje.buscarPorDescripcion(txtbxBuscar.Text, elim);
     gvViajes.DataBind();
 }
コード例 #2
0
    protected void btnGrabar_Click(object sender, EventArgs e)
    {
        habilitar_panelRegistro(false);
        accion("Grabando..");
        Viaje h = new Viaje();

        if (validar())
        {
            if (txtCupo.Text != "")
            {
                h.cupo = Convert.ToInt32(txtCupo.Text);
            }
            else
            {
                h.cupo = -1;
            }

            h.descripcion = txtdescripcion.Text;

            if (txtPrecio.Text != "")
            {
                h.precio = Convert.ToInt32(txtPrecio.Text);
            }
            else
            {
                h.precio = -1;
            }

            h.destino = Convert.ToInt32(ddlDestino.SelectedValue);

            h.transporte = Convert.ToInt32(ddlTransporte.SelectedValue);

            h.hotel = Convert.ToInt32(ddlHotel.SelectedValue);

            if (rb_Disponibilidad.SelectedValue == "1")
            {
                h.disponible = true;
            }
            else
            {
                h.disponible = false;
            }

            if (txtFechaLlegada.Text != "")
            {
                h.fechaLlegada = Convert.ToDateTime(txtFechaLlegada.Text);
            }
            else
            {
                h.fechaLlegada = Convert.ToDateTime("01/01/2000");
            }

            if (txtFechaSalida.Text != "")
            {
                h.fechaSalida = Convert.ToDateTime(txtFechaSalida.Text);
            }
            else
            {
                h.fechaSalida = Convert.ToDateTime("01/01/2000");
            }

            if (txtimagen.Text != "")
            {
                h.imagen = txtimagen.Text;
            }

            if (!grabar)
            {
                h.id = Convert.ToInt32(txtId.Text);
            }


            GestorABMViaje.Grabar(h, grabar); //si está habilitado el textID es porq graba, sino actualiza
            cargarGrilla(chk_eliminados.Checked);
        }
    }