Exemplo n.º 1
0
        public int generalRecieveData(int type)
        {
            int temp = 0;

            if (server == null)
            {
                server = new EService();
            }
            ;
            string courseid = Global.getCourseID().ToString();
            string classid  = Global.getClassID().ToString();
            string lessonid = Global.getLessonID().ToString();

            server.HandonOver("-1", "");
            if (type == 0)
            {
                temp = server.SingleProjectiveInPPT(courseid, classid, lessonid);
            }
            else if (type == 1)
            {
                temp = server.ProjectiveInPPT(courseid, classid, lessonid);
            }
            else if (type == 2)
            {
                temp = server.JudgeProjectiveInPPT(courseid, classid, lessonid);
            }
            return(temp);
        }
Exemplo n.º 2
0
        public int recieveData(string answer, string type)
        {
            int temp = 0;

            if (server == null)
            {
                server = new EService();
            }
            ;
            string courseid = Global.getCourseID().ToString();
            string classid  = Global.getClassID().ToString();
            string lessonid = Global.getLessonID().ToString();

            server.HandonOver("-1", "");

            server.SingleProjectiveInPPT(courseid, classid, lessonid);

            server.SetAnswer(answer);
            return(temp);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 文件上传----老师PPT做题或抢答
        /// </summary>
        /// <param name="filename"></param>
        public static void uploadPicture(string path)
        {
            //if (true)
            //    return;
            FileInfo fileInfo = new FileInfo(path);
            long     filesize = fileInfo.Length;

            if (filesize > 1024 * 1024 * 5)
            {
                Log.Error("file too big. " + path);
                return;
            }

            int    pos      = path.LastIndexOf("\\");
            string fileName = path.Substring(pos + 1);
            string md5      = Util.GetFileMD5(path);

            //异步同步到云服务
            string url_param = "action=fileupload";

            url_param += "&schoolid=" + schoolid;
            url_param += "&classid=" + Global.getClassID();
            url_param += "&courseid=" + Global.getCourseID();
            url_param += "&lessonid=" + Global.getLessonID();
            url_param += "&teacherid=" + Global.getTeacherID();
            url_param += "&filesize=" + filesize;
            url_param += "&md5=" + md5;
            url_param += "&filename=" + fileName;

            Thread thread = new Thread(delegate()
            {
                string url = "http://" + Global.HOST + "/upload.do" + "?" + url_param;
                string ret = HTTPReq.UploadFile(url, path);
                Log.Info(url + "," + path);
            });

            thread.Start();
            return;
        }
Exemplo n.º 4
0
        public static string doPost(string action, string data)
        {
            string data0 = "action=" + action + "&classid=" + Global.getClassID() + "&courseid=" + Global.getCourseID() + "&teacherid=" + Global.getTeacherID();

            if (data.IndexOf("lesson.get") < 0)
            {
                data0 += "&lessonid=" + Global.getLessonID();
            }
            if (data.IndexOf("schoolid=") < 0)
            {
                data0 += "&schoolid=" + Global.getSchoolID();
            }
            data = data0 + "&" + data;

            string tm          = DateTime.Now.ToString("yyyyMMddHHmmss");
            string src         = tm + "_" + Global.getSchoolID() + "_" + Global.getClassID() + "_" + KEY;
            string sign        = GetMD5(src);
            string url         = Global.url_assistant + "s=" + Global.getSchoolID() + "&r=0&classid=" + Global.getClassID() + "&t=" + tm + "&c=" + sign;
            string ret         = "";
            string keyTemp     = sign.Substring(4, 16);
            string dataEncrypt = AesEncrypt(data, keyTemp);//跟java的substring不一样

            string retCrypt = HTTPReq.HttpPost(url, dataEncrypt);

            ret = AesDecrypt(retCrypt, keyTemp);
            if (ret.Length == 0)
            {
                OfflineProcessor.AddEvent(action, url, data, tm);
            }
            Log.Info("doPost: data=" + data);
            Log.Debug("ret=" + ret);

            if (data.IndexOf("lesson.get") > 0)
            {
                handleGetLessonResponse(ret);
            }
            else if (data.IndexOf("handon") > 0 && Global.getLessonID() == 0)
            {
                handleGetLessonResponse(ret);
            }

            if (ret == null)
            {
                ret = "";
            }
            return(ret);
        }
Exemplo n.º 5
0
        public string getInfor()
        {
            string data = Global.getSchoolID() + "," + Global.getTeacherID() + "," + Global.getClassID() + "," + Global.getCourseID() + "," + Global.getLessonID();

            return(data);
        }