Beispiel #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();
        }