예제 #1
0
파일: ENNew.cs 프로젝트: hoem/WebSalesianos
 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 void SubjectConnectingAndReadingAll()
 {
     var actual = new List<ENSubject>();
     var advert = new ENSubject();
     Assert.AreEqual(0, advert.Id);
     actual = advert.ReadAll();
 }
예제 #3
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();
 }
예제 #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"];
        }
예제 #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;
        }
예제 #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);
 }
예제 #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);
 }
예제 #8
0
파일: ENSubject.cs 프로젝트: rlm33/svn
        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);
        }
예제 #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();
 }
예제 #10
0
파일: ENBook.cs 프로젝트: 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;
 }
예제 #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;
 }
예제 #12
0
파일: ENBook.cs 프로젝트: 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();
 }
예제 #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);
 }
예제 #14
0
파일: ENSubject.cs 프로젝트: rlm33/svn
        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;
            }
        }
예제 #15
0
파일: ENSubject.cs 프로젝트: rlm33/svn
        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;
            }
        }
예제 #16
0
파일: Admin.cs 프로젝트: hoem/WebSalesianos
 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);
 }
예제 #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;
            }
        }
예제 #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;
        }
예제 #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;
            }
        }