示例#1
0
文件: ENNew.cs 项目: rlm33/svn
 public ENNew(String idBook, ENSubject subject, ENCourse course,
              String cif, ENYear years, String name, int quantity, String description) :
     base(idBook, subject, course,
          cif, years, name, quantity, description)
 {
     cadNew = new CADNew();
 }
示例#2
0
 public ENSubject(String name, ENCourse course)
 {
     cad = new CADSubject();
     this.name = name;
     this.course = course;
     id = 0;
 }
示例#3
0
 public ENNew(String idBook, ENSubject subject, ENCourse course, 
             String cif, ENYear years, String name, int quantity, String description)
     : base(idBook,  subject,  course, 
            cif,  years,  name,  quantity,  description)
 {
     cadNew = new CADNew();
 }
示例#4
0
文件: ENSubject.cs 项目: rlm33/svn
 public ENSubject(String name, ENCourse course)
 {
     cad         = new CADSubject();
     this.name   = name;
     this.course = course;
     id          = 0;
 }
示例#5
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);
 }
示例#6
0
文件: ENCourse.cs 项目: rlm33/svn
        /// <summary>
        /// Busca el curso en la base de datos y lo devuelve.
        /// </summary>
        /// <param name="courses">String del curso a buscar en la base de datos.</param>
        /// <returns>ENCourse del curso encontrado en la base de datos.</returns>
        public ENCourse Read(int id)
        {
            try
            {
                ENCourse ret = new ENCourse();

                List <object> param = new List <object>();
                param.Add((object)id);

                ret.FromRow(cad.Select(param));

                return(ret);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#7
0
文件: ENCourse.cs 项目: rlm33/svn
        public List <ENCourse> Filter(String where)
        {
            List <ENCourse> ret   = new List <ENCourse>();
            DataTable       table = cad.SelectWhere(where);

            try
            {
                foreach (DataRow row in table.Rows)
                {
                    ENCourse course = new ENCourse();
                    course.FromRow(row);
                    ret.Add(course);
                }
                return(ret);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#8
0
 //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);
     }
 }
示例#9
0
        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);
            }
        }
示例#10
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);
 }
示例#11
0
 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);
 }
示例#12
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);
 }
示例#13
0
 public ENSubject()
 {
     course = new ENCourse();
     cad = new CADSubject();
     id = 0;
 }
示例#14
0
        public List<ENCourse> Filter(String where)
        {
            List<ENCourse> ret = new List<ENCourse>();
            DataTable table = cad.SelectWhere(where);

            try
            {

                foreach (DataRow row in table.Rows)
                {
                    ENCourse course = new ENCourse();
                    course.FromRow(row);
                    ret.Add(course);

                }
                return ret;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#15
0
        /// <summary>
        /// Busca el curso en la base de datos y lo devuelve.
        /// </summary>
        /// <param name="courses">String del curso a buscar en la base de datos.</param>
        /// <returns>ENCourse del curso encontrado en la base de datos.</returns>
        public ENCourse Read(int id)
        {
            try
            {
                ENCourse ret = new ENCourse();

                List<object> param = new List<object>();
                param.Add((object) id);

                ret.FromRow(cad.Select(param));

                return ret;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#16
0
文件: ENSubject.cs 项目: rlm33/svn
 public ENSubject()
 {
     course = new ENCourse();
     cad    = new CADSubject();
     id     = 0;
 }