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();
                }
            }
        }
Beispiel #2
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.");
                }
            }
        }
Beispiel #3
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 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;
            }
        }
Beispiel #5
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();
            }
        }