private void DisplaySubjects() { subjectsTutored = selectedStudentWorker.GetSubjectsTutored(); subjectListView.Items.Clear(); int i = 0; foreach (Subject subject in subjectsTutored) { String subjStr = subject.abbreviation + " " + subject.subjectNumber; subjectListView.Items.Add(subjStr); subjectListView.Items[i].SubItems.Add(subject.name); i++; } }
private string GetSubjectString(StudentWorker studentWorker) { string subjectString = ""; //Get all subjects tutored by the student worker List <Subject> subjectList = studentWorker.GetSubjectsTutored(); //Add each subject into string foreach (Subject subject in subjectList) { subjectString += subject.abbreviation + " " + subject.subjectNumber + ", "; } //Remove the final comma if (subjectString.Length > 0) { subjectString = subjectString.Substring(0, (subjectString.Length - 2)); } return(subjectString); }