예제 #1
0
파일: Admin.cs 프로젝트: rlm33/svn
        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);
            }
        }
예제 #2
0
파일: Admin.cs 프로젝트: rlm33/svn
        //PEDIDOS DISTRIBUIDORES

        //CURSOS
        private void initializeDataGridCursos()
        {
            ENCourse        course = new ENCourse();
            List <ENCourse> list   = course.ReadAll();

            dataGridViewMostrarCursos.Rows.Clear();
            foreach (ENCourse c in list)
            {
                dataGridViewMostrarCursos.Rows.Add(c.Courses);
            }
        }
예제 #3
0
파일: ENSubjectTest.cs 프로젝트: rlm33/svn
        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);
        }
예제 #4
0
파일: Admin.cs 프로젝트: rlm33/svn
        private void initializeComboBox()
        {
            comboBoxNuevoLibroCurso.Items.Clear();
            ENCourse        course  = new ENCourse();
            List <ENCourse> lcourse = course.ReadAll();

            foreach (ENCourse c in lcourse)
            {
                comboBoxNuevoLibroCurso.Items.Add(c.Courses);
            }

            comboBoxNuevoLibroEditorial.Items.Clear();
            ENPublisher        publisher  = new ENPublisher();
            List <ENPublisher> lpublisher = publisher.readAll();

            foreach (ENPublisher p in lpublisher)
            {
                comboBoxNuevoLibroEditorial.Items.Add(p.Cif);
            }
        }
예제 #5
0
파일: Admin.cs 프로젝트: rlm33/svn
 private void buttonGuardarCurso_Click(object sender, EventArgs e)
 {
     if (textBoxNuevoCurso.Text != "")
     {
         try
         {
             ENCourse course = new ENCourse(textBoxNuevoCurso.Text);
             course.insert();
             textBoxNuevoCurso.Clear();
             initializeDataGridCursos();
         }
         catch
         {
             MessageBox.Show("El curso que desea añadir ya existe.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     else
     {
         MessageBox.Show("Inserte un curso.", "Atención!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
예제 #6
0
파일: Admin.cs 프로젝트: rlm33/svn
 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);
     }
 }