Exemplo n.º 1
0
        private static void handleGetLessonResponse(string jsonstr)
        {
            if (jsonstr != null && jsonstr.Length > 10)
            {
                try
                {
                    JObject jo          = (JObject)JsonConvert.DeserializeObject(jsonstr);
                    string  _lessonid   = jo["data"]["lessonid"].ToString();
                    string  _courseid   = jo["data"]["courseid"].ToString();
                    string  _index      = jo["data"]["index"].ToString();
                    string  _coursename = jo["data"]["coursename"].ToString();
                    string  _teacherid  = jo["data"]["teacherid"].ToString();

                    Global.setLessonID(Util.toInt(_lessonid));
                    Global.setLessonIndex(Util.toInt(_index));
                    Global.setCourseName(_coursename);
                    Global.setCourseID(Util.toInt(_courseid));
                    Global.setTeacherID(Util.toInt(_teacherid));
                }
                catch (Exception e)
                {
                    Log.Error("handleGetLessonResponse exception. " + e.Message);
                }
            }
            else
            {
                Log.Error("getLesson error.");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取Lesson
        /// </summary>
        public static void setLessonOff(int manual, string accessValue, string chapter)
        {
            if (Global.getLessonID() == 0 && Global.getTeacherID() == 0)
            {
                Log.Info("setLessonOff nosync");//
            }
            else
            {
                string jsonText = doPost("lesson.off", "manual=" + manual + "&accessValue=" + accessValue + "&chapter=" + chapter);
                Log.Info(jsonText);
            }

            //清空数据
            Global.setCourseID(0);
            Global.setLessonID(0);
            Global.setLessonOff();
        }