Exemplo n.º 1
0
        protected void BuscarButton_Click(object sender, EventArgs e)
        {
            if (ValidarIdEntero(IngresoTextBox.Text) > 0)
            {
                if (Ingreso.Buscar(ValidarIdEntero(IngresoTextBox.Text)))
                {
                    FechaTexBox.Text = Ingreso.Fecha;

                    MontoTexBox.Text = Ingreso.Monto.ToString();

                    CuentaDropDownList.SelectedValue = Ingreso.CuentaId.ToString();

                    TipoIngresoDropDownList.SelectedValue = Ingreso.TipoIngresoId.ToString();

                    MiembroDropDownList.SelectedValue = Ingreso.MiembroId.ToString();

                    ObservacionTexBox.Text = Ingreso.Observacion;
                }
                else
                {
                    Utilitarios.ShowToastr(this.Page, "No hay Registro", "Error", "Error");
                    Limpiar();
                }
            }
            else
            {
                Utilitarios.ShowToastr(this.Page, "Ingrese un numero Valido", "Error", "Error");
                Limpiar();
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int IdIngreso = 0;

            if (!IsPostBack)
            {
                int.TryParse(Request.QueryString["IdIngreso"], out IdIngreso);

                if (ing.Buscar(IdIngreso))
                {
                    TbIdIngreso.Text            = Convert.ToString(IdIngreso);
                    DdIdCuenta.SelectedIndex    = ing.IdCuenta;
                    DdIdCategoria.SelectedIndex = ing.IdCategoria;
                    TbFecha.Text       = ing.Fecha.ToString("yyyy-MM-dd");
                    TbValor.Text       = ing.Valor.ToString();
                    TbDescripcion.Text = ing.Descripcion;

                    BtnGuardar.Text = "Actualizar";
                }
                DdIdCategoria.DataSource     = Categorias.Lista("IdCategoria,Descripcion", "Categorias");
                DdIdCategoria.DataTextField  = "Descripcion";
                DdIdCategoria.DataValueField = "IdCategoria";
                DdIdCategoria.DataBind();

                DdIdCuenta.DataSource     = Cuentas.Lista("IdCuenta,Descripcion", "Cuentas");
                DdIdCuenta.DataTextField  = "Descripcion";
                DdIdCuenta.DataValueField = "IdCuenta";
                DdIdCuenta.DataBind();
            }
        }