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 ENSubject(String name, ENCourse course) { cad = new CADSubject(); this.name = name; this.course = course; id = 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(); }
public ENSubject(String name, ENCourse course) { cad = new CADSubject(); this.name = name; this.course = course; id = 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); }
/// <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; } }
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; } }
//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); } }
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); } }
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); }
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); }
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); }
public ENSubject() { course = new ENCourse(); cad = new CADSubject(); id = 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; } }
/// <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; } }
public ENSubject() { course = new ENCourse(); cad = new CADSubject(); id = 0; }