示例#1
0
        private static List <Grade> QueryGrade(ref CookieContainer cookie, AjaxCommand.Send.ListGradeClass lgc)
        {
            List <Grade> result = null;

            try
            {
                AjaxCommand.Send.CommandParams param = new AjaxCommand.Send.CommandParams()
                {
                    @params = lgc
                };
                string json = JsonConvert.SerializeObject(param, Formatting.Indented);

                var req = Http.Post(setting.url.ZxxsXxNjxxQueryUrl).Body(json);
                req.AddHeader("Referer", setting.url.QueryGradeRefererUrl);
                req.AddHeader("_ccrf.token", Csrf.GetCsrfToken());
                string html = req.RealTimeGo().RequestString;

                //html = RequestHelper.GetByPostJsonWithCsrf(setting.url.ZxxsXxNjxxQueryUrl, json, ref cookie,Csrf.GetCsrfToken() , setting.url.QueryGradeRefererUrl);
                ReceiveGradeDataClass receiveGrade = JsonConvert.DeserializeObject <ReceiveGradeDataClass>(html);
                result = receiveGrade.rows;
            }
            catch (Exception e)
            {
                throw (e);
            }
            return(result);
        }
示例#2
0
        public static List <Grade> QueryGradeById(ref CookieContainer cookie, string schoolId, string gradeId)
        {
            List <Grade> result = null;

            try
            {
                AjaxCommand.Send.ListGradeClass g = new AjaxCommand.Send.ListGradeClass();
                g.SetSchoolId(schoolId);
                if (gradeId != string.Empty)
                {
                    g.SetGradeId(gradeId);
                }
                result = QueryGrade(ref cookie, g);
            }
            catch (Exception e)
            {
                //MessageBox.Show(e.Message, "获取数据错误", MessageBoxButton.OK, MessageBoxImage.Error);
                throw (e);
            }
            return(result);
        }