protected void BuscarBotton_Click(object sender, EventArgs e)
        {
            Expression <Func <Prestamos, bool> > filtro = m => true;
            RepositorioPrestamo repositorio             = new RepositorioPrestamo();

            int id = 0;

            switch (FiltroDropDownList.SelectedIndex)
            {
            //Todo
            case 0:
                filtro = d => true;
                break;

            //PrestamoId
            case 1:
                Util.ToInt(CriterioTextBox.Text);
                filtro = d => d.PrestamoId == id;
                break;

            case 2:
                filtro = d => d.Fecha.Equals(CriterioTextBox.Text);
                break;

            case 3:
                id     = Util.ToInt(CriterioTextBox.Text);
                filtro = d => (d.CuentaId == id);
                break;
            }
            PrestamoGridView.DataSource = repositorio.GetList(filtro);
            PrestamoGridView.DataBind();
        }
Example #2
0
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            bool                paso     = false;
            Prestamos           prestamo = new Prestamos();
            RepositorioPrestamo repo     = new RepositorioPrestamo();

            if (IsValid == false)
            {
                Util.ShowToastr(this.Page, " Campos Vacios", "Error", "Error");
            }

            prestamo = LlenaClase(prestamo);
            if (prestamo.PrestamoId == 0)
            {
                paso = repo.Guardar(prestamo);
                Util.ShowToastr(this.Page, "Guardado con EXITO", "Guardado", "Success");
            }
            else
            {
                paso = repo.Modificar(prestamo);
                Util.ShowToastr(this.Page, "Modificado con EXITO", "Guardado", "Success");
            }

            if (paso)
            {
                Clean();
            }
            else
            {
                Util.ShowToastr(this.Page, "No se pudo Guardar", "Error", "Error");
            }
        }
Example #3
0
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            int id = Util.ToInt(IdPrestamoTextBox.Text);
            RepositorioPrestamo repo = new RepositorioPrestamo();

            if (repo.Eliminar(id))
            {
                Util.ShowToastr(this.Page, " Eliminado con EXITO", "Eliminado", "Success");
                Clean();
            }
            else
            {
                Util.ShowToastr(this.Page, " No se pudo eliminar", "Error", "Error");
            }
        }
Example #4
0
        protected void ButtonBuscar_Click(object sender, EventArgs e)
        {
            RepositorioPrestamo rep      = new RepositorioPrestamo();
            Prestamos           prestamo = rep.Buscar(int.Parse(TextBoxPrestamoID.Text));

            if (prestamo != null)
            {
                LlenarCampos(prestamo);
                active = true;
                ViewState["Active"] = active;
                _Visible();
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('Prestamo no Encontrado')", true);
            }
        }
Example #5
0
        protected void BuscarButton_Click(object sender, EventArgs e)
        {
            RepositorioPrestamo repo = new RepositorioPrestamo();
            var prest = repo.Buscar(Util.ToInt(IdPrestamoTextBox.Text));

            if (prest != null)
            {
                //Clean();
                LlenarCampos(prest);
                Util.ShowToastr(this.Page, "Su busqueda fue exitosa", "EXITO", "Info");
            }
            else
            {
                Util.ShowToastr(this.Page, " No existe", "Error", "Error");
                Clean();
            }
        }
Example #6
0
        protected void ButtonEliminar_Click(object sender, EventArgs e)
        {
            RepositorioPrestamo rep       = new RepositorioPrestamo();
            Prestamos           prestamos = rep.Buscar(int.Parse(TextBoxPrestamoID.Text));

            if (prestamos != null)
            {
                if (rep.Eliminar(int.Parse(TextBoxPrestamoID.Text)))
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('Prestamo eliminado')", true);
                    ClearAll();
                    Invisible();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('No se pudo eliminar el prestamo')", true);
                }
            }
        }
Example #7
0
        protected void ButtonGuardar_Click(object sender, EventArgs e)
        {
            RepositorioPrestamo rep = new RepositorioPrestamo();

            if (int.Parse(TextBoxPrestamoID.Text) == 0)
            {
                if (rep.Guardar(LlenarClase()))
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('Prestamo Guardado')", true);
                    ClearAll();
                }
            }
            else
            {
                if (rep.Modificar(LlenarClase()))
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('Prestamo Modificado')", true);
                    ClearAll();
                }
            }
        }