Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
        private async Task ProcessAttendances()
        {
            Attendances = await Client.GetAttendances();

            var subjects = await Client.GetSubjects();

            Utils.Log($"subjects: {subjects.Count}");
            for (int i = 0; i < subjects.Count; i++)
            {
                ListBoxSubjects.Items.Add(new SubjecListItem(subjects[i]));
            }
        }
Ejemplo n.º 3
0
        private static void displayAttendances()
        {
            Console.WriteLine("Attendances:");
            if (attendances == null)
            {
                attendances = client.GetAttendances();
            }
            Dictionary <string, AttendanceCategory> attendanceCategoriesDictionary = client.GetAttendanceCategoriesIDDictionary();

            for (int i = 0; i < attendances.Count; i++)
            {
                string category = attendanceCategoriesDictionary[attendances[i].TypeID].Name;
                string date     = attendances[i].Date.ToString();
                string id       = attendances[i].ID;
                Console.WriteLine("{0} - {1} (id: {2})", category, date, id);
            }
        }