public void LoadFields(Object anObject, TextBox textNameStudent, TextBox textLastNameStudent, TextBox textStudentNumber, NumericUpDown numericCi, NumericUpDown numericX, NumericUpDown numericY, ListBox list, ListBox listOtherSubject) { Student student = anObject as Student; textNameStudent.Text = student.Name; textLastNameStudent.Text = student.LastName; textStudentNumber.Text = student.StudentNumber + ""; numericCi.Value = student.Ci; numericX.Value = student.Coordinates.X; numericY.Value = student.Coordinates.Y; SubjectLogic logic = new SubjectLogic(); List <Subject> allSubjects = logic.GetAllSubjects(); foreach (Subject item in allSubjects) { if (student.Subjects.Contains(item)) { list.Items.Add(allSubjects.Find(x => x.Code == item.Code)); } else { listOtherSubject.Items.Add(item); } } }
public List <Subject> GetAllSubjects() { List <Subject> sList = new List <Subject>(); sList = ToSubjectList(slogic.GetAllSubjects()); return(sList); }
public void ModifySubjectName() { ClearRepository(); Subject newSubject = testSubject(); Subject editedSubject = testSubject(); SubjectLogic testLogic = new SubjectLogic(); string testName = "5"; editedSubject.Name = testName; testLogic.Add(newSubject); testLogic.Modify(newSubject, editedSubject); Assert.IsFalse(testLogic.GetAllSubjects().ElementAt(0).Name == newSubject.Name); }
public void LoadSubjectsByStudents(Object anObject, ListBox listSubjects) { Student student = anObject as Student; SubjectLogic logic = new SubjectLogic(); List <Subject> allSubjects = logic.GetAllSubjects(); foreach (Subject item in student.Subjects) { if (allSubjects.Contains(item)) { listSubjects.Items.Add(allSubjects.Find(x => x.Code == item.Code)); } } }
public void LoadSubjectsByTeacher(Object anObject, ListBox listSubjects) { Teacher teacher = anObject as Teacher; SubjectLogic logic = new SubjectLogic(); List <Subject> allSubjects = logic.GetAllSubjects(); foreach (Subject item in allSubjects) { if (teacher.Subjects.Contains(item)) { listSubjects.Items.Add(allSubjects.Find(x => x.Code == item.Code)); } } }
public void LoadAllSubjects(ListBox list) { SubjectLogic logic = new SubjectLogic(); List <Subject> allObjects = new List <Subject>(); allObjects = logic.GetAllSubjects(); if (allObjects.Count == 0) { throw new NoSubjectInSystemException("No hay Materias ingresadas en el sistema"); } foreach (Subject item in allObjects) { list.Items.Add(item); } }
public void GenerateNewCodeSuccess() { ClearRepository(); string testCode = "testCode"; SubjectLogic logic = new SubjectLogic(); logic.AddNewSubject("testName"); List <Subject> allSubjects = logic.GetAllSubjects(); bool assertion = true; if (!logic.IsEmpty()) { Subject subjectTest = allSubjects.ElementAt(0); assertion = subjectTest.Code.Equals(testCode); } Assert.IsFalse(assertion); }
public void CanIModifySubject() { ClearRepository(); Subject oldSubject = testSubject(); Subject newSubject = testSubject(); newSubject.Name = "aa"; SubjectLogic logic = new SubjectLogic(); logic.Add(oldSubject); logic.Modify(oldSubject, newSubject); List <Subject> allSubjects = logic.GetAllSubjects(); bool assertion = false; if (!logic.IsEmpty()) { Subject subjectTest = allSubjects.ElementAt(0); assertion = subjectTest.Name.Equals("aa"); } Assert.IsTrue(assertion); }
public void LoadFields(Object anObject, TextBox textName, TextBox textCode, TextBox textLastName, ListBox list, ListBox listOtherSubject) { Teacher teacher = anObject as Teacher; textName.Text = teacher.Name; textLastName.Text = teacher.LastName; textCode.Text = teacher.Id + ""; SubjectLogic logic = new SubjectLogic(); List <Subject> allSubjects = logic.GetAllSubjects(); foreach (Subject item in allSubjects) { if (teacher.Subjects.Contains(item)) { list.Items.Add(allSubjects.Find(x => x.Code == item.Code)); } else { listOtherSubject.Items.Add(item); } } }