Esempio n. 1
0
 public static FrmGestionPrestamo GetInstancia()
 {
     if (instancia == null)
     {
         instancia = new FrmGestionPrestamo();
     }
     return(instancia);
 }
        private void agregarPrestamo()
        {
            prestamo                    = new Prestamo();
            prestamo.Pre_Importe        = Convert.ToDecimal(txtImporte.Text);
            prestamo.Pre_CantidadCuotas = Convert.ToInt32(txtCuotas.Text);
            prestamo.Pre_TasaInteres    = Convert.ToDouble(txtTasaInteres.Text);
            prestamo.Pre_Fecha          = Convert.ToDateTime(dtpFecha.Text);
            prestamo.Des_Codigo         = (int)cmbDestino.SelectedValue;
            prestamo.Per_Codigo         = (int)cmbPeriodo.SelectedValue;
            prestamo.Cli_Dni            = cmbClientes.SelectedValue.ToString();

            GestionPrestamo.InsertarPrestamo(prestamo);
            bool primero = true;

            DateTime fechaAux = new DateTime();

            for (int i = 1; i <= prestamo.Pre_CantidadCuotas; i++)
            {
                Cuota cuota = new Cuota();
                cuota.Cuo_Importe = (prestamo.Pre_Importe * (decimal)prestamo.Pre_TasaInteres / 100 + prestamo.Pre_Importe) / prestamo.Pre_CantidadCuotas;
                cuota.Cuo_Numero  = i;
                if (primero)
                {
                    primero = false;
                    if (prestamo.Per_Codigo == 1)
                    {
                        cuota.Cuo_Vencimiento = prestamo.Pre_Fecha.AddDays(7);
                    }
                    else if (prestamo.Per_Codigo == 2)
                    {
                        cuota.Cuo_Vencimiento = prestamo.Pre_Fecha.AddMonths(1);
                    }
                    else if (prestamo.Per_Codigo == 3)
                    {
                        cuota.Cuo_Vencimiento = prestamo.Pre_Fecha.AddYears(1);
                    }
                }
                else
                {
                    if (prestamo.Per_Codigo == 1)
                    {
                        cuota.Cuo_Vencimiento = fechaAux.AddDays(7);
                    }
                    else if (prestamo.Per_Codigo == 2)
                    {
                        cuota.Cuo_Vencimiento = fechaAux.AddMonths(1);
                    }
                    else if (prestamo.Per_Codigo == 3)
                    {
                        cuota.Cuo_Vencimiento = fechaAux.AddYears(1);
                    }
                }
                fechaAux         = cuota.Cuo_Vencimiento;
                cuota.Pre_Numero = this.id;
                GestionDeCuotas.InsertarCuota(cuota);
            }

            frmGestionPrestamo = FrmGestionPrestamo.GetInstancia();
            frmGestionPrestamo.cargar_Prestamos();
            frmGestionPrestamo.BringToFront();
            MessageBox.Show("Préstamo agregado con éxito", "Agregar préstamo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
Esempio n. 3
0
 private void FrmMain_KeyUp(object sender, KeyEventArgs e)
 {
     if (Convert.ToInt32(e.KeyData) == Convert.ToInt32(Keys.Control) + Convert.ToInt32(Keys.D1))
     {
         activar_focus(btnInicio);
         AbrirFormEnPanel(new FrmDashboard());
     }
     if (Convert.ToInt32(e.KeyData) == Convert.ToInt32(Keys.Control) + Convert.ToInt32(Keys.D2))
     {
         int rol = UserLoginCache.UsuarioLogin.Rol_Codigo;
         if (rol == 1)
         {
             MessageBox.Show("No tiene el permiso necesario para acceder al módulo de Clientes", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             activar_focus(btnClientes);
             FrmGestionClientes.instancia = null;
             AbrirFormEnPanel(FrmGestionClientes.GetInstancia());
         }
     }
     if (Convert.ToInt32(e.KeyData) == Convert.ToInt32(Keys.Control) + Convert.ToInt32(Keys.D3))
     {
         int rol = UserLoginCache.UsuarioLogin.Rol_Codigo;
         if (rol == 2)
         {
             MessageBox.Show("No tiene el permiso necesario para acceder al módulo de Destinos", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             activar_focus(btnDestinos);
             FrmGestionDestino.instancia = null;
             AbrirFormEnPanel(FrmGestionDestino.GetInstancia());
         }
     }
     if (Convert.ToInt32(e.KeyData) == Convert.ToInt32(Keys.Control) + Convert.ToInt32(Keys.D4))
     {
         int rol = UserLoginCache.UsuarioLogin.Rol_Codigo;
         if (rol == 2)
         {
             MessageBox.Show("No tiene el permiso necesario para acceder al módulo de Periodos", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             activar_focus(btnPeriodos);
             AbrirFormEnPanel(new FrmGestionPeriodo());
         }
     }
     if (Convert.ToInt32(e.KeyData) == Convert.ToInt32(Keys.Control) + Convert.ToInt32(Keys.D5))
     {
         int rol = UserLoginCache.UsuarioLogin.Rol_Codigo;
         if (rol == 1)
         {
             MessageBox.Show("No tiene el permiso necesario para acceder al módulo de Préstamos", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             activar_focus(btnPrestamos);
             FrmGestionPrestamo.instancia = null;
             AbrirFormEnPanel(FrmGestionPrestamo.GetInstancia());
         }
     }
     if (Convert.ToInt32(e.KeyData) == Convert.ToInt32(Keys.Control) + Convert.ToInt32(Keys.D6))
     {
         int rol = UserLoginCache.UsuarioLogin.Rol_Codigo;
         if (rol == 1)
         {
             MessageBox.Show("No tiene el permiso necesario para acceder al módulo de Pagos", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             activar_focus(btnPagos);
             FrmGestionPago.instancia = null;
             AbrirFormEnPanel(FrmGestionPago.GetInstancia());
         }
     }
     if (Convert.ToInt32(e.KeyData) == Convert.ToInt32(Keys.Control) + Convert.ToInt32(Keys.D7))
     {
         int rol = UserLoginCache.UsuarioLogin.Rol_Codigo;
         if (rol == 2)
         {
             MessageBox.Show("No tiene el permiso necesario para acceder al módulo de Usuarios", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             activar_focus(btnUsuarios);
             FrmGestionUsuarios.instancia = null;
             AbrirFormEnPanel(FrmGestionUsuarios.GetInstancia());
         }
     }
 }
Esempio n. 4
0
 private void btnPrestamos_Click(object sender, EventArgs e)
 {
     activar_focus(btnPrestamos);
     FrmGestionPrestamo.instancia = null;
     AbrirFormEnPanel(FrmGestionPrestamo.GetInstancia());
 }
Esempio n. 5
0
 private void FrmGestionPrestamo_FormClosing(object sender, FormClosingEventArgs e)
 {
     instancia = null;
 }