public static void ShowCoursesForClass() { EducationClassStore classStore = new EducationClassStore(); bool loop = true; do { Console.Clear(); Console.WriteLine("Tryck enter för att avbryta"); string input = UserInput.GetInput <string>("Ange klass-id:"); if (input == string.Empty) { break; } EducationClass klass = classStore.FindById(input); if (klass == null) { Console.WriteLine("Finns ingen klass med det id:t"); UserInput.WaitForContinue(); } else { CoursePresenter.ShowClassCourseList(klass); loop = false; } } while (loop); }
private static void CourseSubMenuCourseLists() { Console.Clear(); Console.WriteLine("Kurslistor"); Console.WriteLine(); Console.WriteLine("1. Visa alla kurser"); Console.WriteLine("2. Visa avslutade kurser"); Console.WriteLine("3. Visa pågående kurser"); Console.WriteLine("4. Visa kommande kurser"); Console.WriteLine("5. Visa obemannade kurser"); Console.WriteLine("6. Visa avtalade kurser"); Console.WriteLine(); Console.Write("Ditt val: "); string menuChoice = UserInput.GetInput <string>(); switch (menuChoice) { default: case "0": return; case "1": CoursePresenter.ListAllCourses(); break; case "2": TeacherStaffingFinishedCourses(); break; case "3": TeacherStaffingCurrentCourses(); break; case "4": TeacherStaffingFutureCourses(); break; case "5": TeacherStaffingUnmannedCourses(); break; case "6": TeacherStaffingArrangedCourses(); break; } }
public static void CourseManagementMenu(User user) { Console.Clear(); Console.WriteLine("Hantera kurser"); Console.WriteLine(); Console.WriteLine("0. Tillbaka till föregående meny"); Console.WriteLine("1. Skapa kurs"); Console.WriteLine("2. Ta bort kurs"); Console.WriteLine("3. Ändra lärare för en kurs"); Console.WriteLine("4. Ändra kurs"); Console.WriteLine("5. Kurslistor"); Console.WriteLine("6. Visa klasslista för en kurs"); Console.WriteLine("7. Visa alla betyg för en kurs"); Console.WriteLine("8. Öppna kursplan"); Console.WriteLine("9. Kursmål"); Console.WriteLine(); Console.Write("Ditt val: "); string menuChoice = UserInput.GetInput <string>(); switch (menuChoice) { case "0": return; case "1": var creator = new CourseCreator(); var courseStore = new CourseStore(); creator.Create(courseStore); break; case "2": CoursePresenter.DeleteCourse(); break; case "3": ChangeTeacherForCourses(); break; case "4": CoursePresenter.EditCourse(); break; case "5": CourseSubMenuCourseLists(); break; case "6": ShowStudentsForCourse(user); break; case "7": ShowGradesForCourse(); break; case "8": ShowCoursePlan(user); break; case "9": CourseSubMenuGoals(); break; } }
public static void GradeStudentGoal(User grader) { var courseStore = new CourseStore(); var gradeStore = new GradeStore(); var goalStore = new GoalStore(); List <Course> courses = GetCourses(grader, courseStore).ToList(); Course course = CoursePresenter.AskForCourseById(); if (course == null) { return; } if (grader.HasLevel(UserLevel.Teacher) && course.CourseTeacher != grader.UserName) { Console.WriteLine("Du är ej lärare för den kursen"); UserInput.WaitForContinue(); return; } User student = UserManagerPresenter.SearchForUser(UserLevel.Student); EducationClass klass = student.GetClass(); if (klass == null) { Console.WriteLine("Användaren är inte en student"); UserInput.WaitForContinue(); return; } if (!klass.HasCourse(course.CourseId)) { Console.WriteLine("Klassen läser ej den kursen"); UserInput.WaitForContinue(); return; } List <Goal> goals = goalStore.FindByCourseId(course.CourseId).ToList(); foreach (Goal g in goals) { Console.WriteLine($" {g.GoalId}: {g.Description.Truncate(95)}"); } Console.WriteLine(); string goalToGrade = UserInput.GetInput <string>("Välj mål att betygsätta:"); Goal goal = goals.SingleOrDefault(g => g.GoalId == goalToGrade); if (goal == null) { Console.WriteLine($"Finns inget mål med id {goalToGrade}"); UserInput.WaitForContinue(); return; } GradeLevel gradeLevel = AskForGrade(); var grade = new Grade { StudentId = student.UserName, CourseId = course.CourseId, CourseGoal = goal.GoalId, Result = gradeLevel }; Console.WriteLine(); Console.WriteLine($"Student: {student.FullName()}"); Console.WriteLine($"Kursmål: {goal.Description.Truncate(95)}"); Console.WriteLine($"Betyg: {grade.Result}"); bool confirm = UserInput.AskConfirmation("Spara betyg?"); if (confirm) { Grade existingGrade = gradeStore.FindById(grade.GradeId); if (existingGrade == null) { gradeStore.AddItem(grade); gradeStore.Save(); } else { gradeStore.GradeStudent(student, grade); gradeStore.Save(); } } Console.WriteLine(); UserInput.WaitForContinue(); }