private void LoadDisciplines(long SemesterID) { teacherIndex = App.API.TeacherGetIndex(SemesterID); CurrentSemID = SemesterID; Title = $"БРС - {SemesterList.Find(s=> s.Id == CurrentSemID)}"; GroupedDisciplineItems1.Clear(); if (teacherIndex.Subjects != null) { EmptyListText.IsVisible = false; foreach (var s in teacherIndex.Subjects) { var group = new SubjectGroup($"{s.Value.SubjectName} \n{s.Value.Degree}, {s.Value.GradeNum} курс"); foreach (var d in s.Value.Disciplines) { group.Add(new DisciplineItem( $"{s.Value.SubjectName} \n{s.Value.Degree}, {s.Value.GradeNum} курс", d.Id, string.Join('\n', teacherIndex.Groups[d.Id.ToString()]), d.TypeToString(), string.Join('\n', teacherIndex.Teachers[d.Id.ToString()].Values.Select(t => t.ShortName()).Take(4)) )); } GroupedDisciplineItems1.Add(group); } } else { EmptyListText.IsVisible = true; } }
private void LoadDisciplines(long SemesterID) { studentIndex = App.API.StudentGetIndex(SemesterID); CurrentSemID = SemesterID; Title = $"БРС - {SemesterList.Find(s => s.Id == CurrentSemID)}"; DisciplineItems.Clear(); if (studentIndex.Disciplines.Length != 0) { EmptyListText.IsVisible = false; foreach (var d in studentIndex.Disciplines) { var percent = (d.MaxCurrentRate != 0 ? ((d.Rate == null) ? 0 : Math.Min((int)d.Rate, 100)) / (double)d.MaxCurrentRate : 0).ToString("P0"); DisciplineItems.Add(new DisciplineItem(d.Id, percent, d.SubjectName, $"{((d.Rate == null) ? 0 : d.Rate)}/{d.MaxCurrentRate}/100")); } } else { EmptyListText.IsVisible = true; } }