예제 #1
0
        /// <summary>
        /// 同步考次(考试时间)
        /// </summary>
        /// <returns></returns>
        private List <DictionaryModel> SysTimes()
        {
            List <DictionaryModel> datas = new List <DictionaryModel>();

            var options = new HttpClientOptions();

            options.URL              = AppHelper.UrlApplyPage;
            options.Method           = "GET";
            options.CookieCollection = CurrentCookies;
            var result = new HttpWebClientUtility().Request(options);

            if (!VerifyHelper.IsEmpty(result.Content))
            {
                var doc = HtmlDocumentHelper.Load(result.Content);
                if (doc != null)
                {
                    var timesNode = HtmlDocumentHelper.FindChildNodes(doc, AppHelper.XPathTimes);
                    if (timesNode != null)
                    {
                        foreach (var item in timesNode.Where(x => x.OriginalName == "a"))
                        {
                            var valueAttribute = item.Attributes["attrval"];
                            if (valueAttribute != null)
                            {
                                datas.Add(new DictionaryModel()
                                {
                                    Id     = Guid.NewGuid(),
                                    Genre  = AppConst.DictionaryTimes,
                                    Name   = StringHelper.Get(item.InnerText),
                                    Value  = StringHelper.Get(valueAttribute.Value),
                                    Parent = "",
                                    Sort   = 0
                                });
                            }
                        }
                    }
                }
            }

            return(datas);
        }