Example #1
0
 private void MiCuenta_Load(object sender, EventArgs e)
 {
     Enlace.datosUsuario(usuario);
     this.labelInfoUsuario.Text = Enlace.infoUsuario.ToString();
     foreach (Libro i in LibrosUsuario)
     {
         if (!System.IO.File.Exists(@"Descargas\" + i.Nombre + ".pdf"))
         {
             // Use a try block to catch IOExceptions, to
             // handle the case of the file already being
             // opened by another process.
             try
             {
                 File.WriteAllBytes("Descargas\\" + i.Nombre + ".pdf", i.LibroPDF);
             }
             catch (System.IO.IOException ex)
             {
                 MessageBox.Show(ex.Message);
                 //return;
             }
         }
     }
 }
Example #2
0
        private void buttonAbonar_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() != string.Empty)
            {
                decimal agregarcuenta;
                if (decimal.TryParse(textBox1.Text, out agregarcuenta))
                {
                    Enlace.abonarausuario(agregarcuenta, usuario, Enlace.infoUsuario.Cantidad);
                    textBox1.Clear();
                    MessageBox.Show("Saldo enviado");
                    Enlace.datosUsuario(usuario);
                    this.labelInfoUsuario.Text = Enlace.infoUsuario.ToString();
                }

                else
                {
                    MessageBox.Show("No se pudo convertir a decimal.");
                }
            }
            else
            {
                MessageBox.Show("No ha llenado el campo.");
            }
        }