예제 #1
0
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                if (Calculo())
                {
                    PrestamoRepositorio rep = new PrestamoRepositorio();

                    if (ToInt(IdTextBox.Text) == 0)
                    {
                        if (rep.Guardar(LlenaClase()))
                        {
                            CallModal("Prestamo registrado. " + LlenaClase().Detalle.Count);
                            Limpiar();
                        }
                    }
                    else
                    {
                        if (rep.Modificar(LlenaClase()))
                        {
                            CallModal("Prestamo modificado.");
                            Limpiar();
                        }
                    }
                }
                else
                {
                    CallModal("Amortizacion no calculada.");
                }
            }
        }
예제 #2
0
        protected void BuscarButton_Click(object sender, EventArgs e)
        {
            PrestamoRepositorio repositorio = new PrestamoRepositorio();
            Prestamos           prestamo;

            if (PrestamoidTextBox.Text != "")
            {
                prestamo = repositorio.Buscar(util.ToInt(PrestamoidTextBox.Text));
            }
            else
            {
                util.ShowToastr(this, "Prestamo Id esta Vacio, Favor llenar", "Error", "error");
                return;
            }

            if (prestamo != null)
            {
                Limpiar();
                Llenacampos(prestamo);
                BalanceTextBox.Visible = true;
                Labelbalance.Visible   = true;
                util.ShowToastr(this, "Busqueda exitosa", "Exito", "success");
            }
            else
            {
                util.ShowToastr(this.Page, "El  Prestamo que intenta buscar no existe", "Error", "info");
                Limpiar();
            }
        }
예제 #3
0
        protected void CalcularButton_Click(object sender, EventArgs e)
        {
            ViewState["Prestamos"] = new Prestamos();
            this.BindGrid();


            PrestamoRepositorio repositorio = new PrestamoRepositorio();
            Prestamos           prestamo    = new Prestamos();
            PrestamoDetalles    cuota       = new PrestamoDetalles();



            int      fila  = Utilidades.util.ToInt(TiempoTextBox.Text);
            DateTime fecha = Convert.ToDateTime(FechaTextBox.Text);


            decimal interes = Utilidades.util.ToDecimal(InteresTextBox.Text);
            int     tiempo  = Utilidades.util.ToInt(TiempoTextBox.Text);
            decimal capital = Utilidades.util.ToDecimal(CapitalTextBox.Text);

            BalanceTextBox.Text = repositorio.BalanceCuota(capital, interes).ToString();

            if (ValidacionIT(interes, tiempo, capital) == true)
            {
                return;
            }

            interes /= 100;

            for (int i = 1; i <= fila; i++)
            {
                cuota.Interes = (interes * capital) / tiempo;
                cuota.Capital = capital / tiempo;

                decimal monto = (cuota.Interes * tiempo) + capital;
                if (i == 1)
                {
                    cuota.Balance = monto - (cuota.Interes + cuota.Capital);
                }
                else
                {
                    cuota.Balance = cuota.Balance - (cuota.Capital + cuota.Interes);
                }



                prestamo = (Prestamos)ViewState["Prestamos"];


                prestamo.AgregarDetalle(0, Utilidades.util.ToInt(PrestamoidTextBox.Text), i, cuota.Fecha.AddMonths(i), Math.Round(cuota.Interes, 2), Math.Round(cuota.Capital, 2), Math.Round(cuota.Balance, 2));

                ViewState["Prestamos"] = prestamo;


                this.BindGrid();
            }

            BalanceTextBox.Visible = true;
            Labelbalance.Visible   = true;
        }
