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); }
private void BindTree() { //添加书名 AssistBookBLL bookBLL = new AssistBookBLL(); RailExam.Model.AssistBook book = bookBLL.GetAssistBook(Convert.ToInt32(ViewState["BookID"].ToString())); TreeViewNode tvn1 = new TreeViewNode(); tvn1.ID = "0"; tvn1.Value = ViewState["BookID"].ToString(); tvn1.Text = book.BookName; tvn1.ToolTip = book.BookName; tvBookChapter.Nodes.Add(tvn1); //添加章节 AssistBookChapterBLL bookChapterBLL = new AssistBookChapterBLL(); IList <RailExam.Model.AssistBookChapter> bookChapterList = bookChapterBLL.GetAssistBookChapterByBookID(Convert.ToInt32(ViewState["BookID"].ToString())); if (bookChapterList.Count > 0) { TreeViewNode tvn = null; foreach (RailExam.Model.AssistBookChapter bookChapter in bookChapterList) { tvn = new TreeViewNode(); tvn.ID = bookChapter.ChapterId.ToString(); tvn.Value = bookChapter.AssistBookId.ToString(); tvn.Text = bookChapter.ChapterName; tvn.ToolTip = bookChapter.ChapterName; if (bookChapter.ParentId == 0) { //tvBookChapter.Nodes.Add(tvn); tvBookChapter.FindNodeById(bookChapter.ParentId.ToString()).Nodes.Add(tvn); } else { try { tvBookChapter.FindNodeById(bookChapter.ParentId.ToString()).Nodes.Add(tvn); } catch { tvBookChapter.Nodes.Clear(); SessionSet.PageMessage = "数据错误!"; return; } } } } tvBookChapter.DataBind(); tvBookChapter.ExpandAll(); }
protected void tvBookChapterChangeCallBack_Callback(object sender, CallBackEventArgs e) { AssistBookChapterBLL objBookChapter = new AssistBookChapterBLL(); RailExam.Model.AssistBookChapter obj = new RailExam.Model.AssistBookChapter(); obj = objBookChapter.GetAssistBookChapterInfo(int.Parse(e.Parameters[0])); int cout = tvBookChapter.FindNodeById(obj.ParentId.ToString()).Nodes.Count; if (e.Parameters[1] == "MoveUp") { if (obj.OrderIndex <= cout && obj.OrderIndex >= 2) { obj.OrderIndex--; objBookChapter.UpdateAssistBookChapter(obj); obj = objBookChapter.GetAssistBookChapter(int.Parse(tvBookChapter.FindNodeById(e.Parameters[0]).PreviousSibling.ID)); obj.OrderIndex++; objBookChapter.UpdateAssistBookChapter(obj); } } if (e.Parameters[1] == "MoveDown") { if (obj.OrderIndex <= cout - 1 && obj.OrderIndex >= 1) { obj.OrderIndex++; objBookChapter.UpdateAssistBookChapter(obj); obj = objBookChapter.GetAssistBookChapter(int.Parse(tvBookChapter.FindNodeById(e.Parameters[0]).NextSibling.ID)); obj.OrderIndex--; objBookChapter.UpdateAssistBookChapter(obj); } } tvBookChapter.Nodes.Clear(); BindTree(); tvBookChapter.RenderControl(e.Output); }
protected void SaveButton_Click(object sender, EventArgs e) { AssistBookUpdateBLL BookUpdateBLL = new AssistBookUpdateBLL(); AssistBookUpdate BookUpdate = new AssistBookUpdate(); string strUpdateObject = Request.QueryString.Get("Object"); if (txtCause.Text == string.Empty) { SessionSet.PageMessage = "更改原因不能为空!"; return; } if (txtContent.Text == string.Empty) { SessionSet.PageMessage = "更改内容不能为空!"; return; } if (ViewState["AddFlag"].ToString() == "1") //新增 { AssistBookBLL objBookBll = new AssistBookBLL(); BookUpdate.AssistBookId = int.Parse(ViewState["BookID"].ToString()); BookUpdate.ChapterId = int.Parse(ViewState["ChapterID"].ToString()); BookUpdate.updatePerson = lblPerson.Text; BookUpdate.updateDate = DateTime.Parse(lblDate.Text); BookUpdate.updateCause = txtCause.Text; BookUpdate.updateContent = txtContent.Text; BookUpdate.Memo = txtMemo.Text; BookUpdate.BookNameBak = objBookBll.GetAssistBook(Convert.ToInt32(ViewState["BookID"].ToString())).BookName; if (ViewState["ChapterID"].ToString() != "0") { AssistBookChapterBLL objChapterBll = new AssistBookChapterBLL(); BookUpdate.ChapterNameBak = objChapterBll.GetAssistBookChapter(Convert.ToInt32(ViewState["ChapterID"].ToString())).ChapterName; } if (strUpdateObject == "insertchapterinfo") { BookUpdate.ChapterNameBak = Server.UrlDecode(Request.QueryString.Get("newchaptername")); BookUpdate.UpdateObject = PrjPub.ASSISTBOOKUPDATEOBJECT_INSERTCHAPTERINFO; } else if (strUpdateObject == "updatechapterinfo") { BookUpdate.UpdateObject = PrjPub.ASSISTBOOKUPDATEOBJECT_UPDATECHAPTERINFO; } else if (strUpdateObject == "chaptercontent") { BookUpdate.UpdateObject = PrjPub.ASSISTBOOKUPDATEOBJECT_CHAPTERCONTENT; } else if (strUpdateObject == "delbook") { BookUpdate.UpdateObject = PrjPub.ASSISTBOOKUPDATEOBJECT_DELBOOK; } else if (strUpdateObject == "delchapter") { BookUpdate.UpdateObject = PrjPub.ASSISTBOOKUPDATEOBJECT_DELCHAPTER; } else { BookUpdate.UpdateObject = lblChapterName.Text; } BookUpdateBLL.AddAssistBookUpdate(BookUpdate); Response.Write("<script>top.returnValue='true';window.close();</script>"); } else //修改 { BookUpdate.AssistBookId = int.Parse(ViewState["BookID"].ToString()); BookUpdate.ChapterId = int.Parse(ViewState["ChapterID"].ToString()); BookUpdate.updatePerson = lblPerson.Text; BookUpdate.updateDate = DateTime.Parse(lblDate.Text); BookUpdate.updateCause = txtCause.Text; BookUpdate.updateContent = txtContent.Text; BookUpdate.Memo = txtMemo.Text; BookUpdate.AssistBookUpdateId = int.Parse(Request.QueryString.Get("id")); BookUpdateBLL.UpdateAssistBookUpdate(BookUpdate); Response.Write("<script>window.opener.form1.RefreshGrid.value='true';window.opener.form1.submit();window.close();</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strMode = Request.QueryString.Get("Mode"); if (strMode != "" && strMode != null && strMode == "ReadOnly") { btnSave.Visible = false; CancelButton.Visible = true; } else { btnSave.Visible = true; CancelButton.Visible = false; } string strUpdateObject = Request.QueryString.Get("Object"); string strBookChapterUpdateID = Request.QueryString.Get("id"); string bookID = Request.QueryString.Get("BookID"); string chapterID = Request.QueryString.Get("ChapterID"); ViewState["BookID"] = bookID; ViewState["ChapterID"] = chapterID; string chapterName = ""; if (!string.IsNullOrEmpty(strBookChapterUpdateID)) //修改 { FillPage(int.Parse(strBookChapterUpdateID)); } else { if (ViewState["ChapterID"].ToString() != "0") { AssistBookChapterBLL objChapterBll = new AssistBookChapterBLL(); chapterName = objChapterBll.GetAssistBookChapter(Convert.ToInt32(chapterID)).ChapterName; } AssistBookBLL objBook = new AssistBookBLL(); lblBookName.Text = objBook.GetAssistBook(Convert.ToInt32(bookID)).BookName; lblPerson.Text = PrjPub.CurrentLoginUser.EmployeeName; lblDate.Text = DateTime.Today.ToLongDateString(); if (strUpdateObject == "delbook") { lblChapterName.Text = "删除辅导教材《" + lblBookName.Text + "》"; } else if (strUpdateObject == "delchapter") { lblChapterName.Text = "删除辅导教材章节" + chapterName; } else if (strUpdateObject == "insertchapterinfo") { chapterName = Server.UrlDecode(Request.QueryString.Get("newchaptername")); lblChapterName.Text = "新增《" + chapterName + "》辅导教材章节基本信息"; } else if (strUpdateObject == "bookinfo") { lblChapterName.Text = PrjPub.ASSISTBOOKUPDATEOBJECT_BOOKINFO; } else if (strUpdateObject == "bookcover") { lblChapterName.Text = PrjPub.ASSISTBOOKUPDATEOBJECT_BOOKCOVER; } else if (strUpdateObject == "updatechapterinfo") { lblChapterName.Text = "修改《" + chapterName + "》辅导教材章节基本信息"; } else if (strUpdateObject == "chaptercontent") { lblChapterName.Text = "《" + chapterName + "》" + PrjPub.ASSISTBOOKUPDATEOBJECT_CHAPTERCONTENT; } ViewState["AddFlag"] = 1; } } }
protected void Page_Load(object sender, EventArgs e) { hfChapterID.Value = Request.QueryString["id"]; if (fvBookChapter.CurrentMode == FormViewMode.Insert) { if (hfInsert.Value == "-1") { ((HiddenField)fvBookChapter.FindControl("hfParentID")).Value = Request.QueryString["ParentID"]; ((HiddenField)fvBookChapter.FindControl("hfBookID")).Value = Request.QueryString["BookID"]; } else { ((HiddenField)fvBookChapter.FindControl("hfParentId")).Value = hfInsert.Value; ((HiddenField)fvBookChapter.FindControl("hfBookID")).Value = Request.QueryString["BookID"]; } } string strRefresh = Request.Form.Get("Refresh"); if (strRefresh != null & strRefresh != "") { string strPath = "../Online/AssistBook/" + Request.QueryString["BookID"].ToString() + "/" + Request.QueryString["id"].ToString() + ".htm"; AssistBookChapterBLL objBill = new AssistBookChapterBLL(); objBill.UpdateAssistBookChapterUrl(Convert.ToInt32(Request.QueryString["id"].ToString()), strPath); RailExam.Model.AssistBookChapter objBookChapter = objBill.GetAssistBookChapter(Convert.ToInt32(Request.QueryString["id"].ToString())); string strChapterName = objBookChapter.ChapterName; string str = File.ReadAllText(Server.MapPath(strPath), Encoding.UTF8); if (str.IndexOf("chaptertitle") < 0) { if (objBookChapter.LevelNum < 3) { 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'>" + "<div id='chaptertitle" + objBookChapter.LevelNum + "'>" + strChapterName + "</div>" + "<br>" + str + "</body>"; } else { 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'>" + "<div id='chaptertitle3'>" + strChapterName + "</div>" + "<br>" + str + "</body>"; } File.WriteAllText(Server.MapPath(strPath), str, Encoding.UTF8); } AssistBookBLL objBookBill = new AssistBookBLL(); string strBookName = objBookBill.GetAssistBook(Convert.ToInt32(Request.QueryString["BookID"].ToString())).BookName; SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("编辑教材《" + strBookName + "》中“" + strChapterName + "”的章节内容"); fvBookChapter.DataBind(); Grid1.DataBind(); objBill.GetIndex(Request.QueryString["BookID"].ToString()); } string strRefreshGrid = Request.Form.Get("RefreshGrid"); if (strRefreshGrid != null & strRefreshGrid != "") { fvBookChapter.DataBind(); Grid1.DataBind(); } string strDeleteBookChapterUpdateID = Request.Form.Get("DeleteBookChapterUpdateID"); if (!string.IsNullOrEmpty(strDeleteBookChapterUpdateID)) { DeleteData(int.Parse(strDeleteBookChapterUpdateID)); Grid1.DataBind(); } }