コード例 #1
0
        static void ShowAttendances(Subject s)
        {
            Console.WriteLine("Trwa pobieranie danych...");

            if (attendances == null)
            {
                attendances = client.GetAttendances();
            }
            if (attendancesDict == null)
            {
                attendancesDict = client.GetAttendancesIDDictionary();
            }
            if (categories == null)
            {
                categories = client.GetAttendanceCategories();
            }
            if (categoriesDict == null)
            {
                categoriesDict = client.GetAttendanceCategoriesIDDictionary();
            }
            if (lessons == null)
            {
                lessons = client.GetLessons();
            }
            if (lessonsDict == null)
            {
                lessonsDict = client.GetLessonsIDDictionary();
            }
            Console.Clear();
            int total        = 0;
            int absenceCount = 0;

            for (int i = 0; i < attendances.Count; i++)
            {
                Attendance a = attendances[i];
                if (lessonsDict[a.LessonID].SubjectID == s.ID.ToString())
                {
                    total++;
                    if (!categoriesDict[a.TypeID].IsPresenceType)
                    {
                        absenceCount++;
                    }
                }
            }
            double absences = double.Parse(absenceCount.ToString());
            double all      = double.Parse(total.ToString());

            Console.WriteLine(s.Name);
            Console.WriteLine("Nieobecności: {0}", absenceCount);
            Console.WriteLine("Frekwencja: {0}", 100 - Math.Round(absences / all * 100, 1) + @"%" + Environment.NewLine);
            Console.WriteLine("Nacisnij dowolny klawisz aby wrócić...");
            Console.ReadKey(false);
            ShowSubjects();
        }
コード例 #2
0
        private static void displayLessons()
        {
            Console.WriteLine("Lessons:");
            if (lessons == null)
            {
                lessons = client.GetLessons();
            }
            Dictionary <string, Teacher> teachersDictionary = client.GetTeachersIDDictionary();
            Dictionary <string, Subject> subjectDictionary  = client.GetSubjectsIDDictionary();

            for (int i = 0; i < lessons.Count; i++)
            {
                string teacherName = teachersDictionary[lessons[i].TeacherID.ToString()].FullName;
                string subjectName = subjectDictionary[lessons[i].SubjectID].Name;
                string subjectId   = lessons[i].SubjectID;
                Console.WriteLine("{0} (id: {1}) - {2}", subjectName, subjectId, teacherName);
            }
        }