예제 #1
0
        private static ReceiveSchoolInfoClass GetSchoolInfo(Gdxj xj, string schoolID)
        {
            ReceiveSchoolInfoClass result = new ReceiveSchoolInfoClass();
            GetSchoolInfoClass     gsic   = new GetSchoolInfoClass(schoolID);

            try
            {
                AjaxCommand.Send.ContextCommandParams ccp = new AjaxCommand.Send.ContextCommandParams()
                {
                    @params = gsic
                };
                string json = JsonConvert.SerializeObject(ccp, Formatting.Indented);
                string html = RequestHelper.GetByPostJsonWithCsrf(setting.url.QuerySchoolInfoUrl, json, ref xj.GdxjCookie.cookie, Csrf.GetCsrfToken(), setting.url.QueryGradeRefererUrl);
                result = JsonConvert.DeserializeObject <ReceiveSchoolInfoClass>(html);
            }
            catch (Exception e)
            {
                throw (e);
            }
            return(result);
        }
예제 #2
0
        private static Dictionary <string, string> GetData(Gdxj xj, SendDataClass gdc)
        {
            Dictionary <string, string> result = new Dictionary <string, string>();
            string url = (gdc.GetType() == typeof(GetGeneralDictClass)) ? setting.url.QueryGeneralDicUrl : setting.url.QueryForDicUrl;

            try
            {
                AjaxCommand.Send.ContextCommandParams ccp = new AjaxCommand.Send.ContextCommandParams()
                {
                    @params = gdc
                };
                string json = JsonConvert.SerializeObject(ccp, Formatting.Indented);
                string html = RequestHelper.GetByPostJsonWithCsrf(url, json, ref xj.GdxjCookie.cookie, Csrf.GetCsrfToken(), setting.url.QueryGradeRefererUrl);
                ReceiveDictDataClass receiveStudentData = JsonConvert.DeserializeObject <ReceiveDictDataClass>(html);
                receiveStudentData.rows.ForEach(r =>
                {
                    result.Add(r.value, r.text);
                });
            }
            catch (Exception e)
            {
                throw (e);
            }
            return(result);
        }
예제 #3
0
        public static string GetOrganName(Gdxj xj, GetOrganDictClass godc)
        {
            string result = string.Empty;

            try
            {
                AjaxCommand.Send.ContextCommandParams ccp = new AjaxCommand.Send.ContextCommandParams()
                {
                    @params = godc
                };
                string json = JsonConvert.SerializeObject(ccp, Formatting.Indented);
                string html = RequestHelper.GetByPostJsonWithCsrf(setting.url.QueryOrganDicUrl, json, ref xj.GdxjCookie.cookie, Csrf.GetCsrfToken(), setting.url.QueryGradeRefererUrl);
                ReceiveOrganNameClass receiveData = JsonConvert.DeserializeObject <ReceiveOrganNameClass>(html);
                if (receiveData.map != null)
                {
                    result = receiveData.map.text;
                }
            }
            catch (Exception e)
            {
                throw (e);
            }
            return(result);
        }