Ejemplo n.º 1
0
        protected void fvBookChapter_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
        {
            ItemBLL objBll = new ItemBLL();
            IList <RailExam.Model.Item> objList =
                objBll.GetItemsByBookChapterId(Convert.ToInt32(e.Keys["BookId"].ToString()), Convert.ToInt32(e.Keys["ChapterId"].ToString()), 0, 0);

            if (objList.Count > 0)
            {
                ClientScript.RegisterStartupScript(GetType(),
                                                   "jsSelectFirstNode",
                                                   @"var ret = window.showModalDialog('/RailExamBao/Book/ItemEnabled.aspx?BookID=" + e.Keys["BookId"] + @"&ChapterID=" + e.Keys["ChapterId"] + @"','','help:no; status:no;dialogWidth:300px;dialogHeight:120px;');
                     window.parent.tvBookChapterChangeCallBack.callback(" + e.Keys["ChapterId"] + @", 'Rebuild');                        
                    if(window.parent.tvBookChapter.get_nodes().get_length() > 0)
                    {
                        window.parent.tvBookChapter.get_nodes().getNode(0).select();
                    } ",
                                                   true);
            }
            else
            {
                ClientScript.RegisterStartupScript(GetType(),
                                                   "jsSelectFirstNode",
                                                   @"window.parent.tvBookChapterChangeCallBack.callback(" + e.Keys["ChapterId"] + @", 'Rebuild');                        
                    if(window.parent.tvBookChapter.get_nodes().get_length() > 0)
                    {
                        window.parent.tvBookChapter.get_nodes().getNode(0).select();
                    }",
                                                   true);
            }
        }
Ejemplo n.º 2
0
        private void BindGrid()
        {
            if (!string.IsNullOrEmpty(hfChapterID.Value) && hfChapterID.Value != "0")
            {
                int bookID    = Convert.ToInt32(Request.QueryString["BookID"]);
                int chapterID = Convert.ToInt32(hfChapterID.Value);

                ItemBLL objItemBll = new ItemBLL();
                IList <RailExam.Model.Item> objItemList = objItemBll.GetItemsByBookChapterId(bookID, chapterID, 0, int.MaxValue);

                itemsGrid.DataSource = objItemList;
                itemsGrid.DataBind();
            }
            else
            {
                int bookID = Convert.ToInt32(Request.QueryString["BookID"]);

                ItemBLL objItemBll = new ItemBLL();
                IList <RailExam.Model.Item> objItemList = objItemBll.GetItemsByBookBookId(bookID);

                itemsGrid.DataSource = objItemList;
                itemsGrid.DataBind();
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hfChapterID.Value = Request.QueryString["id"];
            hfIsWuhan.Value   = PrjPub.IsWuhan().ToString();

            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"];
                }
                if (Request.QueryString["Mode"] == "Edit")
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "true";
                }
                else
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "false";
                }
            }
            else if (fvBookChapter.CurrentMode == FormViewMode.Edit)
            {
                if (Request.QueryString["Mode"] == "Edit")
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "true";
                }
                else
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "false";
                }
            }


            string strRefresh = Request.Form.Get("Refresh");

            if (strRefresh != null & strRefresh != "")
            {
                string strPath = "../Online/Book/" + Request.QueryString["BookID"].ToString() + "/" + Request.QueryString["id"].ToString() + ".htm";

                BookChapterBLL objBill = new BookChapterBLL();
                objBill.UpdateBookChapterUrl(Convert.ToInt32(Request.QueryString["id"].ToString()), strPath);
                RailExam.Model.BookChapter objBookChapter = objBill.GetBookChapter(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);
                }


                BookBLL objBookBill = new BookBLL();
                if (Request.QueryString.Get("Mode") == "Edit")
                {
                    objBookBill.UpdateBookVersion(Convert.ToInt32(Request.QueryString["BookID"].ToString()));
                }
                string strBookName = objBookBill.GetBook(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());

                ItemBLL objBll = new ItemBLL();
                IList <RailExam.Model.Item> objList =
                    objBll.GetItemsByBookChapterId(Convert.ToInt32(Request.QueryString["BookID"]), Convert.ToInt32(Request.QueryString["id"]), 0, 0);

                if (objList.Count > 0)
                {
                    ClientScript.RegisterStartupScript(GetType(),
                                                       "jsSelectFirstNode",
                                                       @"var ret = window.showModalDialog('/RailExamBao/Book/ItemEnabled.aspx?BookID=" + Request.QueryString["BookID"] + @"&ChapterID=" + Request.QueryString["id"] + @"','','help:no; status:no;dialogWidth:300px;dialogHeight:120px;');",
                                                       true);
                }
            }

            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();
            }
        }