Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(textBox1.Text))
     {
         leerDueños();
         Form2  f2 = new Form2();
         dueños p  = new dueños();
         p.Id = textBox1.Text;
         replayPr();
         if (hallardu)
         {
             f2.dpi     = textBox1.Text;
             f2.name    = du[Du].Noms;
             f2.surname = du[Du].Ape;
             textBox1.Clear();
             hallardu = false;
             Du       = 0;
         }
         else
         {
             f2.dpi = textBox1.Text;
             f2.textBox2.Enabled = true;
             f2.textBox2.Focus();
             f2.textBox3.Enabled = true;
             textBox1.Clear();
             Du = 0;
         }
         f2.Show();
         f2.button1.Enabled = true;
     }
     else
     {
         MessageBox.Show("Porfavor introduzca el Número de DPI");
     }
 }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(textBox2.Text) && !string.IsNullOrEmpty(textBox3.Text))
            {
                Cpropiedades c = new Cpropiedades();
                replayPr();
                if (hallarPr)
                {
                    replayCP();
                    if (hallarCP)
                    {
                        c.Nom          = textBox2.Text;
                        c.Apellido     = textBox3.Text;
                        cp[cont].Cant += 1;
                        c.Cant         = cp[cont].Cant;
                        cp.Add(c);
                        cp.RemoveAt(cont);
                        escribirCantidad();
                        hallarCP = false;
                        cont     = 0;
                    }
                    else
                    {
                        cont = 0;
                    }

                    hallarPr         = false;
                    Pr               = 0;
                    textBox4.Enabled = true;
                    textBox5.Enabled = true;
                }
                else
                {
                    dueños p = new dueños();
                    p.Id   = textBox1.Text;
                    p.Noms = textBox2.Text;
                    p.Ape  = textBox3.Text;
                    du.Add(p);
                    escDueños();
                    c.Nom      = textBox2.Text;
                    c.Apellido = textBox3.Text;
                    c.Cant     = cP;
                    cp.Add(c);
                    escribirCantidad();
                    textBox4.Enabled = true;
                    textBox5.Enabled = true;
                    Pr = 0;
                }
                textBox4.Focus();
                button2.Enabled = true;
                button1.Enabled = false;
            }
            else
            {
                MessageBox.Show("Debe llenar todos los campos");
            }
        }
Example #3
0
        void leerDueños()
        {
            OpenFileDialog op       = new OpenFileDialog();
            string         fileName = "Dueños.txt";
            FileStream     stream   = new FileStream(fileName, FileMode.Open, FileAccess.Read);
            StreamReader   reader   = new StreamReader(stream);

            while (reader.Peek() > -1)
            {
                dueños p = new dueños();
                p.Id   = reader.ReadLine();
                p.Noms = reader.ReadLine();
                p.Ape  = reader.ReadLine();
                du.Add(p);
            }
            reader.Close();
        }