コード例 #1
0
        private void cmdBuscar_Click(object sender, EventArgs e)
        {
            Contacto contac = agenda.Buscar(txtTelefono.Text);

            if (contac == null)
            {
                MessageBox.Show("Contacto No Encontrado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Clear();
            }
            else
            {
                txtNombre.Text     = contac.Nombre;
                txtApepaterno.Text = contac.Appaterno;
                txtApmaterno.Text  = contac.Apmaterno;
                txtEdad.Text       = contac.Edad;
                txtTelefono.Text   = contac.Telefono;
                txtEmail.Text      = contac.Email;
                MessageBox.Show("Contacto Encrontrado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #2
0
 public void agregar(Contacto nuevo, Contacto n, int tel)
 {
     if (n == null)
     {
         aux.Siguiente  = nuevo;
         nuevo.Anterior = aux;
     }
     else
     {
         if (int.Parse(n.Telefono) > tel)
         {
             nuevo.Anterior       = n.Anterior;
             nuevo.Siguiente      = n;
             n.Anterior.Siguiente = nuevo;
             n.Anterior           = nuevo;
         }
         else
         {
             aux = n;
             agregar(nuevo, n.Siguiente, tel);
         }
     }
 }
コード例 #3
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);
                }
            }
        }