Exemplo n.º 1
0
 private void LeerTodo()
 {
     listPeople.Items.Clear();
     foreach (People p in PeopleDAO.Leer())
     {
         listPeople.Items.Add(p);
     }
 }
Exemplo n.º 2
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (!NombreVacio())
     {
         PeopleDAO.Guardar(txtNombre.Text, txtApellido.Text);
         LeerTodo();
         Limpiar();
     }
 }
Exemplo n.º 3
0
        private void btnBorrar_Click(object sender, EventArgs e)
        {
            People peopleSelected = (People)listPeople.SelectedItem;

            if (peopleSelected != null)
            {
                PeopleDAO.Borrar(peopleSelected.Id);
                LeerTodo();
            }
            else
            {
                MessageBox.Show("No se ha elegido Persona", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 4
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            People peopleSelected = (People)listPeople.SelectedItem;

            if (peopleSelected != null)
            {
                if (!NombreVacio())
                {
                    People people = new People(peopleSelected.Id, txtNombre.Text, txtApellido.Text);
                    PeopleDAO.Modificar(people);
                    LeerTodo();
                    Limpiar();
                }
            }
            else
            {
                MessageBox.Show("No se ha elegido Persona", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }