Beispiel #1
0
        public static List <Student> QueryStudent(ref CookieContainer cookie, string schoolId, string classesid, int start, int limit, string grbsm)
        {
            List <Student> result = null;

            try
            {
                if (limit == 0)
                {
                    limit = AjaxCommand.Send.SendSetting.SendDataSetting.QS_limit;
                }
                AjaxCommand.Send.ContextCommandParams ccp = new AjaxCommand.Send.ContextCommandParams()
                {
                    @params = new AjaxCommand.Send.ListStudentClass(schoolId, classesid, start, limit, grbsm)
                };
                string json = JsonConvert.SerializeObject(ccp, Formatting.Indented);

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

                ReceiveStudentDataClass receiveStudentData = JsonConvert.DeserializeObject <ReceiveStudentDataClass>(html);
                result = receiveStudentData.rows;
            }
            catch (Exception e)
            {
                throw (e);
            }
            return(result);
        }
Beispiel #2
0
        public static List <Economics> GetEconomics(ref CookieContainer cookie, string studentId)
        {
            List <Economics> result = null;

            try
            {
                AjaxCommand.Send.ContextCommandParams sendData = new AjaxCommand.Send.ContextCommandParams()
                {
                    @params = new AjaxCommand.Send.GetFamilyMembers_SendData(studentId)
                };
                string json = JsonConvert.SerializeObject(sendData, Formatting.Indented);

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

                GetEconomics_ReceiveData receiveStudentData = JsonConvert.DeserializeObject <GetEconomics_ReceiveData>(html);
                result = receiveStudentData.rows;
            }
            catch (Exception e)
            {
                result = new List <Economics>();
            }
            finally
            {
            }
            return(result);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public static string GetPhotoPath(ref CookieContainer cookie, string studentId)
        {
            string result = string.Empty;

            try
            {
                AjaxCommand.Send.ContextCommandParams sendData = new AjaxCommand.Send.ContextCommandParams()
                {
                    @params = new AjaxCommand.Send.GetStudentPhoto_SendData(studentId)
                };
                string json = JsonConvert.SerializeObject(sendData, Formatting.Indented);

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

                Photo_ReceiveData receiveStudentData = JsonConvert.DeserializeObject <Photo_ReceiveData>(html);
                if (receiveStudentData.map != null)
                {
                    result = receiveStudentData.map.path;
                }
            }
            catch (Exception e)
            {
                result = string.Empty;
            }
            finally
            {
            }
            return(result);
        }
Beispiel #5
0
        public static string GetRegionName(ref CookieContainer cookie, string regionCode)
        {
            string result = "";

            try
            {
                GetRegionName_CommandSendData g = new GetRegionName_CommandSendData();
                g.SetRegionCode(regionCode);
                AjaxCommand.Send.ContextCommandParams param = new AjaxCommand.Send.ContextCommandParams()
                {
                    @params = g
                };
                string json = JsonConvert.SerializeObject(param, Formatting.Indented);

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

                GetRegionName_CommandReceiveData receive = JsonConvert.DeserializeObject <GetRegionName_CommandReceiveData>(html);
                result = receive.map.text;
            }
            catch (Exception e)
            {
                throw (e);
            }
            return(result);
        }
Beispiel #6
0
        public static void SaveStudent(ref CookieContainer cookie, Student student)
        {
            //List<Student> result = null;
            try
            {
                SaveStudent_StudentData studentData = new SaveStudent_StudentData();
                studentData.SetValue(student);
                List <Classes> cl = Classes.QueryClassesById(ref cookie, student.xxJbxxId, student.xxBjxxId);
                if (cl != null)
                {
                    if (cl.Count > 0)
                    {
                        studentData.SetValue(cl[0]);
                    }
                }
                List <Grade> gl = Grade.QueryGradeById(ref cookie, student.xxJbxxId, student.xxNjxxId);
                if (gl != null)
                {
                    if (gl.Count > 0)
                    {
                        studentData.SetValue(gl[0]);
                    }
                }
                studentData.csdmc   = SystemInfo.GetRegionName(ref cookie, studentData.csdm);
                studentData.hkszdmc = SystemInfo.GetRegionName(ref cookie, studentData.hkszdm);
                AjaxCommand.Send.SaveStudentCDClass sscd = new AjaxCommand.Send.SaveStudentCDClass(studentData);
                sscd.AddFamilyMembers(ref cookie, Family.GetFamilyMembers(ref cookie, student.xsJbxxId));
                var e = Economics.GetEconomics(ref cookie, student.xsJbxxId);
                if (e.Count == 0)
                {
                    e = Economics.GetEconomics(ref cookie, student.xsJbxxId);
                }
                Economics ee;
                if (e.Count > 0)
                {
                    ee = e[0];
                }
                else
                {
                    ee              = new Economics();
                    ee.xsJbxxId     = student.xsJbxxId;
                    ee.xxsszgjyxzdm = student.xxsszgjyxzdm;
                }
                sscd.AddEconomicsRecord(ee);
                AjaxCommand.Send.ContextCommandParams ccp = new AjaxCommand.Send.ContextCommandParams()
                {
                    @params = sscd
                };
                string json = JsonConvert.SerializeObject(ccp, Formatting.Indented);

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

                //ReceiveStudentDataClass receiveStudentData = JsonConvert.DeserializeObject<ReceiveStudentDataClass>(html);
                //result = receiveStudentData.rows;
            }
            catch (Exception e)
            {
                //throw (e);
            }
            //return result;
        }