Exemplo n.º 1
0
 //http请求会自动将对象转为json传输,本地化方法不行 \\192.168.3.116 大军共享页面
 /// <summary>
 /// 获取页面水滴json
 /// </summary>
 /// <param name="s">userid:book:pageid</param>
 public void selBookPageData_n(string s)
 {
     IndexForm.getJson(s);
     //clr_pageInit nam = DecodeJson<clr_pageInit>(s);
     //string Func = nam.cbId;
     //string jsons = null;
     //try
     //{
     //    string[] pagenum = Regex.Split(nam.Pages, ",");
     //    List<int> pages2 = new List<int>();
     //    List<string> contents = new List<string>();
     //    foreach (var p in pagenum)
     //    {
     //        if (!string.IsNullOrWhiteSpace(p))
     //        {
     //            pages2.Add(int.Parse(p));
     //        }
     //    }
     //    foreach (var p in pages2)
     //    {
     //        string pgn = "page" + p.ToString().PadLeft(3, '0');
     //        string folderFullName = AppDomain.CurrentDomain.BaseDirectory + "Page\\data\\" + nam.UserID + "\\" + nam.BookID + "\\resource\\" + pgn + "\\" + pgn + ".json";
     //        if (File.Exists(folderFullName))
     //        {
     //            string str = GetConfigStr(folderFullName);
     //            contents.Add(str);
     //        }
     //    }
     //    if (contents.Count != 0)
     //    {
     //        jsons = EnSerialize<List<string>>(contents);
     //    }
     //    string re = EnSerialize<LocalFunMsg>(GetLocalFunMsg(jsons));
     //    JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + Func + "'," + re + ");");
     //}
     //catch (Exception ex)
     //{
     //    LocalFunMsg fas = GetLocalFunMsg("", 1,false,  ex.Message);
     //    JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + Func + "'," + fas + ");");
     //}
 }
Exemplo n.º 2
0
        /// <summary>
        /// 写本地用户操作日志
        /// </summary>
        /// <param name="operatorInfo"></param>
        /// <param name="Func"></param>
        public void userOperLog_n(string s)
        {
            IndexForm.getJson(s);
            //operatorInfo = "{\"UserID\":\"49a92e48-1f39-4382-9273-0a0d521162c6\",\"UserType\":12,\"OperID\":1102,\"Content\":\"备课模块\"}";
            string       folderFullName = AppDomain.CurrentDomain.BaseDirectory + @"Page\data\userLog.json";
            FileStream   fs;
            StreamWriter sw;

            if (File.Exists(folderFullName))
            //验证文件是否存在,有则追加,无则创建
            {
                fs = new FileStream(folderFullName, FileMode.Append, FileAccess.Write);
            }
            else
            {
                fs = new FileStream(folderFullName, FileMode.Create, FileAccess.Write);
            }
            sw = new StreamWriter(fs);
            sw.WriteLine(s + ";");
            sw.Close();
            fs.Close();
        }
Exemplo n.º 3
0
 /// <summary>
 /// 获取教学地图
 /// </summary>
 /// <param name="s"></param>
 public void getCurTeachMap_n(string s)
 {
     IndexForm.getJson(s);
     //clr_pageInit nam = DecodeJson<clr_pageInit>(s);
     //string Func = nam.cbId;
     //try
     //{
     //    string folderFullName = AppDomain.CurrentDomain.BaseDirectory + @"Page\data\" + nam.UserID + "\\" + nam.BookID + "\\resource\\" + nam.UnitID + ".json";
     //    string json = "";
     //    if (File.Exists(folderFullName))
     //    {
     //        json = GetConfigStr(folderFullName);
     //    }
     //    // string re = EnSerialize<LocalFunMsg>(GetLocalFunMsg(json));
     //    LocalFunMsg re = GetLocalFunMsg(json);
     //    string res = EnSerialize<LocalFunMsg>(re);
     //    JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + Func + "'," + res + ");");
     //}
     //catch (Exception ex)
     //{
     //    LocalFunMsg fas = GetLocalFunMsg("", 1,false,  ex.Message);
     //    JsEvent.wb.ExecuteScriptAsync("sClassJSBridge.handleMessage('" + Func + "'," + fas + ");");
     //}
 }
Exemplo n.º 4
0
        /// <summary>
        /// 创建或更新本地老师授课翻页记录
        /// </summary>
        /// <param name="s"></param>
        /// <param name="Func"></param>
        public void postTeachPage_n(string s)
        {
            IndexForm.getJson(s);
            //bool ishave = false;
            ////page = "{\"UserID\":\"49a92e48-1f39-4382-9273-0a0d521162c6\",\"BookType\":null,\"Stage\":null,\"SubjectID\":1,\"EditionID\":27,\"GradeID\":3,\"BookID\":3107,\"UnitID\":290075,\"PageNum\":15,\"PageInitID\":\"A61C09F1-E387-71B1-2E13-0D01E93E5D27\",\"ClassID\":-1,\"CreateTime\":\"/Date(1520579894000)/\",\"AspxName\":\"Teaching\",\"UnitName\":\"2 秋天的图画\"}";
            //try
            //{
            //    clr_pageInit clr_pageInit = DecodeJson<clr_pageInit>(s);
            //    string folderFullName = AppDomain.CurrentDomain.BaseDirectory + @"Page\data\teachData.json";
            //    FileStream fs;
            //    StreamWriter sw;
            //    if (File.Exists(folderFullName))
            //    //验证文件是否存在,有则追加,无则创建
            //    {
            //        string json = GetConfigStr(folderFullName);
            //        if (json == "")
            //        {
            //            fs = new FileStream(folderFullName, FileMode.Append, FileAccess.Write);
            //        }
            //        else
            //        {
            //            List<string> ss = Regex.Split(json, ";").ToList();
            //            for (int i = 0; i < ss.Count - 1; i++)
            //            {
            //                clr_pageInit clr_pageInit1 = DecodeJson<clr_pageInit>(ss[i]);
            //                if (clr_pageInit.UserID == clr_pageInit1.UserID && clr_pageInit.ClassID == clr_pageInit1.ClassID && clr_pageInit.BookID.ToString() == clr_pageInit1.BookID.ToString() && clr_pageInit.AspxName == clr_pageInit1.AspxName)
            //                {
            //                    ss[i] = s;
            //                    ishave = true;
            //                    break;
            //                }
            //            }
            //            if (ishave)
            //            {
            //                string strTemp1 = string.Join(";", ss.ToArray());
            //                s = strTemp1;
            //                fs = new FileStream(folderFullName, FileMode.Create, FileAccess.Write);
            //            }
            //            else
            //            {
            //                fs = new FileStream(folderFullName, FileMode.Append, FileAccess.Write);
            //            }
            //        }
            //    }
            //    else
            //    {
            //        fs = new FileStream(folderFullName, FileMode.Create, FileAccess.Write);
            //    }
            //    sw = new StreamWriter(fs,Encoding.UTF8);
            //    if (ishave)
            //    {
            //        sw.WriteLine(s);
            //    }
            //    else
            //    {
            //        sw.WriteLine(s + ";");
            //    }
            //    sw.Close();
            //    fs.Close();
            //}
            //catch (Exception ex)
            //{

            //    throw;
            //}
        }