Example #1
0
        void leerMayor()
        {
            OpenFileDialog op       = new OpenFileDialog();
            string         fileName = "cuotas.txt";
            FileStream     stream   = new FileStream(fileName, FileMode.Open, FileAccess.Read);
            StreamReader   read     = new StreamReader(stream);

            while (read.Peek() > -1)
            {
                coutas m = new coutas();
                m.Perso = read.ReadLine();
                m.Ap    = read.ReadLine();
                m.Man   = Convert.ToDouble(read.ReadLine());
                may.Add(m);
            }
            read.Close();
        }
Example #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(textBox4.Text) && !string.IsNullOrEmpty(textBox5.Text) && Convert.ToDouble(textBox5.Text) > 0)
     {
         Casas    p   = new Casas();
         usuarios uss = new usuarios();
         coutas   m   = new coutas();
         p.Nocasa = textBox4.Text;
         replayUP();
         if (hallarUP)
         {
             MessageBox.Show("El número de casa introducido ya no está disponible");
             textBox4.Clear();
             hallarUP = false;
             Up       = 0;
         }
         else
         {
             p.Dpi      = textBox1.Text;
             p.Mantener = Convert.ToDouble(textBox5.Text);
             casa.Add(p);
             escCasas();
             uss.Nombre   = textBox2.Text;
             uss.Apellido = textBox3.Text;
             uss.No       = textBox4.Text;
             uss.Manten   = Convert.ToDouble(textBox5.Text);
             us.Add(uss);
             escUs();
             repetidosMayor();
             if (hallarM)
             {
                 m.Perso = textBox2.Text;
                 m.Ap    = textBox3.Text;
                 m.Man   = may[cm].Man + Convert.ToDouble(textBox5.Text);
                 may.Add(m);
                 may.RemoveAt(cm);
                 escribirMayor();
                 hallarM = false;
                 cm      = 0;
             }
             else
             {
                 m.Perso = textBox2.Text;
                 m.Ap    = textBox3.Text;
                 m.Man   = Convert.ToDouble(textBox5.Text);
                 may.Add(m);
                 escribirMayor();
                 cm = 0;
             }
             dataGridView1.DataSource = null;
             dataGridView1.DataSource = us;
             dataGridView1.Refresh();
             MessageBox.Show("Propiedad asignada exitósamente");
             textBox1.Clear();
             textBox2.Clear();
             textBox3.Clear();
             textBox4.Clear();
             textBox5.Clear();
             button2.Enabled  = false;
             textBox1.Enabled = false;
             textBox2.Enabled = false;
             textBox3.Enabled = false;
             textBox4.Enabled = false;
             textBox5.Enabled = false;
         }
     }
     else
     {
         MessageBox.Show("Debe llenar todos los campos");
     }
     mayor();
     mayorM();
     menorM();
     mayorT();
 }