Пример #1
0
 public void SubjectInsert()
 {
     var course = new ENCourse();
     var subject = new ENSubject();
     subject.Name = "nameTest";
     subject.Course = course.Read(1);
     subject.Save();
     var subjects = subject.ReadAll();
     var actual = subjects[subjects.Count - 1];
     actual.Delete();
     Assert.AreEqual("nameTest", actual.Name);
 }
Пример #2
0
 private void buttonGuardarNuevoLibro_Click(object sender, EventArgs e)
 {
     if (textBoxNuevoLibroIdBook.Text != "")
     {
        // try
         //{
             ENCourse course = new ENCourse();
             course = course.Read(comboBoxNuevoLibroCurso.Text);
             ENPublisher publisher = new ENPublisher();
             publisher = publisher.read(comboBoxNuevoLibroEditorial.Text);
             ENSubject subject = new ENSubject();
             //subject = subject.Course
             ENBook book = new ENBook(textBoxNuevoLibroIdBook.Text,subject,course,publisher.Cif, null,textBoxNuevoLibroNombre.Text, 1,textBoxNuevoLibroDescripcion.Text);
             book.insert();
        /* }
         catch
         {
             MessageBox.Show("Inserte un libro correcto.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }*/
     }
     else
         MessageBox.Show("Inserte un ISBN/EAN13.", "Atención!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
 }
Пример #3
0
 private void buttonEliminarCurso_Click(object sender, EventArgs e)
 {
     if (textBoxEliminarCurso.Text != "")
     {
         try
         {
             ENCourse course = new ENCourse();
             course = course.Read(textBoxEliminarCurso.Text);
             course.delete();
             textBoxEliminarCurso.Clear();
             initializeDataGridCursos();
         }
         catch
         {
             MessageBox.Show("El curso que desea eliminar no existe.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     else
         MessageBox.Show("Inserte un curso.", "Atención!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
 }