Пример #1
0
 private void LeerTodo()
 {
     listPeople.Items.Clear();
     foreach (People p in PeopleDAO.Leer())
     {
         listPeople.Items.Add(p);
     }
 }
Пример #2
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (!NombreVacio())
     {
         PeopleDAO.Guardar(txtNombre.Text, txtApellido.Text);
         LeerTodo();
         Limpiar();
     }
 }
Пример #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);
            }
        }
Пример #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);
            }
        }