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();
                }
            }
        }
Example #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();
            }
        }
        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 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();
            }
        }
        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 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();
            }
        }
Example #7
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 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);
         }
     }
 }
        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();
            }
        }
Example #10
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");
                }
            }
        }
Example #11
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();
            }
        }
        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);
                    }
                }
            }
        }