Ejemplo 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);
        }
Ejemplo n.º 2
0
        public FormTimer(string numberstr)
        {
            Log.Info("FormHandon.create,  numberstr=" + numberstr);
            al         = new ArrayList();
            alText     = new ArrayList();
            clickstate = new ArrayList();
            _classid   = Global.getClassID() + "";
            _lessonid  = Global.getLessonID() + "";
            Log.Info("debug. FormHandon._classid=" + _classid + ", _lessonid=" + _lessonid);

            _xitiId = Global.getSchoolID() + "-" + _classid + "-" + DateTime.Now.ToString("yyyyMMddHHmmss");

            //TODO: 截屏上传
            if ((EService.myppt != null && EService.myppt.isOpen()) || EService.bShowPicture)
            {
                _xitiId = "H_" + _xitiId;

                Image  img     = ScreenCapture.captureScreen(0, 0);
                string imgName = _xitiId + ".jpg";
                string imgDir  = Application.StartupPath + "\\" + DateTime.Now.ToString("yyyyMMdd");
                if (!Directory.Exists(imgDir))
                {
                    Directory.CreateDirectory(imgDir);
                }

                string imgPath = imgDir + "\\" + imgName;
                img.Save(imgPath);

                Common.uploadPicture(imgPath);
            }

            InitializeComponent();
            this.Text = "提问[" + _xitiId + "]";

            this.Height = screenHeight;
            this.Width  = screenWidth;

            StartPosition = FormStartPosition.Manual;
            SetDesktopLocation(0, screenHeight - this.Height);

            this.TopMost = true;
#if DEBUG
            this.TopMost = false;//PPTPractise
#endif
            //this.WindowState = FormWindowState.Maximized;
            this.Hide();
            this.Show();
            this.BringToFront();

            Log.Info("FormHandon Timer_start(Theout) now...");

            //t = new System.Timers.Timer(200);
            //t.Elapsed += new System.Timers.ElapsedEventHandler(Theout);
            //t.Enabled = true;
            //t.AutoReset = true;

            IntelligentRecommend.InitQuestion();
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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();
        }
Ejemplo n.º 5
0
        private void timer_lessonOff_Tick(object sender, EventArgs e)
        {
            int    lessonid    = Global.getLessonID();
            string timenow     = DateTime.Now.ToString("HHmm");
            string timeoff     = Global.getTimeOff();
            string timeon      = Global.getTimeOn();
            int    lessonIndex = Global.getLessonIndex();

            if (lessonid == 0)
            {
                return;
            }
            //if(Global.isLessonOff())
            //    return;
            if (timenow.CompareTo(timeoff) > 0)//Global.getTeacherID() > 0 &&
            {
                //过了下课时间
                CourseTime ct = m_db.getCourseTime(lessonIndex + 1);
                if (ct != null)
                {
                    if (timenow.CompareTo(ct.timeOn) > 0)
                    {
                        //Log.Info("过了下节课的上课时间 " + ct.timeOn + ", teacherid" + Global.getTeacherID());
                    }
                    else
                    {
                        int minDiff = getTimediff(timenow, ct.timeOn);
                        if (minDiff < 5 && !Global.isLessonOff())
                        {
                            Common.setLessonOff(0, "", "");//自动下课
                            Log.Info("还没有到下节课的上课时间 " + ct.timeOn + ", teacherid" + Global.getTeacherID() + ", 执行下课");
                        }
                        else
                        {
                            Log.Info("还没有到下节课的上课时间 " + ct.timeOn + ", teacherid" + Global.getTeacherID());
                        }
                        //执行下课

                        //清空lesson信息

                        //是否需要自动取lesson信息
                    }
                }
            }
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
0
        public string getInfor()
        {
            string data = Global.getSchoolID() + "," + Global.getTeacherID() + "," + Global.getClassID() + "," + Global.getCourseID() + "," + Global.getLessonID();

            return(data);
        }