Пример #1
0
        public void agregar(Contacto nuevo, string telefono)
        {
            int tel = int.Parse(telefono);

            if (inicio == null)
            {
                inicio = nuevo;
            }
            else if (tel < int.Parse(inicio.Telefono))
            {
                aux              = inicio;
                inicio           = nuevo;
                aux.Anterior     = inicio;
                inicio.Siguiente = aux;
            }
            else
            {
                agregar(nuevo, inicio, tel);
            }
        }
Пример #2
0
 public void agregar(Contacto nuevo, Contacto x, int telefono)
 {
     if (x == null)
     {
         aux.Siguiente  = nuevo;
         nuevo.Anterior = aux;
     }
     else if (int.Parse(x.Telefono) > telefono)
     {
         nuevo.Anterior       = x.Anterior;
         nuevo.Siguiente      = x;
         x.Anterior.Siguiente = nuevo;
         x.Anterior           = nuevo;
     }
     else
     {
         aux = x;
         agregar(nuevo, x.Siguiente, telefono);
     }
 }
Пример #3
0
        private void txtBxBuscar_Click(object sender, EventArgs e)
        {
            Contacto contacto = agenda.buscar(txtBxTelBuscar.Text);

            if (contacto == null)
            {
                MessageBox.Show("Contacto No Encontrado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                clear();
            }
            else
            {
                txtBxNombre.Text   = contacto.Nombre;
                txtBxAPaterno.Text = contacto.APaterno;
                txtBxAMaterno.Text = contacto.AMaterno;
                txtBxTelefono.Text = contacto.Telefono;
                txtBxEdad.Text     = contacto.Edad;
                txtBxEmail.Text    = contacto.Email;
                MessageBox.Show("Contacto Encontrado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }