private void BtnAprobar_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (dgSolicitudes.SelectedItem != null)
         {
             if (MessageBox.Show("¿Aprobar Solicitud?", "Confirmar Aprobacion", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.Yes)
             {
                 Solicitud_Credito sc = (Solicitud_Credito)dgSolicitudes.SelectedItem;
                 sc.aprobado        = "S";
                 db.Entry(sc).State = System.Data.Entity.EntityState.Modified;
                 db.SaveChanges();
                 MessageBox.Show("Solicitud Aprobada");
                 CargarGrilla();
             }
         }
         else
         {
             MessageBox.Show("Seleccione una solicitud de la lista");
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Acá iba a explotar todo, pero hay un cath... ¡No contaban con mi astucia!");
     }
 }
        private void btnActualizar_Click(object sender, RoutedEventArgs e)
        {
            if (dgSolicitudCredito.SelectedItem != null)
            {
                Solicitud_Credito sc = (Solicitud_Credito)dgSolicitudCredito.SelectedItem;

                if (chkAprobado.IsChecked == true)
                {
                    sc.aprobado = "s";
                }
                else
                {
                    sc.aprobado = "n";
                }

                if (chkInformconf.IsChecked == true)
                {
                    sc.Informconf = "s";
                }
                else
                {
                    sc.Informconf = "n";
                }

                db.Entry(sc).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                CargarGrilla();
            }
            else
            {
                MessageBox.Show("Por Favor Eliga una solicitud para Actualizar!");
            }
        }
Exemple #3
0
 private void BtnModificar_Click(object sender, RoutedEventArgs e)
 {
     if (dgPersonales.SelectedItem != null)
     {
         personal p = (personal)dgPersonales.SelectedItem;
         p.Nombre           = txtNombre.Text;
         p.Apellido         = txtApellido.Text;
         p.Documento        = txtNroDoc.Text;
         p.Cargo1           = (Cargo)cboCargo.SelectedItem;
         p.FechaNac         = dtpNacimiento.SelectedDate.Value;
         p.Telefono         = txtTelefono.Text;
         p.Direccion        = txtDireccion.Text;
         p.TipoDeDocumento1 = (TipoDeDocumento)cboTipoDoc.SelectedItem;
         if (rdbMas.IsChecked == true)
         {
             p.Sexo = 1;
         }
         else
         {
             p.Sexo = 2;
         }
         db.Entry(p).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         CargarGrilla();
         LimpiarPantalla();
     }
 }
Exemple #4
0
        private void BtnModificar_Click(object sender, RoutedEventArgs e)
        {
            if (dgClientes.SelectedItem != null)
            {
                Cliente c = (Cliente)dgClientes.SelectedItem;
                c.Nombre   = txtNombre.Text;
                c.Apellido = txtApellido.Text;

                if (chkCIP.IsChecked == true)
                {
                    c.TipoDocumento = 1;
                }
                else
                {
                    c.TipoDocumento = 2;
                }

                c.Documento = txtNroDoc.Text;

                if (rbnHombre.IsChecked == true)
                {
                    c.Sexo = 1;
                }
                else
                {
                    c.Sexo = 2;
                }

                c.RazonSocial       = txtRazonSocial.Text;
                c.Nacimiento        = dtpNacimiento.SelectedDate.Value;
                c.Telefono          = txtTelefono.Text;
                c.Direccion         = txtDireccion.Text;
                c.LugarTrabajo      = txtLugarTrabajo.Text;
                c.AntiguedadLaboral = Convert.ToInt32(txtAntiguedad.Text);
                c.DireccionLaboral  = txtDireccionLaoral.Text;

                db.Entry(c).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();

                CargarGrilla();
                LimpiarPantalla();
            }
        }
        private void BtnAgregar_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (grillado == true)
                {
                    prestamo          p   = new prestamo();
                    Solicitud_Credito sc1 = (Solicitud_Credito)dgSolicitudes.SelectedItem;
                    p.Cliente             = sc1.Cliente;
                    p.moneda              = sc1.moneda;
                    p.pre_fecha           = (DateTime)dtpFecha.SelectedDate;
                    p.pre_montosolicitado = Convert.ToInt32(txtMonSolicitado.Text);
                    p.pre_montototal      = Convert.ToInt32(txtMonTotal.Text);
                    p.tipo_prestamo       = (tipo_prestamo)cmbTipo.SelectedItem;
                    p.pre_cantcuota       = Convert.ToInt32(txtCuotas.Text);
                    p.pre_interes         = Convert.ToInt32(txtInteres.Text);
                    db.prestamo.Add(p);
                    db.SaveChanges();

                    sc1.aprobado        = "X";
                    db.Entry(sc1).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();

                    CargarGrilla();
                    Limpiar();

                    MessageBox.Show("Registro Agregado Correctamente!");
                }
                else
                {
                    MessageBox.Show("Debe generar las cuotas");
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }