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(); }
public void SubjectConnectingAndReadingAll() { var actual = new List<ENSubject>(); var advert = new ENSubject(); Assert.AreEqual(0, advert.Id); actual = advert.ReadAll(); }
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"]; }
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; }
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); }
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); }
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); }
/// <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(); }
/// <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; }
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); }
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; } }
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; } }
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); }
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; } }
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; }
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; } }