コード例 #1
0
ファイル: ParseController.cs プロジェクト: tarasiscom/Lv-273
        private void StarsProcessUniversities()
        {
            HtmlNodeCollection univercitiesNodes = parser.RetreiveNodes(nodesXpaths["UniversitiesTypesNode"]);

            //"АР Крим", "м.Севастополь" is null
            //These sections doesn't contains any records
            if (univercitiesNodes != null)
            {
                foreach (HtmlNode univ in univercitiesNodes)
                {
                    //some univercity links return 404 code
                    if (Parser.IsAvailable(indexPage + year + univ.Attributes["href"].Value.Remove(0, 1)))
                    {
                        parser.ChangeUrl(indexPage + year + univ.Attributes["href"].Value.Remove(0, 1));
                        HtmlNode universityNode = parser.RetreiveNode(nodesXpaths["UniversitiesNode"]);
                        saver.SaveUniversity(parser.GetUniversityInfo(universityID, districtID, universityNode.SelectSingleNode(nodesXpaths["UniversitiesNamesNode"]).InnerText,
                                                                      universityNode.SelectSingleNode(nodesXpaths["UniversitiesAdressNode"]).InnerText,
                                                                      universityNode.SelectSingleNode(nodesXpaths["UniversitiesWebSitesNode"]).InnerText));
                        StartProcessSpeciality();
                    }
                    universityID++;
                }
            }
        }