Example #1
0
        public static void RefreshTeachersList()
        {
            HTTPParser <Teacher> parser = new TeachersHTTPParser();
            string htmlCode;
            string url = HTTPGetter.TeachersUrl;

            try
            {
                htmlCode = HTTPGetter.GetCodeOfPage(url);
            }
            catch
            {
                Teachers = new List <Teacher>();
                Console.WriteLine("Ошибка получения кода страницы");
                return;
            }

            try
            {
                Teachers = parser.ParseEntitiesFromCode(htmlCode);
            }
            catch
            {
                Teachers = new List <Teacher>();
                Console.WriteLine("Ошибка парсинга");
                return;
            }

            Teachers = (from teacher in Teachers orderby teacher.Name select teacher).ToList();
        }
Example #2
0
        public static List <Group> FetchGroupsForFaculty(Faculty faculty)
        {
            if (faculty == null)
            {
                Console.WriteLine("Факультет не указан (NULL)");
                return(null);
            }

            List <Group> groups;
            int          facultyId = faculty.ID;
            var          parser    = new GroupsHTTPParser();

            string facultyGroupsUrl = HTTPGetter.GetGroupsUrlForFacultyId(facultyId);
            string htmlCode         = HTTPGetter.GetCodeOfPage(facultyGroupsUrl);

            groups = parser.ParseEntitiesFromCode(htmlCode);

            return(groups);
        }