Ejemplo n.º 1
0
        private void SaveBookCover(string bookid)
        {
            string        strBookUrl = "../AssistBook/" + bookid + "/cover.htm";
            AssistBookBLL objBill    = new AssistBookBLL();

            objBill.UpdateAssistBookUrl(Convert.ToInt32(bookid), strBookUrl);

            string srcPath = "../Online/AssistBook/" + bookid + "/cover.htm";

            RailExam.Model.AssistBook obj = objBill.GetAssistBook(Convert.ToInt32(bookid));

            if (File.Exists(Server.MapPath(srcPath)))
            {
                File.Delete(Server.MapPath(srcPath));
            }

            string str = "<link href='book.css' type='text/css' rel='stylesheet' />"
                         + "<body oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' oncopy='document.selection.empty()' onbeforecopy='return false'>"
                         + "<br><br><br><br><br><br><br>"
                         + "<div id='booktitle'>" + obj.BookName + "</div>" + "<br>"
                         + "<br><br><br><br><br><br><br><br><br><br><br><br>"
                         + "<div id='orgtitle'>" + obj.PublishOrgName + "</div>"
                         + "</body>";

            File.AppendAllText(Server.MapPath(srcPath), str, System.Text.Encoding.UTF8);

            AssistBookChapterBLL objChapterBll = new AssistBookChapterBLL();

            objChapterBll.GetIndex(bookid);
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.HasEditRight("¸¨µ¼½Ì²Ä") && PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.SuitRange == 1)
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }
                if (PrjPub.HasEditRight("¸¨µ¼½Ì²Ä") && PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.SuitRange == 1)
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }
                HfOrgId.Value = PrjPub.CurrentLoginUser.OrgID.ToString();
                BindGrid();
            }
            else
            {
                if (Request.Form.Get("Refresh") == "true")
                {
                    //ViewState["NowID"] = "false";
                    BindGrid();
                }
            }

            string strDeleteID = Request.Form.Get("DeleteID");

            if (strDeleteID != null && strDeleteID != "")
            {
                DelAssistBook(strDeleteID);
                BindGrid();
            }

            string strUpID = Request.Form.Get("UpID");

            if (strUpID != null && strUpID != "")
            {
                AssistBookBLL             objBll = new AssistBookBLL();
                RailExam.Model.AssistBook obj    = objBll.GetAssistBook(Convert.ToInt32(strUpID));
                obj.OrderIndex = obj.OrderIndex - 1;
                objBll.UpdateAssistBook(obj);
                BindGrid();
            }

            string strDownID = Request.Form.Get("DownID");

            if (strDownID != null && strDownID != "")
            {
                AssistBookBLL             objBll = new AssistBookBLL();
                RailExam.Model.AssistBook obj    = objBll.GetAssistBook(Convert.ToInt32(strDownID));
                obj.OrderIndex = obj.OrderIndex + 1;
                objBll.UpdateAssistBook(obj);
                BindGrid();
            }
        }
