diff --git a/LangLang/BusinessLogic/UseCases/ExamApplicationService.cs b/LangLang/BusinessLogic/UseCases/ExamApplicationService.cs index f22f5e9..0f87e3f 100644 --- a/LangLang/BusinessLogic/UseCases/ExamApplicationService.cs +++ b/LangLang/BusinessLogic/UseCases/ExamApplicationService.cs @@ -39,7 +39,7 @@ public ExamApplication Add(ExamApplication application) var examService = new ExamSlotService(); ExamSlot? exam = examService.Get(application.ExamSlotId); - examService.AddStudent(exam); + examService.IncrementApplicants(exam); _applications.Add(application); return application; } @@ -52,7 +52,7 @@ public ExamApplication Add(ExamApplication application) var examService = new ExamSlotService(); ExamSlot? exam = examService.Get(application.ExamSlotId); - examService.RemoveStudent(exam); + examService.DecrementApplicants(exam); _applications.Delete(application.Id); return application; } @@ -104,7 +104,9 @@ public bool CancelApplication(ExamApplication application) } private bool CanBeCanceled(ExamSlot exam) { - return exam.TimeSlot.Time.Date - DateTime.Now.Date > TimeSpan.FromDays(Constants.EXAM_CANCELATION_PERIOD); + var timeService = new TimeSlotService(); + var timeSlot = timeService.Get(exam.TimeSlotId); + return timeSlot.Time.Date - DateTime.Now.Date > TimeSpan.FromDays(Constants.EXAM_CANCELATION_PERIOD); } public bool HasApplied(Student student, ExamSlot exam) diff --git a/LangLang/BusinessLogic/UseCases/ExamResultService.cs b/LangLang/BusinessLogic/UseCases/ExamResultService.cs index 073dece..d89c158 100644 --- a/LangLang/BusinessLogic/UseCases/ExamResultService.cs +++ b/LangLang/BusinessLogic/UseCases/ExamResultService.cs @@ -66,12 +66,14 @@ public bool HasPreliminaryResults(Student student) } public bool IsResultForCourse(ExamResult result,Course course) { - ExamSlotService examsService = new(); - ExamSlot exam = examsService.Get(result.ExamSlotId); - if(exam.Language == course.Language && exam.Level == course.Level) - { + var examService = new ExamSlotService(); + var languageService = new LanguageLevelService(); + + ExamSlot exam = examService.Get(result.ExamSlotId); + var examLanguage = languageService.Get(exam.LanguageId); + + if (examLanguage.Language == course.Language && examLanguage.Level == course.Level) return true; - } return false; } } diff --git a/LangLang/BusinessLogic/UseCases/LanguageLevelService.cs b/LangLang/BusinessLogic/UseCases/LanguageLevelService.cs index 76b83b2..0a14e9d 100644 --- a/LangLang/BusinessLogic/UseCases/LanguageLevelService.cs +++ b/LangLang/BusinessLogic/UseCases/LanguageLevelService.cs @@ -25,10 +25,11 @@ public List GetAll() return _language.GetAll(); } - public void Add(LanguageLevel language) + public LanguageLevel Add(LanguageLevel language) { language.Id = GenerateId(); _language.Add(language); + return language; } public LanguageLevel Get(int id) diff --git a/LangLang/BusinessLogic/UseCases/ReportService.cs b/LangLang/BusinessLogic/UseCases/ReportService.cs index 90ca3b6..6ba993b 100644 --- a/LangLang/BusinessLogic/UseCases/ReportService.cs +++ b/LangLang/BusinessLogic/UseCases/ReportService.cs @@ -219,7 +219,9 @@ public Dictionary GetNumberOfExams() private int GetNumberOfExams(string language) { var examService = new ExamSlotService(); - var exams = examService.GetAll().Where(exam => exam.Language.Equals(language, StringComparison.OrdinalIgnoreCase)).ToList(); + var languageService = new LanguageLevelService(); + + var exams = examService.GetAll().Where(exam => languageService.Get(exam.LanguageId).Language.Equals(language, StringComparison.OrdinalIgnoreCase)).ToList(); return exams.Count(exam => exam.CreatedAt >= DateTime.Now.AddYears(-1) && exam.CreatedAt <= DateTime.Now); } diff --git a/LangLang/BusinessLogic/UseCases/SenderService.cs b/LangLang/BusinessLogic/UseCases/SenderService.cs index 3c66f03..68ba628 100644 --- a/LangLang/BusinessLogic/UseCases/SenderService.cs +++ b/LangLang/BusinessLogic/UseCases/SenderService.cs @@ -164,8 +164,11 @@ public void SentCoursesCreated(Director director) private string[] GetBodyReplacements(ExamResult result, ExamSlot exam) { + var languageService = new LanguageLevelService(); + var language = languageService.Get(exam.LanguageId); + return new string[] { - exam.Language, + language.Language, result.ReadingPoints.ToString(), result.WritingPoints.ToString(), result.ListeningPoints.ToString(), @@ -176,11 +179,17 @@ private string[] GetBodyReplacements(ExamResult result, ExamSlot exam) private string[] GetSubjectReplacements(ExamSlot exam) { + var languageService = new LanguageLevelService(); + var timeService = new TimeSlotService(); + + var language = languageService.Get(exam.LanguageId); + var timeSlot = timeService.Get(exam.TimeSlotId); + return new string[] { - exam.TimeSlot.Time.ToString("dd.MM.yyyy"), - exam.Language, - exam.Level.ToString(), + timeSlot.Time.ToString("dd.MM.yyyy"), + language.Language, + language.Level.ToString() }; } diff --git a/LangLang/BusinessLogic/UseCases/SmartSystem.cs b/LangLang/BusinessLogic/UseCases/SmartSystem.cs index 76c165a..a4aae2b 100644 --- a/LangLang/BusinessLogic/UseCases/SmartSystem.cs +++ b/LangLang/BusinessLogic/UseCases/SmartSystem.cs @@ -43,8 +43,11 @@ private static int GetWeightedGrade(Grade grade, int penaltiesCount, bool knowle public static int GetTutorForExam(ExamSlot exam) { - TutorService tutorService = new(); - List tutors = tutorService.GetBySkill(exam.Language, exam.Level); + var tutorService = new TutorService(); + var languageService = new LanguageLevelService(); + var language = languageService.Get(exam.LanguageId); + + List tutors = tutorService.GetBySkill(language.Language, language.Level); if (tutors.Count == 0) return -1; TutorRatingService tutorRatingService = new(); Dictionary tutorsAndRatings = new(); diff --git a/LangLang/BusinessLogic/UseCases/TimeSlotService.cs b/LangLang/BusinessLogic/UseCases/TimeSlotService.cs index b32f089..c8f2c76 100644 --- a/LangLang/BusinessLogic/UseCases/TimeSlotService.cs +++ b/LangLang/BusinessLogic/UseCases/TimeSlotService.cs @@ -37,10 +37,11 @@ public TimeSlot Get(int id) return _timeSlot.Get(id); } - public void Add(TimeSlot timeslot) + public TimeSlot Add(TimeSlot timeslot) { timeslot.Id = GenerateId(); _timeSlot.Add(timeslot); + return timeslot; } } diff --git a/LangLang/Domain/Models/Course.cs b/LangLang/Domain/Models/Course.cs index d068859..3272ac6 100644 --- a/LangLang/Domain/Models/Course.cs +++ b/LangLang/Domain/Models/Course.cs @@ -12,7 +12,7 @@ public class Course public int Id { get; set; } public int TutorId { get; set; } public string Language { get; set; } - public LanguageLevel Level { get; set; } + public Level Level { get; set; } public int NumberOfWeeks { get; set; } public List Days { get; set; } public bool Online { get; set; } @@ -27,7 +27,7 @@ public class Course // Constructors - public Course(int id, int tutorId, string language, LanguageLevel level, int numberOfWeeks, List days, + public Course(int id, int tutorId, string language, Level level, int numberOfWeeks, List days, bool online, int numberOfStudents, int maxStudents, DateTime startDateTime, bool createdByDirector, bool modifiable, bool gratitudeEmailSent, DateTime createdAt) { Id = id; diff --git a/LangLang/Domain/Models/TimeSlot.cs b/LangLang/Domain/Models/TimeSlot.cs index b3d34a7..756625d 100644 --- a/LangLang/Domain/Models/TimeSlot.cs +++ b/LangLang/Domain/Models/TimeSlot.cs @@ -14,19 +14,6 @@ public TimeSlot(int id, double duration, DateTime time) Duration = duration; Time = time; } - // NOTE: Possibly redudant - //public TimeSlot(string duration, string time) - //{ - // try - // { - // Time = DateTime.ParseExact(time, Constants.DATE_TIME_FORMAT, null); - // } - // catch - // { - // throw new FormatException("Date is not in the correct format."); - // } - // Duration = double.Parse(duration); - //} public bool OverlappsWith(TimeSlot timeSlot) { diff --git a/LangLang/WPF/ViewModels/CourseViewModels/AvailableCoursesViewModel.cs b/LangLang/WPF/ViewModels/CourseViewModels/AvailableCoursesViewModel.cs index 006271d..597b2fe 100644 --- a/LangLang/WPF/ViewModels/CourseViewModels/AvailableCoursesViewModel.cs +++ b/LangLang/WPF/ViewModels/CourseViewModels/AvailableCoursesViewModel.cs @@ -30,7 +30,7 @@ public void SetDataForReview() CoursesForReview = courseService.GetAvailable(currentlyLoggedIn); } - public void Search(string language, LanguageLevel? level, DateTime courseStartDate, int duration, bool? online) + public void Search(string language, Level? level, DateTime courseStartDate, int duration, bool? online) { var courseService = new CourseService(); CoursesForReview = courseService.SearchCoursesByStudent(currentlyLoggedIn, language, level, courseStartDate, duration, online); diff --git a/LangLang/WPF/ViewModels/CourseViewModels/CourseSearchViewModel.cs b/LangLang/WPF/ViewModels/CourseViewModels/CourseSearchViewModel.cs index 57d3240..e57217f 100644 --- a/LangLang/WPF/ViewModels/CourseViewModels/CourseSearchViewModel.cs +++ b/LangLang/WPF/ViewModels/CourseViewModels/CourseSearchViewModel.cs @@ -40,7 +40,7 @@ public void Update() } } - public void Search(String language, LanguageLevel? level, DateTime courseStartDate, int duration, bool? online) + public void Search(String language, Level? level, DateTime courseStartDate, int duration, bool? online) { CourseService courseService = new(); CoursesForReview = courseService.SearchCoursesByTutor(LoggedIn.Id, language, level, courseStartDate, duration, !online); diff --git a/LangLang/WPF/ViewModels/CourseViewModels/CourseViewModel.cs b/LangLang/WPF/ViewModels/CourseViewModels/CourseViewModel.cs index 84fed04..a93e891 100644 --- a/LangLang/WPF/ViewModels/CourseViewModels/CourseViewModel.cs +++ b/LangLang/WPF/ViewModels/CourseViewModels/CourseViewModel.cs @@ -1,12 +1,11 @@ -using System; +using LangLang.BusinessLogic.UseCases; +using LangLang.Configuration; +using LangLang.Domain.Enums; +using LangLang.Domain.Models; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Text.RegularExpressions; -using LangLang.BusinessLogic.UseCases; -using LangLang.Domain.Models; -using LangLang.Domain.Enums; -using System.Reflection.Metadata; -using LangLang.Configuration; namespace LangLang.WPF.ViewModels.CourseViewModels { @@ -27,7 +26,7 @@ public class CourseViewModel : INotifyPropertyChanged, IDataErrorInfo public DateTime CreatedAt { get; set; } private string language; - private LanguageLevel level; + private Level level; private int numberOfWeeks; private bool online; private int maxStudents; @@ -92,7 +91,7 @@ public DateTime StartDate } } - public LanguageLevel Level + public Level Level { get { diff --git a/LangLang/WPF/ViewModels/ExamViewModels/AvailableExamsVM.cs b/LangLang/WPF/ViewModels/ExamViewModels/AvailableExamsVM.cs index c8ae8dd..5cb6087 100644 --- a/LangLang/WPF/ViewModels/ExamViewModels/AvailableExamsVM.cs +++ b/LangLang/WPF/ViewModels/ExamViewModels/AvailableExamsVM.cs @@ -70,7 +70,7 @@ public void SendApplication() } } - public void SearchExams(Student loggedIn, DateTime examDate, string language, LanguageLevel? level) + public void SearchExams(Student loggedIn, DateTime examDate, string language, Level? level) { ExamSlotService examsService = new(); ExamsForReview = examsService.SearchByStudent(loggedIn, examDate, language, level); diff --git a/LangLang/WPF/ViewModels/ExamViewModels/ExamApplicationViewModel.cs b/LangLang/WPF/ViewModels/ExamViewModels/ExamApplicationViewModel.cs index 2140633..b8aa3c6 100644 --- a/LangLang/WPF/ViewModels/ExamViewModels/ExamApplicationViewModel.cs +++ b/LangLang/WPF/ViewModels/ExamViewModels/ExamApplicationViewModel.cs @@ -19,7 +19,7 @@ public ExamApplicationViewModel() { } public string Email { get; set; } public string PhoneNumber { get; set; } public string Language { get; set; } - public LanguageLevel Level { get; set; } + public Level Level { get; set; } public DateTime ExamDateTime { get; set; } @@ -31,9 +31,14 @@ public ExamApplication ToExamApplication() public ExamApplicationViewModel(ExamApplication application) { var examService = new ExamSlotService(); - ExamSlot exam = examService.Get(application.ExamSlotId); + var timeService = new TimeSlotService(); var studentService = new StudentService(); + var languageService = new LanguageLevelService(); + + ExamSlot exam = examService.Get(application.ExamSlotId); Student student = studentService.Get(application.StudentId); + LanguageLevel language = languageService.Get(exam.LanguageId); + Id = application.Id; ExamSlotId = application.ExamSlotId; StudentId = application.StudentId; @@ -44,9 +49,9 @@ public ExamApplicationViewModel(ExamApplication application) Email = student.Profile.Email; PhoneNumber = student.Profile.PhoneNumber; - Language = exam.Language; - Level = exam.Level; - ExamDateTime = exam.TimeSlot.Time; + Language = language.Language; + Level = language.Level; + ExamDateTime = timeService.Get(exam.TimeSlotId).Time; } } diff --git a/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotCreateVM.cs b/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotCreateVM.cs index 76e7b1e..cf8bf83 100644 --- a/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotCreateVM.cs +++ b/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotCreateVM.cs @@ -51,14 +51,15 @@ public bool CreateExam() } else { - bool added = examSlotService.Add(ExamSlot.ToExamSlot()); - - if (!added) MessageBox.Show("Choose another exam date or time."); - else - { + try { + examSlotService.Add(ExamSlot.ToExamSlot()); MessageBox.Show("Exam successfuly created."); return true; } + catch (Exception e) + { + MessageBox.Show(e.Message); + } } } else diff --git a/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotSearchVM.cs b/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotSearchVM.cs index a07ceb9..f76b1e1 100644 --- a/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotSearchVM.cs +++ b/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotSearchVM.cs @@ -20,7 +20,7 @@ public ExamSlotSearchVM(Tutor loggedIn) examSlotsForReview = new List(); this.loggedIn = loggedIn; ExamSlotService examsService = new(); - examSlotsForReview = examsService.GetExams(loggedIn); + examSlotsForReview = examsService.GetByTutor(loggedIn); foreach (ExamSlot exam in examSlotsForReview) { @@ -38,7 +38,7 @@ public void SetDataForView() ExamSlots.Add(new ExamSlotViewModel(exam)); } } - public void SearchExams(Tutor loggedIn,DateTime examDate,string language,LanguageLevel? level) + public void SearchExams(Tutor loggedIn, DateTime examDate, string language, Level? level) { ExamSlotService examsService = new(); examSlotsForReview = examsService.SearchByTutor(loggedIn, examDate, language, level); @@ -49,7 +49,7 @@ public void SearchExams(Tutor loggedIn,DateTime examDate,string language,Languag public void ClearExams() { ExamSlotService examsService = new(); - examSlotsForReview = examsService.GetExams(loggedIn); + examSlotsForReview = examsService.GetByTutor(loggedIn); SetDataForView(); } } diff --git a/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotViewModel.cs b/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotViewModel.cs index 4d047dd..1ee4a19 100644 --- a/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotViewModel.cs +++ b/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotViewModel.cs @@ -1,4 +1,5 @@ -using LangLang.Configuration; +using LangLang.BusinessLogic.UseCases; +using LangLang.Configuration; using LangLang.Domain.Enums; using LangLang.Domain.Models; using System; @@ -15,7 +16,7 @@ public class ExamSlotViewModel : INotifyPropertyChanged, IDataErrorInfo public int TutorId { get; set; } private string language; - private LanguageLevel level; + private Level level; private int maxStudents; private DateTime examDate; private string time; @@ -37,7 +38,7 @@ public string Language } } - public LanguageLevel Level + public Level Level { get { return level; } set @@ -161,13 +162,18 @@ public ExamSlotViewModel() { } public ExamSlotViewModel(ExamSlot examSlot) { + var languageService = new LanguageLevelService(); + var language = languageService.Get(examSlot.LanguageId); + var timeService = new TimeSlotService(); + var time = timeService.Get(examSlot.TimeSlotId); + Id = examSlot.Id; TutorId = examSlot.TutorId; - Language = examSlot.Language; - Level = examSlot.Level; + Language = language.Language; + Level = language.Level; MaxStudents = examSlot.MaxStudents.ToString(); - ExamDate = examSlot.TimeSlot.Time; - Time = examSlot.TimeSlot.Time.ToString("HH:mm"); + ExamDate = time.Time; + Time = time.Time.ToString("HH:mm"); Applicants = examSlot.Applicants; Modifiable = examSlot.Modifiable; ResultsGenerated = examSlot.ResultsGenerated; @@ -177,10 +183,16 @@ public ExamSlotViewModel(ExamSlot examSlot) public ExamSlot ToExamSlot() { + var timeService = new TimeSlotService(); string[] timeParts = time.Split(':'); int hour = int.Parse(timeParts[0]); int minute = int.Parse(timeParts[1]); - return new ExamSlot(Id, language, level, new TimeSlot(Constants.EXAM_DURATION, new DateTime(examDate.Year, examDate.Month, examDate.Day, hour, minute, 0)), maxStudents, TutorId, applicants, Modifiable, ResultsGenerated, ExamineesNotified, CreatedAt); + // TODO: remove id + var timeSlot = new TimeSlot(0,Constants.EXAM_DURATION, new DateTime(examDate.Year, examDate.Month, examDate.Day, hour, minute, 0)); + timeSlot = timeService.Add(timeSlot); + var languageService = new LanguageLevelService(); + var languageLevel = languageService.Add(new LanguageLevel(0, language, level)); + return new ExamSlot(Id, languageLevel.Id, timeSlot.Id, maxStudents, TutorId, applicants, Modifiable, ResultsGenerated, ExamineesNotified, CreatedAt); } public event PropertyChangedEventHandler? PropertyChanged; diff --git a/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotsTutorViewModel.cs b/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotsTutorViewModel.cs index 95f9d84..4b496f6 100644 --- a/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotsTutorViewModel.cs +++ b/LangLang/WPF/ViewModels/ExamViewModels/ExamSlotsTutorViewModel.cs @@ -26,7 +26,7 @@ public void SetDataForReview() ExamSlots.Clear(); ExamSlotService examSlotService = new(); - foreach (ExamSlot exam in examSlotService.GetExams(LoggedIn)) + foreach (ExamSlot exam in examSlotService.GetByTutor(LoggedIn)) { ExamSlots.Add(new ExamSlotViewModel(exam)); } @@ -47,7 +47,7 @@ public void EnterResults() public void SeeApplications() { var examService = new ExamSlotService(); - if (examService.ApplicationsVisible(SelectedExamSlot.Id) && SelectedExamSlot.Applicants != 0) + if (examService.ApplicationsVisible(SelectedExamSlot.ToExamSlot()) && SelectedExamSlot.Applicants != 0) { ExamApplications applicationsWindow = new(SelectedExamSlot); applicationsWindow.Show(); @@ -74,17 +74,16 @@ public void UpdateExam(ExamsReview window) public void DeleteExam() { ExamSlotService examSlotService = new(); - if (!examSlotService.Delete(SelectedExamSlot.Id)) - { - MessageBox.Show($"Can't delete exam, there is less than {Constants.EXAM_MODIFY_PERIOD} days before exam."); - } - else - { + try { + examSlotService.Delete(SelectedExamSlot.Id); MessageBox.Show("Exam slot successfully deleted."); } - + catch (Exception e) { + MessageBox.Show(e.Message); + } SetDataForReview(); } + public bool IsExamSelected() { return SelectedExamSlot != null; diff --git a/LangLang/WPF/ViewModels/TutorViewModels/TutorReviewPageViewModel.cs b/LangLang/WPF/ViewModels/TutorViewModels/TutorReviewPageViewModel.cs index d068be3..2fb717a 100644 --- a/LangLang/WPF/ViewModels/TutorViewModels/TutorReviewPageViewModel.cs +++ b/LangLang/WPF/ViewModels/TutorViewModels/TutorReviewPageViewModel.cs @@ -57,7 +57,7 @@ public void ShowSuccess() MessageBox.Show("Tutor is successfully deleted"); } - public void Search(DateTime employmentDate, string language, LanguageLevel? level) + public void Search(DateTime employmentDate, string language, Level? level) { var tutorService = new TutorService(); TutorsForReview = tutorService.Search(employmentDate, language, level); diff --git a/LangLang/WPF/Views/DirectorView/Tabs/TutorReview.xaml.cs b/LangLang/WPF/Views/DirectorView/Tabs/TutorReview.xaml.cs index 5095bec..124491a 100644 --- a/LangLang/WPF/Views/DirectorView/Tabs/TutorReview.xaml.cs +++ b/LangLang/WPF/Views/DirectorView/Tabs/TutorReview.xaml.cs @@ -20,7 +20,7 @@ public TutorReview(DirectorWindow parent) TutorReviewViewModel = new(); DataContext = TutorReviewViewModel; DisableButtons(); - levelCB.ItemsSource = Enum.GetValues(typeof(LanguageLevel)); + levelCB.ItemsSource = Enum.GetValues(typeof(Level)); Update(); } @@ -45,9 +45,9 @@ private void DeleteTutor_Click(object sender, RoutedEventArgs e) private void Search_Click(object sender, RoutedEventArgs e) { string? language = languagetb.Text; - LanguageLevel? level = null; + Level? level = null; if (levelCB.SelectedValue != null) - level = (LanguageLevel)levelCB.SelectedValue; + level = (Level)levelCB.SelectedValue; DateTime employmentDate = datePickerEmployment.SelectedDate ?? default; TutorReviewViewModel.Search(employmentDate, language, level); } diff --git a/LangLang/WPF/Views/StudentView/Tabs/AvailableCourses.xaml.cs b/LangLang/WPF/Views/StudentView/Tabs/AvailableCourses.xaml.cs index 4157c0e..6547296 100644 --- a/LangLang/WPF/Views/StudentView/Tabs/AvailableCourses.xaml.cs +++ b/LangLang/WPF/Views/StudentView/Tabs/AvailableCourses.xaml.cs @@ -39,9 +39,9 @@ private void AdjustButton() private void SearchCourses(object sender, RoutedEventArgs e) { string? language = languagetb.Text; - LanguageLevel? level = null; + Level? level = null; if (levelCoursecb.SelectedValue != null) - level = (LanguageLevel)levelCoursecb.SelectedValue; + level = (Level)levelCoursecb.SelectedValue; DateTime courseStartDate = courseStartdp.SelectedDate ?? default; bool parsed = int.TryParse(durationtb.Text, out int duration); if (!parsed) duration = 0; diff --git a/LangLang/WPF/Views/StudentView/Tabs/AvailableExams.xaml.cs b/LangLang/WPF/Views/StudentView/Tabs/AvailableExams.xaml.cs index b4013e4..e9705e0 100644 --- a/LangLang/WPF/Views/StudentView/Tabs/AvailableExams.xaml.cs +++ b/LangLang/WPF/Views/StudentView/Tabs/AvailableExams.xaml.cs @@ -17,7 +17,7 @@ public AvailableExams( Student loggedIn, StudentWindow parentWindow) AvailableExamsVM = new(loggedIn,parentWindow); DataContext = AvailableExamsVM; Update(); - levelExamcb.ItemsSource = Enum.GetValues(typeof(LanguageLevel)); + levelExamcb.ItemsSource = Enum.GetValues(typeof(Level)); } public void Update() @@ -28,9 +28,9 @@ public void Update() private void SearchExams(object sender, RoutedEventArgs e) { string? language = languageExamtb.Text; - LanguageLevel? level = null; + Level? level = null; if (levelExamcb.SelectedValue != null) - level = (LanguageLevel)levelExamcb.SelectedValue; + level = (Level)levelExamcb.SelectedValue; DateTime examDate = examdatePicker.SelectedDate ?? default; AvailableExamsVM.SearchExams(AvailableExamsVM.loggedIn, examDate, language, level); diff --git a/LangLang/WPF/Views/TutorView/AdditionalWindows/CourseView/CourseCreateWindow.xaml.cs b/LangLang/WPF/Views/TutorView/AdditionalWindows/CourseView/CourseCreateWindow.xaml.cs index 4acfb99..acec98b 100644 --- a/LangLang/WPF/Views/TutorView/AdditionalWindows/CourseView/CourseCreateWindow.xaml.cs +++ b/LangLang/WPF/Views/TutorView/AdditionalWindows/CourseView/CourseCreateWindow.xaml.cs @@ -46,7 +46,7 @@ private void ClasssroomCb_Unchecked(object sender, RoutedEventArgs e) private void SetUpForm() { - languageLvlCb.ItemsSource = Enum.GetValues(typeof(LanguageLevel)); + languageLvlCb.ItemsSource = Enum.GetValues(typeof(Level)); classsroomCb.IsChecked = false; maxNumOfStudentsTb.IsEnabled = false; mon.IsChecked = false; diff --git a/LangLang/WPF/Views/TutorView/AdditionalWindows/CourseView/CourseSearchWindow.xaml.cs b/LangLang/WPF/Views/TutorView/AdditionalWindows/CourseView/CourseSearchWindow.xaml.cs index f419275..8f7fcaf 100644 --- a/LangLang/WPF/Views/TutorView/AdditionalWindows/CourseView/CourseSearchWindow.xaml.cs +++ b/LangLang/WPF/Views/TutorView/AdditionalWindows/CourseView/CourseSearchWindow.xaml.cs @@ -29,9 +29,9 @@ private void CoursesDataGrid_SelectionChanged(object sender, SelectionChangedEve private void SearchCourses(object sender, RoutedEventArgs e) { string? language = languagetb.Text; - LanguageLevel? level = null; + Level? level = null; if (levelCoursecb.SelectedValue != null) - level = (LanguageLevel)levelCoursecb.SelectedValue; + level = (Level)levelCoursecb.SelectedValue; DateTime courseStartDate = courseStartdp.SelectedDate ?? default; int duration = 0; int.TryParse(durationtb.Text, out duration); diff --git a/LangLang/WPF/Views/TutorView/AdditionalWindows/ExamSlotView/ExamSlotCreateWindow.xaml.cs b/LangLang/WPF/Views/TutorView/AdditionalWindows/ExamSlotView/ExamSlotCreateWindow.xaml.cs index cb471ea..8cb57cf 100644 --- a/LangLang/WPF/Views/TutorView/AdditionalWindows/ExamSlotView/ExamSlotCreateWindow.xaml.cs +++ b/LangLang/WPF/Views/TutorView/AdditionalWindows/ExamSlotView/ExamSlotCreateWindow.xaml.cs @@ -6,9 +6,6 @@ namespace LangLang.WPF.Views.TutorView.AdditionalWindows.ExamSlotView { - /// - /// Interaction logic for ExamSlotCreateWindow.xaml - /// public partial class ExamSlotCreateWindow : Window { public ExamSlotCreateVM ExamCreateVM { get; set; } @@ -40,8 +37,6 @@ private void CoursesDataGrid_SelectionChanged(object sender, SelectionChangedEve ExamCreateVM.ExamSlot.Language = ExamCreateVM.SelectedCourse.Language; levelTb.Text = ExamCreateVM.SelectedCourse.Level.ToString(); ExamCreateVM.ExamSlot.Level = ExamCreateVM.SelectedCourse.Level; - //ExamSlot.CourseId = SelectedCourse.Id; - //CoursesDataGrid.SelectedItem = null; } } diff --git a/LangLang/WPF/Views/TutorView/AdditionalWindows/ExamSlotView/ExamSlotSearchWindow.xaml.cs b/LangLang/WPF/Views/TutorView/AdditionalWindows/ExamSlotView/ExamSlotSearchWindow.xaml.cs index 7f565b8..58b2f22 100644 --- a/LangLang/WPF/Views/TutorView/AdditionalWindows/ExamSlotView/ExamSlotSearchWindow.xaml.cs +++ b/LangLang/WPF/Views/TutorView/AdditionalWindows/ExamSlotView/ExamSlotSearchWindow.xaml.cs @@ -31,9 +31,9 @@ public void Update() private void SearchExam_Click(object sender, RoutedEventArgs e) { string? language = languageExamtb.Text; - LanguageLevel? level = null; + Level? level = null; if (levelExamcb.SelectedValue != null) - level = (LanguageLevel)levelExamcb.SelectedValue; + level = (Level)levelExamcb.SelectedValue; DateTime examDate = examdatePicker.SelectedDate ?? default; ExamsSearchVM.SearchExams(ExamsSearchVM.loggedIn, examDate, language, level);