Esempio n. 1
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");
            }
        }
Esempio n. 2
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();
                }
            }
        }