Example #1
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();
 }
Example #2
0
 public void SubjectConnectingAndReadingAll()
 {
     var actual = new List<ENSubject>();
     var advert = new ENSubject();
     Assert.AreEqual(0, advert.Id);
     actual = advert.ReadAll();
 }
Example #3
0
File: ENNew.cs Project: 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();
 }
Example #4
0
        protected override void FromRow(DataRow Row)
        {
            ENSubject s = base.Read((int)Row["idSubject"]);

            this.id        = s.Id;
            this.Name      = s.Name;
            this.idSubject = (int)Row["idSubject"];
        }
Example #5
0
        protected override void FromRow(DataRow Row)
        {
            ENSubject t = base.Read((int)Row["idSubject"]);

            this.IdCourse  = t.IdCourse;
            this.name      = t.Name;
            this.id        = (int)Row["ID"];
            this.idSubject = t.Id;
        }
Example #6
0
 public void SubjectUpdate()
 {
     var subject = new ENSubject().Read(1);
     var oldName = subject.Name;
     subject.Name = "testUpdateName";
     subject.Save();
     var actual = subject.Read(1);
     var actualName = subject.Name;
     actual.Name = oldName;
     actual.Save();
     Assert.AreEqual("testUpdateName", actualName);
 }
Example #7
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);
 }
Example #8
0
        public ENSubject Read(int idSubject)
        {
            cad = new CADSubject();
            ENSubject ret = new ENSubject();

            List <object> param = new List <object>();

            param.Add((object)idSubject);

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

            return(ret);
        }
Example #9
0
 /// <summary>
 /// Constructor sobrecargado que inicializa el objeto con los datos pasados por parámetro.
 /// </summary>
 /// <param name="idBook">idBook del libro.</param>
 /// <param name="subject">Asignatura a la que pertenece el libro.</param>
 /// <param name="business">Business del libro.</param>
 /// <param name="name">Nombre del libro.</param>
 /// <param name="description">Descripcion del libro.</param>
 /// <param name="picture">Ruta a la imagen del libro.</param>
 public ENBook(string idBook, ENSubject subject, ENBusiness business, string name, string description, string picture)
 {
     this.idBook = idBook;
     this.id = 0;
     this.subject = subject;
     this.business = business;
     this.name = name;
     this.description = description;
     this.picture = picture;
     subjectToLoad = -1;
     businessToLoad = -1;
     cad = new CADBook();
 }
Example #10
0
File: ENBook.cs Project: rlm33/svn
 /// <summary>
 /// Constructor por defecto que inicializa el objeto con sus campos vacios.
 /// </summary>
 public ENBook()
 {
     cad            = new CADBook();
     id             = 0;
     idBook         = "";
     subject        = null;
     business       = null;
     name           = "";
     description    = "";
     picture        = "";
     subjectToLoad  = 0;
     businessToLoad = 0;
 }
Example #11
0
 /// <summary>
 /// Constructor por defecto que inicializa el objeto con sus campos vacios.
 /// </summary>
 public ENBook()
 {
     cad = new CADBook();
     id = 0;
     idBook = "";
     subject = null;
     business = null;
     name = "";
     description = "";
     picture = "";
     subjectToLoad = 0;
     businessToLoad = 0;
 }
Example #12
0
File: ENBook.cs Project: rlm33/svn
 /// <summary>
 /// Constructor sobrecargado que inicializa el objeto con los datos pasados por parámetro.
 /// </summary>
 /// <param name="idBook">idBook del libro.</param>
 /// <param name="subject">Asignatura a la que pertenece el libro.</param>
 /// <param name="business">Business del libro.</param>
 /// <param name="name">Nombre del libro.</param>
 /// <param name="description">Descripcion del libro.</param>
 /// <param name="picture">Ruta a la imagen del libro.</param>
 public ENBook(string idBook, ENSubject subject, ENBusiness business, string name, string description, string picture)
 {
     this.idBook      = idBook;
     this.id          = 0;
     this.subject     = subject;
     this.business    = business;
     this.name        = name;
     this.description = description;
     this.picture     = picture;
     subjectToLoad    = -1;
     businessToLoad   = -1;
     cad = new CADBook();
 }
Example #13
0
 public void BookInsert()
 {
     var book = new ENBook();
     book.IdBook = "testInsertID";
     book.Name = "testInsertName";
     var testSubject = new ENSubject();
     testSubject = testSubject.Read(1);
     book.Subject = testSubject;
     book.Bussiness = (new ENBusiness()).Read(1);
     book.Save();
     var bookList = book.ReadAll();
     var actual = bookList[bookList.Count - 1];
     actual.Delete();
     Assert.AreEqual("testInsertID", actual.IdBook);
 }
Example #14
0
        public List <ENSubject> Filter(string where)
        {
            List <ENSubject> ret   = new List <ENSubject>();
            DataTable        table = cad.SelectWhere(where);

            try
            {
                foreach (DataRow row in table.Rows)
                {
                    ENSubject course = new ENSubject();
                    course.FromRow(row);
                    ret.Add(course);
                }
                return(ret);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #15
0
        public virtual List <ENSubject> ReadAll()
        {
            List <ENSubject> ret   = new List <ENSubject>();
            DataTable        table = cad.SelectAll();

            try
            {
                foreach (DataRow row in table.Rows)
                {
                    ENSubject course = new ENSubject();
                    course.FromRow(row);
                    ret.Add(course);
                }
                return(ret);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #16
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);
 }
Example #17
0
        public virtual List<ENSubject> ReadAll()
        {
            List<ENSubject> ret = new List<ENSubject>();
            DataTable table = cad.SelectAll();

            try
            {

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

                }
                return ret;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #18
0
        public ENSubject Read(int idSubject)
        {
            cad = new CADSubject();
                ENSubject ret = new ENSubject();

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

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

                return ret;
        }
Example #19
0
        public List<ENSubject> Filter(string where)
        {
            List<ENSubject> ret = new List<ENSubject>();
            DataTable table = cad.SelectWhere(where);

            try
            {

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

                }
                return ret;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }