Beispiel #1
0
 public void SetLocalEdutime(Models.EduTimeModel eduTime)
 {
     eduTime.CreateTime = DateTime.Now;
     //清除之前记录
     _dbService.DeleteAll <Models.EduTimeModel>();
     _dbService.Insert <Models.EduTimeModel>(eduTime);
 }
Beispiel #2
0
        public async Task <Models.EduTimeModel> GetNetEduTime()
        {
            Models.EduTimeModel eduTime = null;
            try
            {
                var re = await Services.EduService.GetEduTime(_httpService);//自己的服务器

                eduTime = re;
            }
            catch
            {
            }
            return(eduTime);
        }
Beispiel #3
0
        //获取学年学期信息
        public async Task <Models.EduTimeModel> GetEduBasicInfo(Services.HttpBaseService _httpService)
        {
            var re = await _httpService.SendRequst(calendarUri, HttpMethod.Get);

            var p    = Regex.Match(re, @"<.*weekteaching.*\s*.*\s*</p>").Value;
            var year = Regex.Match(p, @"\d+-\d+").Value;
            var term = Regex.Match(p, @".(?=学期)").Value == "二" ? 2 : 1;
            var week = Regex.Match(p, @"\d*(?=\s*教学)").Value;

            Models.EduTimeModel model = new Models.EduTimeModel();
            model.SchoolYear = year;
            model.Term       = term;
            model.Week       = int.Parse(week);
            return(model);
        }
Beispiel #4
0
        public async Task <Models.EduTimeModel> GetNetEduTime()
        {
            Models.EduTimeModel eduTime = null;
            try
            {
                var re = await EduService.GetEduTime(HttpService);//自己的服务器

                if (re == null)
                {
                    re = await CoreService.GetEduBasicInfo(HttpService);//学校的教务官网
                }
                eduTime = re;
            }
            catch
            {
            }
            return(eduTime);
        }