Ejemplo n.º 3
0
        private void FillPage(int nBookID)
        {
            ArrayList orgidAL       = new ArrayList();
            ArrayList postidAL      = new ArrayList();
            ArrayList trainTypeidAL = new ArrayList();

            AssistBookBLL bookBLL = new AssistBookBLL();

            RailExam.Model.AssistBook book = bookBLL.GetAssistBook(nBookID);

            if (book != null)
            {
                txtBookName.Text      = book.BookName;
                txtKnowledgeName.Text = book.AssistBookCategoryName;
                hfKnowledgeID.Value   = book.AssistBookCategoryId.ToString();
                txtTrainTypeName.Text = book.trainTypeNames;

                trainTypeidAL = book.trainTypeidAL;
                string strTrainTypeID = "";
                for (int i = 0; i < trainTypeidAL.Count; i++)
                {
                    strTrainTypeID += trainTypeidAL[i].ToString() + ",";
                }

                if (strTrainTypeID.Length > 0)
                {
                    strTrainTypeID = strTrainTypeID.Substring(0, strTrainTypeID.Length - 1);
                }

                hfTrainTypeID.Value = strTrainTypeID;

                txtBookNo.Text         = book.BookNo;
                txtPublishOrgName.Text = book.PublishOrgName;
                hfPublishOrgID.Value   = book.PublishOrg.ToString();

                datePublishDate.DateValue = book.PublishDate.ToString("yyyy-MM-dd");
                txtAuthors.Text           = book.Authors;
                txtRevisers.Text          = book.Revisers;
                txtBookMaker.Text         = book.Bookmaker;
                txtCoverDesigner.Text     = book.CoverDesigner;
                txtKeyWords.Text          = book.KeyWords;
                txtPageCount.Text         = book.PageCount.ToString();
                txtWordCount.Text         = book.WordCount.ToString();
                txtDescription.Text       = book.Description;
                string strUrl = string.Empty;
                if (!string.IsNullOrEmpty(book.url))
                {
                    strUrl = "../Online/AssistBook" + book.url.Substring(13, book.url.Length - 13);
                }

                hlUrl.Text               = strUrl;
                hlUrl.NavigateUrl        = strUrl;
                txtMemo.Text             = book.Memo;
                ddlIsGroup.SelectedValue = book.IsGroupLearder.ToString();
                ddlTech.SelectedValue    = book.TechnicianTypeID.ToString();
                hfOrderIndex.Value       = book.OrderIndex.ToString();

                orgidAL  = book.orgidAL;
                postidAL = book.postidAL;
            }

            BindOrganizationTree(orgidAL);
            BindPostTree(postidAL);
        }
Ejemplo n.º 4
0
        private int SaveNewBook()
        {
            if (this.txtPageCount.Text == "")
            {
                this.txtPageCount.Text = "0";
            }

            if (this.txtWordCount.Text == "")
            {
                this.txtWordCount.Text = "0";
            }


            AssistBookBLL kBLL = new AssistBookBLL();

            string strId = Request.QueryString.Get("knowledgeId");

            RailExam.Model.AssistBook book = new RailExam.Model.AssistBook();

            book.Memo                   = txtMemo.Text;
            book.BookName               = txtBookName.Text;
            book.Description            = txtDescription.Text;
            book.PageCount              = int.Parse(txtPageCount.Text);
            book.WordCount              = int.Parse(txtWordCount.Text);
            book.Revisers               = txtRevisers.Text;
            book.Authors                = txtAuthors.Text;
            book.Bookmaker              = txtBookMaker.Text;
            book.BookNo                 = txtBookNo.Text;
            book.CoverDesigner          = txtCoverDesigner.Text;
            book.KeyWords               = txtKeyWords.Text;
            book.AssistBookCategoryName = txtKnowledgeName.Text;
            book.AssistBookCategoryId   = int.Parse(hfKnowledgeID.Value);
            book.PublishOrg             = int.Parse(hfPublishOrgID.Value);
            book.PublishDate            = DateTime.Parse(datePublishDate.DateValue.ToString());
            book.TechnicianTypeID       = Convert.ToInt32(ddlTech.SelectedValue);
            book.IsGroupLearder         = Convert.ToInt32(ddlIsGroup.SelectedValue);

            ArrayList alTrainTypeID = new ArrayList();

            string strTrainTypeID = hfTrainTypeID.Value;

            if (strTrainTypeID != "")
            {
                string[] str1 = strTrainTypeID.Split(new char[] { ',' });

                for (int i = 0; i < str1.Length; i++)
                {
                    alTrainTypeID.Add(str1[i]);
                }
            }

            book.trainTypeidAL = alTrainTypeID;

            ArrayList al = new ArrayList();

            book.orgidAL = GetOrg(tvOrg.Nodes, al);

            ArrayList al1 = new ArrayList();

            foreach (TreeViewNode tn in tvPost.Nodes)
            {
                if (tn.Checked)
                {
                    al1.Add(tn.ID);
                }

                if (tn.Nodes.Count > 0)
                {
                    foreach (TreeViewNode tns in tn.Nodes)
                    {
                        if (tns.Checked)
                        {
                            al1.Add(tns.ID);
                        }

                        if (tns.Nodes.Count > 0)
                        {
                            foreach (TreeViewNode tnss in tns.Nodes)
                            {
                                if (tnss.Checked)
                                {
                                    al1.Add(tnss.ID);
                                }
                            }
                        }
                    }
                }
            }


            book.postidAL = al1;

            string strNewID = kBLL.AddAssistBook(book).ToString();

            string strPath = Server.MapPath("../Online/AssistBook/" + strNewID);

            Directory.CreateDirectory(strPath);
            Directory.CreateDirectory(strPath + "/Upload");
            CopyTemplate(Server.MapPath("../Online/AssistBook/template/"), Server.MapPath("../Online/AssistBook/" + strNewID + "/"));

            SaveBookCover(strNewID);

            return(Convert.ToInt32(strNewID));
        }