예제 #4
0
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            PrestamoRepositorio repositorio = new PrestamoRepositorio();
            Prestamo            prestamo    = new Prestamo();
            bool paso = false;

            if (IsValid == false)
            {
                Utils.ShowToastr(this.Page, "Revisar todos los campo", "Error", "error");
                return;
            }
            prestamo = LlenaClase(prestamo);
            if (prestamo.PrestamoId == 0)
            {
                paso = repositorio.Guardar(prestamo);
            }
            else
            {
                paso = repositorio.Modificar(prestamo);
            }
            if (paso)
            {
                Utils.ShowToastr(this.Page, "Guardado con exito!!", "Guardado", "success");
            }
            else
            {
                Utils.ShowToastr(this.Page, "Revisar todos los campos", "Error", "error");
            }
        }
        protected void GuadarButton_Click(object sender, EventArgs e)
        {
            PrestamoRepositorio repositorio = new PrestamoRepositorio();
            Prestamos           prestamo    = repositorio.Buscar(Utils.ToInt(PrestamoIdTextBox.Text));

            if (prestamo == null)
            {
                if (repositorio.Guardar(LlenaClase()))
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('Guardado Correctamente')", true);

                    Limpiar();
                }
                else
                {
                    Limpiar();
                }
            }
            else
            {
                if (repositorio.Modificar(LlenaClase()))
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "Popup", "alert('Modificado Correctamente')", true);
                    Limpiar();
                }
                else
                {
                    Limpiar();
                }
            }
        }
        protected void BuscarButton_Click1(object sender, EventArgs e)
        {
            PrestamoRepositorio rep = new PrestamoRepositorio();

            Filtrar();
            PrestamoGridView.DataSource = rep.GetList(filter);
            PrestamoGridView.DataBind();
        }
        protected void PrestamoGridView_SelectedIndexChanged(object sender, EventArgs e)
        {
            PrestamoRepositorio rep = new PrestamoRepositorio();

            PrestamoGridView.DataSource = rep.GetList(filter);
            //PrestamoGridView.PageIndex = e.NewPageIndex;
            PrestamoGridView.DataBind();
        }
        protected void BtnGuardar_Click(object sender, EventArgs e)
        {
            PrestamoRepositorio repositorio            = new PrestamoRepositorio();
            Prestamo            prestamo               = LlenaClase();
            RepositorioBase <CuentasBancarias> cuentas = new RepositorioBase <CuentasBancarias>();

            bool paso = false;

            if (cuentaDropDownList != null)
            {
                if (Page.IsValid)
                {
                    if (PrestamoidTextBox.Text == "0" && Utils.ToInt(MontoLabel.Text) != 0)
                    {
                        paso = repositorio.Guardar(prestamo);
                    }
                    else if (Utils.ToInt(MontoLabel.Text) == 0)
                    {
                        Utils.ShowToastr(this, "Presionar Boton Calcular Antes de Guardar ", "Fallo", "error");
                    }
                    else if (Utils.ToInt(PrestamoidTextBox.Text) != 0)
                    {
                        var verificar = repositorio.Buscar(Utils.ToInt(PrestamoidTextBox.Text));
                        if (verificar != null)
                        {
                            paso = repositorio.Modificar(prestamo);
                        }
                        else
                        {
                            Utils.ShowToastr(this, "No se encuentra el ID", "Fallo", "error");
                            return;
                        }
                    }
                    if (paso)
                    {
                        Utils.ShowToastr(this, "Registro Con Exito", "Exito", "success");
                    }
                    else
                    {
                        Utils.ShowToastr(this, "No se pudo Guardar", "Fallo", "error");
                    }
                    LimpiarCampos();
                    return;
                }
            }
            else
            {
                Utils.ShowToastr(this, "El numero de cuenta no existe", "Fallo", "error");
                return;
            }
        }
        protected void BuscarLinkButton_Click(object sender, EventArgs e)
        {
            PrestamoRepositorio repositorio = new PrestamoRepositorio();
            Prestamos           prestamo    = repositorio.Buscar(Utils.ToInt(PrestamoIdTextBox.Text));

            if (prestamo != null)
            {
                Limpiar();
                LlenaCampos(prestamo);
            }
            else
            {
                Limpiar();
            }
        }
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            PrestamoRepositorio repositorio = new PrestamoRepositorio();
            Prestamos           prestamo    = repositorio.Buscar(Utils.ToInt(PrestamoIdTextBox.Text));

            if (prestamo != null)
            {
                repositorio.Eliminar(prestamo.PrestamoId);
                Limpiar();
            }
            else
            {
                Limpiar();
            }
        }
예제 #11
0
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(PrestamoIdTextBox.Text);
            PrestamoRepositorio repositorio = new PrestamoRepositorio();

            if (repositorio.Eliminar(id))
            {
                Utils.ShowToastr(this.Page, "Eliminado con exito!!", "Eliminado", "info");
            }
            else
            {
                Utils.ShowToastr(this.Page, "Fallo al Eliminar", "Error", "error");
            }
            Limpiar();
        }
        protected void CalcularButton_Click(object sender, EventArgs e)
        {
            int id = 0;
            PrestamoRepositorio repositorio = new PrestamoRepositorio();

            List <PrestamosDetalles> cuotas = new List <PrestamosDetalles>();

            if (PrestamoIdTextBox.Text == string.Empty)
            {
                cuotas = repositorio.CalcularCuotas(Utils.ToInt(TiempoTextBox.Text), Utils.ToDouble(CapitalTextBox.Text), (Utils.ToDouble(InteresTextBox.Text)));
            }

            ViewState["PrestamosDetalles"] = cuotas;
            DetalleGridView.DataSource     = ViewState["PrestamosDetalles"];
            DetalleGridView.DataBind();
        }
        protected void BuscarLinkButton_Click(object sender, EventArgs e)
        {
            PrestamoRepositorio repositorio = new PrestamoRepositorio();
            Prestamos           prestamo    = repositorio.Buscar(Utils.ToInt(IdTextBox.Text));

            if (prestamo != null)
            {
                Limpiar();
                LlenaCampos(prestamo);
            }
            else
            {
                Mensaje(TipoMensaje.Error, "No Se Pudo Encontrar");
                Limpiar();
            }
        }
