예제 #1
0
        public void UpdateAssistBookChapter(AssistBookChapter bookChapter)
        {
            dal.UpdateAssistBookChapter(bookChapter, SessionSet.EmployeeName);
            AssistBookBLL objBll      = new AssistBookBLL();
            string        strBookName = objBll.GetAssistBook(bookChapter.AssistBookId).BookName;

            GetIndex(bookChapter.AssistBookId.ToString());

            objLogBill.WriteLog("修改辅导教材《" + strBookName + "》中“" + bookChapter.ChapterName + "”章节基本信息");
        }
예제 #2
0
        public void DeleteAssistBookChapter(AssistBookChapter bookChapter)
        {
            string strChapterName = GetAssistBookChapter(bookChapter.ChapterId).ChapterName;

            AssistBookBLL objBookBll  = new AssistBookBLL();
            string        strBookName = objBookBll.GetAssistBook(bookChapter.AssistBookId).BookName;

            GetIndex(bookChapter.AssistBookId.ToString());

            objLogBill.WriteLog("删除辅导教材《" + strBookName + "》中“" + strChapterName + "”章节基本信息");

            dal.DeleteAssistBookChapter(bookChapter.ChapterId);
        }
예제 #3
0
        /// <summary>
        /// 发布教材
        /// </summary>
        /// <param name="strID"></param>
        public void GetIndex(string strID)
        {
            string strItem, strChapter;

            AssistBookBLL objBll = new AssistBookBLL();

            RailExam.Model.AssistBook objBook = objBll.GetAssistBook(Convert.ToInt32(strID));

            string strBookName = objBook.BookName;
            string strBookUrl  = objBook.url;

            strItem = "var TREE_ITEMS = [ ['" + strBookName + "', 'common.htm?url=cover.htm&chapterid=0',";

            strChapter = "var Tree_Chapter=['0','cover.htm','" + strBookName + "'";

            IList <RailExam.Model.AssistBookChapter> objBookChapter = GetAssistBookChapterByBookID(Convert.ToInt32(strID));

            foreach (RailExam.Model.AssistBookChapter chapter in objBookChapter)
            {
                if (chapter.ParentId == 0)
                {
                    if (chapter.Url == "" || chapter.Url == null)
                    {
                        strItem    += "['" + chapter.ChapterName + "', 'empty.htm'";
                        strChapter += ",'" + chapter.ChapterId + "','empty.htm','" + chapter.NamePath + "'";
                    }
                    else
                    {
                        strItem    += "['" + chapter.ChapterName + "', '" + chapter.ChapterId + ".htm'";
                        strChapter += ",'" + chapter.ChapterId + "','" + chapter.ChapterId + ".htm','" + chapter.NamePath + "'";
                    }


                    if (GetAssistBookChapterByParentID(chapter.ChapterId).Count > 0)
                    {
                        strItem += ",";
                    }

                    strItem    = Get(chapter.ChapterId, strItem);
                    strChapter = GetChapter(chapter.ChapterId, strChapter);
                }
            }

            strItem += "]];";
            string strPath = "../Online/AssistBook/" + strID + "/tree_items.js";

            File.Delete(HttpContext.Current.Server.MapPath(strPath));
            File.AppendAllText(HttpContext.Current.Server.MapPath(strPath), strItem, System.Text.Encoding.UTF8);

            strChapter += "];";
            strPath     = "../Online/AssistBook/" + strID + "/tree_chapter.js";
            if (File.Exists(HttpContext.Current.Server.MapPath(strPath)))
            {
                File.Delete(HttpContext.Current.Server.MapPath(strPath));
            }
            File.AppendAllText(HttpContext.Current.Server.MapPath(strPath), strChapter, System.Text.Encoding.UTF8);

            string[] strIndex = File.ReadAllLines(HttpContext.Current.Server.MapPath("../Online/AssistBook/" + strID + "/index.html"), System.Text.Encoding.Default);

            for (int i = 0; i < strIndex.Length; i++)
            {
                if (strIndex[i].IndexOf("<title>") != -1)
                {
                    strIndex[i] = "\t<title> " + strBookName + " </title>";
                }
            }

            File.WriteAllLines(HttpContext.Current.Server.MapPath("../Online/AssistBook/" + strID + "/index.html"), strIndex, System.Text.Encoding.UTF8);
        }