Ejemplo n.º 5
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (this.txtPageCount.Text == "")
            {
                this.txtPageCount.Text = "0";
            }

            if (this.txtWordCount.Text == "")
            {
                this.txtWordCount.Text = "0";
            }


            AssistBookBLL kBLL = new AssistBookBLL();
            //修改
            string strId = Request.QueryString.Get("id");

            RailExam.Model.AssistBook book = new RailExam.Model.AssistBook();

            book.AssistBookId           = Convert.ToInt32(strId);
            book.Memo                   = txtMemo.Text;
            book.BookName               = txtBookName.Text;
            book.Description            = txtDescription.Text;
            book.PageCount              = int.Parse(this.txtPageCount.Text);
            book.WordCount              = int.Parse(this.txtWordCount.Text);
            book.Revisers               = txtRevisers.Text;
            book.Authors                = txtAuthors.Text;
            book.Bookmaker              = txtBookMaker.Text;
            book.BookNo                 = txtBookNo.Text;
            book.CoverDesigner          = txtCoverDesigner.Text;
            book.KeyWords               = txtKeyWords.Text;
            book.AssistBookCategoryName = txtKnowledgeName.Text;
            book.AssistBookCategoryId   = int.Parse(hfKnowledgeID.Value);
            book.PublishOrg             = int.Parse(hfPublishOrgID.Value);
            book.PublishDate            = DateTime.Parse(datePublishDate.DateValue.ToString());
            book.TechnicianTypeID       = Convert.ToInt32(ddlTech.SelectedValue);
            book.IsGroupLearder         = Convert.ToInt32(ddlIsGroup.SelectedValue);
            book.OrderIndex             = Convert.ToInt32(hfOrderIndex.Value);
            if (hlUrl.Text != "")
            {
                book.url = "../AssistBook/" + strId + "/cover.htm";
            }


            ArrayList alTrainTypeID = new ArrayList();

            string strTrainTypeID = hfTrainTypeID.Value;

            if (strTrainTypeID != "")
            {
                string[] str1 = strTrainTypeID.Split(new char[] { ',' });

                for (int i = 0; i < str1.Length; i++)
                {
                    alTrainTypeID.Add(str1[i]);
                }
            }

            book.trainTypeidAL = alTrainTypeID;

            ArrayList al = new ArrayList();

            book.orgidAL = GetOrg(tvOrg.Nodes, al);

            ArrayList al1 = new ArrayList();

            foreach (TreeViewNode tn in tvPost.Nodes)
            {
                if (tn.Checked)
                {
                    al1.Add(tn.ID);
                }

                if (tn.Nodes.Count > 0)
                {
                    foreach (TreeViewNode tns in tn.Nodes)
                    {
                        if (tns.Checked)
                        {
                            al1.Add(tns.ID);
                        }

                        if (tns.Nodes.Count > 0)
                        {
                            foreach (TreeViewNode tnss in tns.Nodes)
                            {
                                if (tnss.Checked)
                                {
                                    al1.Add(tnss.ID);
                                }
                            }
                        }
                    }
                }
            }
            book.postidAL = al1;

            kBLL.UpdateAssistBook(book);

            SaveBookCover(strId);

            Response.Write("<script>window.opener.form1.Refresh.value='true';window.opener.form1.submit();window.close();</script>");
        }
Ejemplo n.º 6
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);
        }