예제 #14
0
        protected void BuscarButton_Click(object sender, EventArgs e)
        {
            PrestamoRepositorio rep      = new PrestamoRepositorio();
            Prestamos           prestamo = rep.Buscar(ToInt(IdTextBox.Text));

            if (prestamo != null)
            {
                LlenaCampo(prestamo);
                SeBusco = true;
                ViewState["SeBusco"] = SeBusco;
            }
            else
            {
                CallModal("Este prestamo no existe.");
            }
        }
        protected void EliminarLinkButton_Click(object sender, EventArgs e)
        {
            PrestamoRepositorio repositorio = new PrestamoRepositorio();
            Prestamos           prestamo    = repositorio.Buscar(Utils.ToInt(IdTextBox.Text));

            if (prestamo != null)
            {
                repositorio.Eliminar(prestamo.PrestamoId);
                Mensaje(TipoMensaje.Sucess, "Eliminado Correctamente");
                Limpiar();
            }
            else
            {
                Mensaje(TipoMensaje.Error, "No Se Pudo Eliminar");
                Limpiar();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         LlenarCombos();
         ViewState["Prestamos"] = new Prestamos();
         int id = Utils.ToInt(Request.QueryString["id"]);
         FechaTextBox.Text = DateTime.Now.ToString("yyyy-MM-dd");
         if (id > 0)
         {
             //RepositorioBase<Prestamos> repositorio = new RepositorioBase<Prestamos>();
             PrestamoRepositorio repositorio = new PrestamoRepositorio();
             Prestamos           prestamo    = repositorio.Buscar(id);
             LlenaCampos(prestamo);
         }
     }
 }
예제 #17
0
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            PrestamoRepositorio rep       = new PrestamoRepositorio();
            Prestamos           prestamos = rep.Buscar(ToInt(IdTextBox.Text));

            if (prestamos != null)
            {
                if (rep.Eliminar(ToInt(IdTextBox.Text)))
                {
                    CallModal("Prestamo eliminado");
                    Limpiar();
                }
                else
                {
                    CallModal("Prestamo no eliminado");
                }
            }
        }
예제 #18
0
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            if (DetalleGridView.Rows.Count == 0)
            {
                util.ShowToastr(this.Page, "El Grid esta Vacio, Favor de hacer el Calculo!!", "Informacio!!", "info");
                return;
            }


            PrestamoRepositorio prestamoRepositorio = new PrestamoRepositorio();
            Prestamos           prestamos           = LlenaClase();


            bool paso = false;

            if (prestamos.PrestamoId == 0)
            {
                paso = prestamoRepositorio.Guardar(prestamos);
            }
            else
            {
                var verificar = prestamoRepositorio.Buscar(util.ToInt(PrestamoidTextBox.Text));
                if (verificar != null)
                {
                    paso = prestamoRepositorio.Modificar(prestamos);
                }
                else
                {
                    util.ShowToastr(this.Page, "El Formulario que intenta modificar, no Existe!!", "Informacion!!", "info");
                    return;
                }
            }



            if (paso)
            {
                ReportePrestamo(prestamos.PrestamoId);
                Response.Write("<script>window.open('/WReportes/RepDPrestamo.aspx','_blank');</script");

                util.ShowToastr(this.Page, "Guardado con exito!!", "Guardado!!", "success");
                Limpiar();
            }
        }
예제 #19
0
        protected void BuscarLinkButton_Click(object sender, EventArgs e)
        {
            PrestamoRepositorio repositorio = new PrestamoRepositorio();
            int      id    = 0;
            DateTime desde = Convert.ToDateTime(DesdeTextBox.Text);
            DateTime hasta = Convert.ToDateTime(HastaTextBox.Text);

            if (hasta.Date < desde.Date)
            {
                Utilitarios.Utils.MostraMensaje(this, "Hasta es menor que desde", "Error", "warning");
                return;
            }

            switch (FiltroDropDownList.SelectedIndex)
            {
            case 0:    //Todo
                filtro = c => true && c.Fecha >= desde && c.Fecha <= hasta;
                break;

            case 1:    //PrestamoId
                id     = Utils.ToInt(CriterioTextBox.Text);
                filtro = c => c.PrestamoId == id && c.Fecha >= desde && c.Fecha <= hasta;
                break;

            case 2:    //Fecha
                filtro = c => c.Fecha.Equals(CriterioTextBox.Text) && c.Fecha >= desde && c.Fecha <= hasta;
                break;

            case 3:    //CuentaId
                id     = Utils.ToInt(CriterioTextBox.Text);
                filtro = c => (c.CuentaId == id) && c.Fecha >= desde && c.Fecha <= hasta;

                break;
            }

            PrestamoGridView.DataSource = repositorio.GetList(filtro);
            PrestamoGridView.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int id = Utils.ToInt(Request.QueryString["id"]);
                FechaTextBox.Text = DateTime.Now.ToString("yyyy-MM-dd");
                LlenarDropDownCuentas();
                if (id > 0)
                {
                    PrestamoRepositorio repositorio = new PrestamoRepositorio();
                    Prestamos           prestamo    = repositorio.Buscar(id);

                    if (prestamo == null)
                    {
                        Mensaje(TipoMensaje.Error, "Registro No Encontrado");
                    }
                    else
                    {
                        LlenaCampos(prestamo);
                    }
                }
            }
        }