예제 #1
0
        private void BindGrid()
        {
            string strSql;

            strSql = "select a.*,b.Short_Name from Book a inner join Org b on a.Publish_Org=b.Org_ID where Publish_org=" + SessionSet.OrganizationID + ViewState["QuerySql"].ToString() + " order by Book_Name";
            DataSet ds = RunSqlDataSet(strSql);

            IList <RailExam.Model.Book> bookList = new List <RailExam.Model.Book>();
            ArrayList bookIDList = GetBookIDList();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (bookIDList.IndexOf(Convert.ToInt32(dr["Book_ID"].ToString())) == -1)
                {
                    RailExam.Model.Book book = new RailExam.Model.Book();
                    book.bookId         = Convert.ToInt32(dr["Book_ID"].ToString());
                    book.bookName       = dr["Book_Name"].ToString();
                    book.bookNo         = dr["Book_No"].ToString();
                    book.authors        = dr["Authors"].ToString();
                    book.bookmaker      = dr["BookMaker"].ToString();
                    book.publishOrg     = Convert.ToInt32(dr["Publish_Org"].ToString());
                    book.publishOrgName = dr["Short_Name"].ToString();
                    book.revisers       = dr["Revisers"].ToString();
                    book.coverDesigner  = dr["Cover_Designer"].ToString();
                    book.keyWords       = dr["Keywords"].ToString();
                    book.pageCount      = Convert.ToInt32(dr["Page_Count"].ToString());
                    book.wordCount      = Convert.ToInt32(dr["Word_Count"].ToString());
                    book.Description    = dr["Description"].ToString();
                    book.url            = "../Book/" + dr["Book_ID"].ToString() + "/index.html";
                    book.Memo           = dr["Remark"].ToString();

                    book.knowledgeId   = 0;
                    book.knowledgeName = "";

                    bookList.Add(book);
                }
            }

            gvBook.DataSource = bookList;
            gvBook.DataBind();
        }
예제 #2
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            if (Request.QueryString.Get("TrainTypeID") != null)
            {
                int bookID              = Convert.ToInt32(Request.QueryString.Get("BookID"));
                int trainTypeID         = Convert.ToInt32(Request.QueryString.Get("TrainTypeID"));
                BookTrainTypeBLL objBll = new BookTrainTypeBLL();
                BookTrainType    obj    = objBll.GetBookTrainType(bookID, trainTypeID);
                int order = Convert.ToInt32(txtOrderIndex.Text);
                int max   = Convert.ToInt32(Request.QueryString.Get("MaxOrder"));
                if (order > max)
                {
                    obj.OrderIndex = max;
                }
                else
                {
                    obj.OrderIndex = order;
                }
                objBll.UpdateBookTrainType(obj);
            }
            else
            {
                BookBLL             objBll = new BookBLL();
                RailExam.Model.Book obj    = objBll.GetBook(Convert.ToInt32(Request.QueryString.Get("BookID")));
                int order = Convert.ToInt32(txtOrderIndex.Text);
                int max   = Convert.ToInt32(Request.QueryString.Get("MaxOrder"));
                if (order > max)
                {
                    obj.OrderIndex = max;
                }
                else
                {
                    obj.OrderIndex = order;
                }
                objBll.UpdateBook(obj);
            }

            Response.Write("<script>top.returnValue='true';window.close();</script>");
        }
예제 #3
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            int selectOrgID = Convert.ToInt32(hfOrg.Value);
            int bookID      = Convert.ToInt32(Request.QueryString.Get("BookID"));

            ArrayList            objOrgList = new ArrayList();
            OrganizationBLL      orgBll     = new OrganizationBLL();
            IList <Organization> objOrg     = orgBll.GetOrganizationsByWhereClause("id_path || '/' like '/1/" + selectOrgID + "/%'");

            foreach (Organization organization in objOrg)
            {
                objOrgList.Add(organization.OrganizationId);
            }

            BookBLL objBookBll = new BookBLL();

            RailExam.Model.Book objBook = objBookBll.GetBook(bookID);
            objBook.publishOrg = selectOrgID;
            objBook.orgidAL    = objOrgList;
            objBookBll.UpdateBook(objBook);

            Response.Write("<script>top.returnValue='true';window.close();</script>");
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack && !Grid1.IsCallback)
            {
                if (PrjPub.CurrentLoginUser == null)
                {
                    Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!");
                    return;
                }
                //if(HfChapterId.Value != "")
                //{
                //    BookChapterBLL objBll = new BookChapterBLL();
                //    BookChapter obj = objBll.GetBookChapter(Convert.ToInt32(HfChapterId.Value));
                //    txtChapterName.Text = obj.NamePath;
                //}

                HfChapterId.Value = Request.QueryString.Get("cid");
                HfBookId.Value    = Request.QueryString.Get("bid");

                if (!string.IsNullOrEmpty(HfBookId.Value) && HfBookId.Value != "-1")
                {
                    BookBLL             objbookbill = new BookBLL();
                    RailExam.Model.Book objBook     = objbookbill.GetBook(Convert.ToInt32(HfBookId.Value));

                    if (PrjPub.CurrentLoginUser.SuitRange == 0 && PrjPub.IsServerCenter)
                    {
                        if (PrjPub.CurrentLoginUser.StationOrgID != objBook.publishOrg)
                        {
                            Response.Write("<script>alert('您没有导入当前教材章节试题的权限!');window.close();</script>");
                            return;
                        }
                    }

                    if (HfChapterId.Value != "-1")
                    {
                        BookChapterBLL objBll = new BookChapterBLL();
                        BookChapter    obj    = objBll.GetBookChapter(Convert.ToInt32(HfChapterId.Value));
                        txtChapterName.Text = objBook.bookName + ">>" + obj.NamePath;

                        if (obj.IsCannotSeeAnswer)
                        {
                            ddlMode.Visible = true;
                        }
                        else
                        {
                            ddlMode.Visible       = false;
                            ddlMode.SelectedValue = "0";
                        }
                    }
                    else
                    {
                        txtChapterName.Text   = objBook.bookName;
                        ddlMode.Visible       = false;
                        ddlMode.SelectedValue = "0";
                    }
                    lblTitle.Visible  = true;
                    btnDelAll.Visible = true;
                }
                else
                {
                    lblTitle.Visible  = false;
                    btnDelAll.Visible = false;
                }

                if (!PrjPub.IsWuhanOnly())
                {
                    ddlMode.Visible       = false;
                    ddlMode.SelectedValue = "0";
                }

                ddlMode.Visible       = false;
                ddlMode.SelectedValue = "0";

                if (Session["table"] != null)
                {
                    Session.Remove("table");
                }
            }

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

            if (str != null && str == "refresh")
            {
                if (Session["table"] != null)
                {
                    Grid1.DataSource = (DataTable)Session["table"];
                    Grid1.DataBind();
                }
            }
        }
예제 #5
0
        private int SaveNewBook()
        {
            if (this.txtPageCount.Text == "")
            {
                this.txtPageCount.Text = "0";
            }

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


            BookBLL kBLL = new BookBLL();

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

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

            book.Memo = txtMemo.Text;
            if (PrjPub.CurrentLoginUser.SuitRange == 1)
            {
                book.bookName = txtBookName.Text;
            }
            else
            {
                OrganizationBLL orgBll  = new OrganizationBLL();
                string          orgName = orgBll.GetOrganization(PrjPub.CurrentLoginUser.StationOrgID).ShortName;
                book.bookName = orgName + txtBookName.Text;
            }
            book.Description      = txtDescription.Text;
            book.pageCount        = int.Parse(txtPageCount.Text);
            book.wordCount        = int.Parse(txtWordCount.Text);
            book.revisers         = txtRevisers.Text;
            book.authors          = hfEmployeeID.Value;
            book.bookmaker        = txtBookMaker.Text;
            book.bookNo           = txtBookNo.Text;
            book.coverDesigner    = txtCoverDesigner.Text;
            book.keyWords         = txtKeyWords.Text;
            book.knowledgeName    = txtKnowledgeName.Text;
            book.knowledgeId      = 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;

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

            for (int i = 0; i < str1.Length; i++)
            {
                if (!string.IsNullOrEmpty(str1[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.AddBook(book).ToString();

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

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

            SaveBookCover(strNewID);

            return(Convert.ToInt32(strNewID));
        }
예제 #6
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";
            }


            BookBLL kBLL = new BookBLL();

            BookBLL objBookBll = new BookBLL();

            if (txtBookName.Text.Trim() != ViewState["BookName"].ToString())
            {
                if (objBookBll.GetBookByName(txtBookName.Text.Trim()).Count > 0)
                {
                    SessionSet.PageMessage = "该教材名称已经存在";
                    return;
                }
            }

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

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

            book.bookId           = 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          = hfEmployeeID.Value;
            book.bookmaker        = txtBookMaker.Text;
            book.bookNo           = txtBookNo.Text;
            book.coverDesigner    = txtCoverDesigner.Text;
            book.keyWords         = txtKeyWords.Text;
            book.knowledgeName    = txtKnowledgeName.Text;
            book.knowledgeId      = 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 = "../Book/" + strId + "/cover.htm";
            }


            ArrayList alTrainTypeID = new ArrayList();

            string strTrainTypeID = hfTrainTypeID.Value;

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

            for (int i = 0; i < str1.Length; i++)
            {
                if (!string.IsNullOrEmpty(str1[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.UpdateBook(book);
            kBLL.UpdateBookVersion(Convert.ToInt32(strId));
            SaveBookCover(strId);

            if (PrjPub.IsWuhan())
            {
                Response.Write("<script>window.opener.form1.Refresh.value='true';window.opener.form1.submit();window.close();</script>");
            }
            else
            {
                Response.Write("<script>top.returnValue='true';top.close();</script>");
            }
        }
예제 #7
0
        private void FillPage(int nBookID)
        {
            ArrayList orgidAL       = new ArrayList();
            ArrayList postidAL      = new ArrayList();
            ArrayList trainTypeidAL = new ArrayList();

            BookBLL bookBLL = new BookBLL();

            RailExam.Model.Book book = bookBLL.GetBook(nBookID);

            if (book != null)
            {
                txtBookName.Text      = book.bookName;
                ViewState["BookName"] = book.bookName;
                txtKnowledgeName.Text = book.KnowledgeNames;
                hfKnowledgeID.Value   = book.knowledgeId.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");
                hfEmployeeID.Value        = book.authors;
                if (!string.IsNullOrEmpty(hfEmployeeID.Value))
                {
                    OracleAccess db = new OracleAccess();
                    DataTable    dt =
                        db.RunSqlDataSet("Select Employee_Name from Employee where Employee_ID=" +
                                         hfEmployeeID.Value).Tables[0];
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        txtAuthors.Text = dt.Rows[0]["Employee_Name"].ToString();
                    }


                    if (PrjPub.CurrentLoginUser.EmployeeID.ToString() != book.authors && PrjPub.CurrentLoginUser.RoleID != 1)
                    {
                        btnChapter.Visible     = false;
                        SaveButton.Visible     = false;
                        SaveExitButton.Visible = false;
                        SaveNextButton.Visible = false;
                    }
                }
                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;
                hfOrderIndex.Value    = book.OrderIndex.ToString();
                string strUrl = string.Empty;
                if (!string.IsNullOrEmpty(book.url))
                {
                    strUrl = "../Online/Book" + book.url.Substring(7, book.url.Length - 7);
                }

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

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

            BindOrganizationTree(orgidAL);
            BindPostTree(postidAL);
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.CurrentLoginUser == null)
                {
                    Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!");
                    return;
                }
                //ViewState["NowID"] = "false";
                if (PrjPub.HasEditRight("教材管理") && PrjPub.IsServerCenter)//&& PrjPub.CurrentLoginUser.SuitRange == 1
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }
                if (PrjPub.HasDeleteRight("教材管理") && PrjPub.IsServerCenter)//&& PrjPub.CurrentLoginUser.SuitRange == 1
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }

                OrganizationBLL orgBll = new OrganizationBLL();
                int             orgID  = orgBll.GetStationOrgID(PrjPub.CurrentLoginUser.OrgID);
                HfOrgId.Value = orgID.ToString();

                hfEmployeeID.Value = PrjPub.CurrentLoginUser.EmployeeID.ToString();


                if (!string.IsNullOrEmpty(Request.QueryString.Get("postID")))
                {
                    hfPostID.Value = Request.QueryString.Get("postID");
                }

                BindGrid();
            }
            else
            {
                if (Request.Form.Get("Refresh") == "true")
                {
                    //ViewState["NowID"] = "false";
                    BindGrid();
                }
            }

            #region
            //string strGet = Request.Form.Get("Index");
            //if (strGet != null && strGet != "")
            //{
            //    GetIndex(strGet);
            //    BindGrid();
            //}

            //string strCover = Request.Form.Get("RefreshCover");
            //if(strCover!= null && strCover !="")
            //{
            //    string strBookUrl = "../Book/" + strCover + "/cover.htm";

            //    BookBLL objBill = new BookBLL();
            //    objBill.UpdateBookUrl(Convert.ToInt32(strCover), strBookUrl);

            //    string strBookName = objBill.GetBook(Convert.ToInt32(strCover)).bookName;

            //    string strPath = "../Online/Book/" + strCover + "/Cover.htm";
            //    string str = File.ReadAllText(Server.MapPath(strPath), System.Text.Encoding.UTF8);
            //    if (str.IndexOf("booktitle") < 0)
            //    {
            //        str = "<link href='book.css' type='text/css' rel='stylesheet' />"
            //             + "<div id='booktitle'>" + strBookName + "</div>" + "<br>"
            //             + str;
            //        File.WriteAllText(Server.MapPath(strPath), str, System.Text.Encoding.UTF8);
            //    }

            //    BookChapterBLL objChapterBll = new BookChapterBLL();
            //    objChapterBll.GetIndex(strCover);

            //    SystemLogBLL objLogBll = new SystemLogBLL();
            //    objLogBll.WriteLog("编辑教材《" + strBookName + "》前言");

            //    BindGrid();
            //}
            #endregion

            string strDeleteID = Request.Form.Get("DeleteID");
            if (strDeleteID != null && strDeleteID != "")
            {
                DelBook(strDeleteID);
                BindGrid();
            }

            string strUpID = Request.Form.Get("UpID");
            if (strUpID != null && strUpID != "")
            {
                if (Request.QueryString.Get("id") != null)
                {
                    BookBLL             objBll = new BookBLL();
                    RailExam.Model.Book obj    = objBll.GetBook(Convert.ToInt32(strUpID));
                    obj.OrderIndex = obj.OrderIndex - 1;
                    objBll.UpdateBook(obj);
                }

                if (Request.QueryString.Get("id1") != null)
                {
                    int trainTypeID = Convert.ToInt32(Request.QueryString.Get("id1"));
                    BookTrainTypeBLL objTrainTypeBll = new BookTrainTypeBLL();
                    BookTrainType    objTrainType    =
                        objTrainTypeBll.GetBookTrainType(Convert.ToInt32(strUpID), trainTypeID);
                    objTrainType.OrderIndex = objTrainType.OrderIndex - 1;
                    objTrainTypeBll.UpdateBookTrainType(objTrainType);
                }
                BindGrid();
            }

            string strDownID = Request.Form.Get("DownID");
            if (strDownID != null && strDownID != "")
            {
                if (Request.QueryString.Get("id") != null)
                {
                    BookBLL             objBll = new BookBLL();
                    RailExam.Model.Book obj    = objBll.GetBook(Convert.ToInt32(strDownID));
                    obj.OrderIndex = obj.OrderIndex + 1;
                    objBll.UpdateBook(obj);
                }

                if (Request.QueryString.Get("id1") != null)
                {
                    int trainTypeID = Convert.ToInt32(Request.QueryString.Get("id1"));
                    BookTrainTypeBLL objTrainTypeBll = new BookTrainTypeBLL();
                    BookTrainType    objTrainType    =
                        objTrainTypeBll.GetBookTrainType(Convert.ToInt32(strDownID), trainTypeID);
                    objTrainType.OrderIndex = objTrainType.OrderIndex + 1;
                    objTrainTypeBll.UpdateBookTrainType(objTrainType);
                }
                BindGrid();
            }

            string strRefreshDown = Request.Form.Get("RefreshDown");
            if (strRefreshDown != null && strRefreshDown != "")
            {
                if (!DownloadBook(strRefreshDown))
                {
                    SessionSet.PageMessage = "当前教材不存在电子版教材!";
                    BindGrid();
                    return;
                }
                BindGrid();
            }


            if (!string.IsNullOrEmpty(hfPostID.Value))
            {
                PostBLL post = new PostBLL();
                txtPost.Text = post.GetPost(Convert.ToInt32(hfPostID.Value)).PostName;
            }
        }
예제 #9
0
        private void BindTree()
        {
            string strBookID     = Request.QueryString.Get("BookID");
            string strSelectedID = Request.QueryString.Get("StrategyID");
            string strItemTypeID = Request.QueryString.Get("itemTypeID");

            BookBLL objBll = new BookBLL();

            RailExam.Model.Book obj = objBll.GetBook(Convert.ToInt32(strBookID));

            ItemBLL objItemBll = new ItemBLL();

            TreeViewNode node = new TreeViewNode();
            int          m    = objItemBll.GetItemsByBookID(obj.bookId, Convert.ToInt32(strItemTypeID));

            if (m > 0)
            {
                node.Text = obj.bookName + "£¨" + m + "Ì⣩";
            }
            else
            {
                node.Text = obj.bookName;
            }
            node.ID = obj.bookId.ToString();

            tvBook.Nodes.Add(node);

            BookChapterBLL objChapterBll = new BookChapterBLL();
            IList <RailExam.Model.BookChapter> objChapterList = objChapterBll.GetBookChapterByBookID(Convert.ToInt32(strBookID));

            TreeViewNode tvn = null;

            foreach (BookChapter bookChapter in objChapterList)
            {
                if (bookChapter.IsMotherItem)
                {
                    continue;
                }

                tvn       = new TreeViewNode();
                tvn.ID    = bookChapter.ChapterId.ToString();
                tvn.Value = bookChapter.ChapterId.ToString();
                int n = objItemBll.GetItemsByBookChapterIdPath(bookChapter.IdPath, Convert.ToInt32(strItemTypeID));
                if (n > 0)
                {
                    tvn.Text = bookChapter.ChapterName + "£¨" + n + "Ì⣩";
                }
                else
                {
                    tvn.Text = bookChapter.ChapterName;
                }

                tvn.ToolTip      = bookChapter.ChapterName;
                tvn.ShowCheckBox = true;

                if (Request.QueryString.Get("StrategyID") != null)
                {
                    string str = "," + strSelectedID + ",";
                    if (str.IndexOf("," + tvn.ID + ",") != -1)
                    {
                        tvn.Checked = true;
                    }
                }

                tvn.Attributes.Add("isChapter", "true");
                tvn.ImageUrl = "~/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Chapter.gif";

                if (bookChapter.ParentId == 0)
                {
                    tvBook.FindNodeById(bookChapter.BookId.ToString()).Nodes.Add(tvn);
                }
                else
                {
                    tvBook.FindNodeById(bookChapter.ParentId.ToString()).Nodes.Add(tvn);
                }
            }

            if (tvBook.Nodes.Count > 0)
            {
                tvBook.Nodes[0].Expanded = true;
            }
        }
예제 #10
0
        protected void btnInput_Click(object sender, EventArgs e)
        {
            string strSql;

            for (int i = 0; i < gvBook.Rows.Count; i++)
            {
                CheckBox chk = (CheckBox)gvBook.Rows[i].FindControl("chSelect");

                string strKnowledgeId = ((HiddenField)gvBook.Rows[i].FindControl("hfKownledgeId")).Value;

                if (chk.Checked)
                {
                    strSql = "select a.*,b.Short_Name from Book a inner join Org b on a.Publish_Org=b.Org_ID where a.Book_ID=" + gvBook.DataKeys[i].Value.ToString();
                    DataSet ds = RunSqlDataSet(strSql);
                    DataRow dr = ds.Tables[0].Rows[0];

                    BookBLL             objBookbll = new BookBLL();
                    RailExam.Model.Book objBookNew = new RailExam.Model.Book();
                    objBookNew.bookId = Convert.ToInt32(dr["Book_ID"].ToString());

                    string strPath    = Server.MapPath(ConfigurationManager.AppSettings["BookDesigner"].ToString() + objBookNew.bookId + "/");
                    string strAimPath = Server.MapPath("../Online/Book/" + objBookNew.bookId + "/");
                    if (!Directory.Exists(strPath))
                    {
                        SessionSet.PageMessage = "有教材还未创建内容,暂不能导入!";
                        return;
                    }

                    objBookNew.bookName       = dr["Book_Name"].ToString();
                    objBookNew.bookNo         = dr["Book_No"].ToString();
                    objBookNew.authors        = dr["Authors"].ToString();
                    objBookNew.bookmaker      = dr["BookMaker"].ToString();
                    objBookNew.publishOrg     = Convert.ToInt32(dr["Publish_Org"].ToString());
                    objBookNew.publishOrgName = dr["Short_Name"].ToString();
                    objBookNew.revisers       = dr["Revisers"].ToString();
                    objBookNew.coverDesigner  = dr["Cover_Designer"].ToString();
                    objBookNew.keyWords       = dr["Keywords"].ToString();
                    objBookNew.pageCount      = Convert.ToInt32(dr["Page_Count"].ToString());
                    objBookNew.wordCount      = Convert.ToInt32(dr["Word_Count"].ToString());
                    objBookNew.Description    = dr["Description"].ToString();
                    objBookNew.url            = "../Book/" + dr["Book_ID"].ToString() + "/index.html";
                    objBookNew.Memo           = dr["Remark"].ToString();
                    objBookNew.knowledgeId    = Convert.ToInt32(strKnowledgeId);

                    //objBookbll.UpdateBook(objBookNew, ref errorCode);

                    strSql = "select * from Book_Chapter where Book_ID=" + gvBook.DataKeys[i].Value.ToString();
                    ds     = RunSqlDataSet(strSql);

                    BookChapterBLL objBookChapterBll = new BookChapterBLL();

                    //取得Access数据库中当前教材的所有的章节ID
                    ArrayList objAccessChapterList = new ArrayList();

                    //取得当前教材在oracle数据中所有章节ID
                    ArrayList objList = GetBookChapterList(Convert.ToInt32(gvBook.DataKeys[i].Value.ToString()));
                    foreach (DataRow dr1 in ds.Tables[0].Rows)
                    {
                        RailExam.Model.BookChapter objBookChapter = new RailExam.Model.BookChapter();

                        objBookChapter.ChapterId           = Convert.ToInt32(dr1["Chapter_ID"].ToString());
                        objBookChapter.BookId              = Convert.ToInt32(dr1["Book_ID"].ToString());
                        objBookChapter.ChapterName         = dr1["Chapter_Name"].ToString();
                        objBookChapter.ParentId            = Convert.ToInt32(dr1["Parent_ID"].ToString());
                        objBookChapter.LevelNum            = Convert.ToInt32(dr1["Level_Num"].ToString());
                        objBookChapter.OrderIndex          = Convert.ToInt32(dr1["Order_Index"].ToString());
                        objBookChapter.ReferenceRegulation = dr1["REFERENCE_REGULATION"].ToString();
                        objBookChapter.Description         = dr1["Description"].ToString();
                        objBookChapter.Memo = dr1["Remark"].ToString();
                        objBookChapter.Url  = "../Book/" + dr1["Book_ID"].ToString() + "/" + dr1["Chapter_ID"].ToString() + ".htm";

                        //如果该章节的ID已存在当前oracle数据库中则只需修改章节信息,否则添加信息
                        if (objList.IndexOf(objBookChapter.ChapterId) != -1)
                        {
                            objBookChapterBll.UpdateBookChapter(objBookChapter);
                        }
                        else
                        {
                            objBookChapterBll.AddBookChapter(objBookChapter);
                        }

                        objAccessChapterList.Add(objBookChapter.ChapterId);
                    }

                    //取得当前教材在oracle中的所有教材信息


                    IList <RailExam.Model.BookChapter> objOracleBookChapterList =
                        objBookChapterBll.GetBookChapterByBookID(objBookNew.bookId);

                    foreach (RailExam.Model.BookChapter chapter in objOracleBookChapterList)
                    {
                        //如果oracle数据库中某章节ID不在Access数据库中
                        if (objAccessChapterList.IndexOf(chapter.ChapterId) == -1)
                        {
                            ItemBLL objItemBll = new ItemBLL();
                            IList <RailExam.Model.Item> objItemList = objItemBll.GetItemsByBookBookId(objBookNew.bookId);

                            foreach (RailExam.Model.Item item in objItemList)
                            {
                                item.StatusId = 2;
                                objItemBll.UpdateItem(item);
                            }

                            objBookChapterBll.DeleteBookChapter(chapter.ChapterId);
                        }
                    }

                    if (Directory.Exists(Server.MapPath("../Online/Book/" + objBookNew.bookId + "/")))
                    {
                        //Directory.Delete(Server.MapPath("../Online/Book/" + objBookNew.bookId + "/"), true);
                        DeleteFile(Server.MapPath("../Online/Book/" + objBookNew.bookId + "/"));
                    }

                    CopyTemplate(strPath, strAimPath);
                }
            }
            BindGrid();
        }
예제 #11
0
        private void BindGrid()
        {
            string strSql;

            strSql = "select a.*,b.Short_Name from Book a inner join Org b on a.Publish_Org=b.Org_ID where Publish_org=" + SessionSet.OrganizationID + ViewState["QuerySql"].ToString() + " order by Book_Name";
            DataSet ds = RunSqlDataSet(strSql);

            IList <RailExam.Model.Book> objList = new List <RailExam.Model.Book>();

            ArrayList objBookList = GetBookList();
            BookBLL   objBookbll  = new BookBLL();
            IList <RailExam.Model.Book> objAllBookList = objBookbll.GetAllBookInfo(SessionSet.OrganizationID);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                int n = objBookList.IndexOf(Convert.ToInt32(dr["Book_ID"].ToString()));
                if (n != -1)
                {
                    RailExam.Model.Book objBookNew = new RailExam.Model.Book();
                    objBookNew.bookId         = Convert.ToInt32(dr["Book_ID"].ToString());
                    objBookNew.bookName       = dr["Book_Name"].ToString();
                    objBookNew.bookNo         = dr["Book_No"].ToString();
                    objBookNew.authors        = dr["Authors"].ToString();
                    objBookNew.bookmaker      = dr["BookMaker"].ToString();
                    objBookNew.publishOrg     = Convert.ToInt32(dr["Publish_Org"].ToString());
                    objBookNew.publishOrgName = dr["Short_Name"].ToString();
                    objBookNew.revisers       = dr["Revisers"].ToString();
                    objBookNew.coverDesigner  = dr["Cover_Designer"].ToString();
                    objBookNew.keyWords       = dr["Keywords"].ToString();
                    objBookNew.pageCount      = Convert.ToInt32(dr["Page_Count"].ToString());
                    objBookNew.wordCount      = Convert.ToInt32(dr["Word_Count"].ToString());
                    objBookNew.Description    = dr["Description"].ToString();
                    objBookNew.url            = "../Book/" + dr["Book_ID"].ToString() + "/index.html";
                    objBookNew.Memo           = dr["Remark"].ToString();

                    foreach (RailExam.Model.Book obj in objAllBookList)
                    {
                        if (obj.bookId == Convert.ToInt32(dr["Book_ID"].ToString()))
                        {
                            TrainTypeBLL objTrainTypeBll = new TrainTypeBLL();
                            objBookNew.knowledgeId   = obj.knowledgeId;
                            objBookNew.knowledgeName = obj.knowledgeName;

                            BookTrainTypeBLL      objBookTrainTypeBll  = new BookTrainTypeBLL();
                            IList <BookTrainType> objBookTrainTypeList = objBookTrainTypeBll.GetBookTrainTypeByBookID(Convert.ToInt32(dr["Book_ID"].ToString()));
                            string strTypeName = "";
                            foreach (BookTrainType obj1 in objBookTrainTypeList)
                            {
                                if (strTypeName == "")
                                {
                                    strTypeName = strTypeName + GetType("/" + obj1.TrainTypeName, objTrainTypeBll.GetTrainTypeInfo(obj1.TrainTypeID).ParentID);
                                }
                                else
                                {
                                    strTypeName = strTypeName + "," + GetType("/" + obj1.TrainTypeName, objTrainTypeBll.GetTrainTypeInfo(obj1.TrainTypeID).ParentID);
                                }
                            }
                            objBookNew.trainTypeNames = strTypeName;
                        }
                    }

                    objList.Add(objBookNew);
                }
            }

            gvBook.DataSource = objList;
            gvBook.DataBind();
        }
예제 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strID = Request.QueryString.Get("id");
                ViewState["mode"]     = Request.QueryString.Get("mode");
                hfItemType.Value      = Request.QueryString.Get("itemTypeID");
                ddlType.SelectedValue = hfItemType.Value;
                if (ViewState["mode"].ToString() == "Insert")
                {
                    string subjectId = Request.QueryString.Get("subjectid");
                    hfSubjectId.Value = subjectId;
                    if (!string.IsNullOrEmpty(subjectId))
                    {
                        RandomExamSubjectBLL paperStrategySubjectBLL = new RandomExamSubjectBLL();
                        RandomExamSubject    paperStrategySubject    = paperStrategySubjectBLL.GetRandomExamSubject(int.Parse(subjectId));

                        if (paperStrategySubject != null)
                        {
                            hfExamID.Value        = paperStrategySubject.RandomExamId.ToString();
                            txtSubjectName.Text   = paperStrategySubject.SubjectName;
                            ddlType.SelectedValue = paperStrategySubject.ItemTypeId.ToString();
                            labelTotalCount.Text  = paperStrategySubject.ItemCount.ToString();

                            RandomExamStrategyBLL randomExamStrategyBLL = new RandomExamStrategyBLL();
                            IList <RailExam.Model.RandomExamStrategy> RandomExamStrategys = randomExamStrategyBLL.GetRandomExamStrategys(paperStrategySubject.RandomExamSubjectId);

                            int hasCount = 0;
                            foreach (RailExam.Model.RandomExamStrategy randomExamStrategy in RandomExamStrategys)
                            {
                                hasCount += randomExamStrategy.ItemCount;
                            }

                            labelLeaveCount.Text = (paperStrategySubject.ItemCount - hasCount).ToString();

                            txtNDR.Text = labelLeaveCount.Text;

                            RandomExamResultBLL reBll = new RandomExamResultBLL();
                            IList <RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(paperStrategySubject.RandomExamId);

                            if (examResults.Count > 0)
                            {
                                SaveButton.Visible = false;
                            }
                        }

                        hfSubjectId.Value = subjectId;

                        mother1.Visible = false;
                        mother2.Visible = false;
                    }

                    OracleAccess db     = new OracleAccess();
                    string       strSql = "select RANDOM_EXAM_STRATEGY_SEQ.nextval from dual";
                    DataRow      dr     = db.RunSqlDataSet(strSql).Tables[0].Rows[0];
                    hfKeyID.Value = dr[0].ToString();
                }
                else
                {
                    hfKeyID.Value = strID;
                    FillPage(int.Parse(strID));
                }
            }

            if (!string.IsNullOrEmpty(HfChapterId.Value))
            {
                if (HfRangeType.Value == "4")
                {
                    BookChapterBLL chapterBll = new BookChapterBLL();
                    BookChapter    chapter    = chapterBll.GetBookChapter(Convert.ToInt32(HfChapterId.Value));

                    txtChapterName.Text = chapter.ChapterName;
                }
                else
                {
                    BookBLL             bookBll = new BookBLL();
                    RailExam.Model.Book book    = bookBll.GetBook(Convert.ToInt32(HfChapterId.Value));

                    txtChapterName.Text = book.bookName;
                }
            }

            if (!string.IsNullOrEmpty(HfExCludeChaptersId.Value))
            {
                string strSql = "select * from Book_Chapter where Chapter_ID in (" + HfExCludeChaptersId.Value + ")";

                OracleAccess db = new OracleAccess();
                DataSet      ds = db.RunSqlDataSet(strSql);

                string strName = string.Empty;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (strName == string.Empty)
                    {
                        strName += dr["Chapter_Name"].ToString();
                    }
                    else
                    {
                        strName += "," + dr["Chapter_Name"].ToString();
                    }
                }

                txtExCludeChapters.Text = strName;
            }
        }
예제 #13
0
        private int SaveNewBook()
        {
            BookBLL kBLL = new BookBLL();


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

            book.bookName         = txtBookName.Text;
            book.knowledgeName    = txtKnowledgeName.Text;
            book.knowledgeId      = int.Parse(hfKnowledgeID.Value);
            book.publishOrg       = int.Parse(hfPublishOrgID.Value);
            book.publishDate      = DateTime.Today;
            book.TechnicianTypeID = Convert.ToInt32(ddlTech.SelectedValue);
            book.IsGroupLearder   = Convert.ToInt32(ddlIsGroup.SelectedValue);

            ArrayList alTrainTypeID = new ArrayList();

            string strTrainTypeID = hfTrainTypeID.Value;

            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.AddBook(book).ToString();

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

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

            SaveBookCover(strNewID);

            return(Convert.ToInt32(strNewID));
        }
예제 #14
0
        /// <summary>
        /// 发布教材
        /// </summary>
        /// <param name="strID"></param>
        public void GetIndex(string strID)
        {
            string strItem, strChapter;

            BookBLL objBll = new BookBLL();

            RailExam.Model.Book objBook = objBll.GetBook(Convert.ToInt32(strID));

            string strBookName = objBook.bookName;
            string strBookUrl  = objBook.url;
            string strVersion  = objBook.Version.ToString();

            WriteXml(strID, strVersion);

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

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

            IList <RailExam.Model.BookChapter> objBookChapter = GetBookChapterByBookID(Convert.ToInt32(strID));

            foreach (RailExam.Model.BookChapter chapter in objBookChapter)
            {
                if (chapter.ParentId == 0)
                {
                    if (chapter.Url == "" || chapter.Url == null)
                    {
                        strItem    += "['" + chapter.ChapterName + "', 'common.htm?url=empty.htm&chapterid=" + chapter.ChapterId + "&bookid=" + strID + "'";
                        strChapter += ",'" + chapter.ChapterId + "','empty.htm','" + chapter.NamePath + "'";
                    }
                    else
                    {
                        strItem    += "['" + chapter.ChapterName + "', 'common.htm?url=" + chapter.ChapterId + ".htm&chapterid=" + chapter.ChapterId + "&bookid=" + strID + "'";
                        strChapter += ",'" + chapter.ChapterId + "','" + chapter.ChapterId + ".htm','" + chapter.NamePath + "'";
                    }

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

                    strItem = Get(chapter.ChapterId, strItem);

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

            strItem += "]];";
            string strPath = "../Online/Book/" + 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/Book/" + 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/Book/" + 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>";
                }

                if (strIndex[i].IndexOf("common.htm?url=cover.htm&chapterid=0") != -1)
                {
                    strIndex[i] =
                        strIndex[i].Replace("common.htm?url=cover.htm&chapterid=0", "common.htm?url=cover.htm&chapterid=0&bookid=" + strID);
                }
            }

            File.WriteAllLines(HttpContext.Current.Server.MapPath("../Online/Book/" + strID + "/index.html"), strIndex, System.Text.Encoding.UTF8);
        }
예제 #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.CurrentLoginUser == null)
                {
                    Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!");
                    return;
                }

                //ViewState["NowID"] = "false";
                if (PrjPub.HasEditRight("教材管理") && PrjPub.IsServerCenter)                //&& PrjPub.CurrentLoginUser.SuitRange == 1
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }
                if (PrjPub.HasDeleteRight("教材管理") && PrjPub.IsServerCenter)                //&& PrjPub.CurrentLoginUser.SuitRange == 1
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }

                OrganizationBLL orgBll = new OrganizationBLL();
                int             orgID  = orgBll.GetStationOrgID(PrjPub.CurrentLoginUser.OrgID);
                HfOrgId.Value = orgID.ToString();

                BindGrid();
            }
            else
            {
                if (Request.Form.Get("Refresh") == "true")
                {
                    //ViewState["NowID"] = "false";
                    BindGrid();
                }
            }

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

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

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

            if (strUpID != null && strUpID != "")
            {
                if (Request.QueryString.Get("id") != null)
                {
                    BookBLL             objBll = new BookBLL();
                    RailExam.Model.Book obj    = objBll.GetBook(Convert.ToInt32(strUpID));
                    obj.OrderIndex = obj.OrderIndex - 1;
                    objBll.UpdateBook(obj);
                }

                if (Request.QueryString.Get("id1") != null)
                {
                    int trainTypeID = Convert.ToInt32(Request.QueryString.Get("id1"));
                    BookTrainTypeBLL objTrainTypeBll = new BookTrainTypeBLL();
                    BookTrainType    objTrainType    =
                        objTrainTypeBll.GetBookTrainType(Convert.ToInt32(strUpID), trainTypeID);
                    objTrainType.OrderIndex = objTrainType.OrderIndex - 1;
                    objTrainTypeBll.UpdateBookTrainType(objTrainType);
                }
                BindGrid();
            }

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

            if (strDownID != null && strDownID != "")
            {
                if (Request.QueryString.Get("id") != null)
                {
                    BookBLL             objBll = new BookBLL();
                    RailExam.Model.Book obj    = objBll.GetBook(Convert.ToInt32(strDownID));
                    obj.OrderIndex = obj.OrderIndex + 1;
                    objBll.UpdateBook(obj);
                }

                if (Request.QueryString.Get("id1") != null)
                {
                    int trainTypeID = Convert.ToInt32(Request.QueryString.Get("id1"));
                    BookTrainTypeBLL objTrainTypeBll = new BookTrainTypeBLL();
                    BookTrainType    objTrainType    =
                        objTrainTypeBll.GetBookTrainType(Convert.ToInt32(strDownID), trainTypeID);
                    objTrainType.OrderIndex = objTrainType.OrderIndex + 1;
                    objTrainTypeBll.UpdateBookTrainType(objTrainType);
                }
                BindGrid();
            }
        }
예제 #16
0
        protected void btnInput_Click(object sender, EventArgs e)
        {
            string strSql;

            for (int i = 0; i < gvBook.Rows.Count; i++)
            {
                CheckBox chk = (CheckBox)gvBook.Rows[i].FindControl("chSelect");

                HiddenField hfKownledgeName = (HiddenField)gvBook.Rows[i].FindControl("hfKownledgeName");
                HiddenField hfKownledgeId   = (HiddenField)gvBook.Rows[i].FindControl("hfKownledgeId");
                HiddenField hfTrainTypeName = (HiddenField)gvBook.Rows[i].FindControl("hfTrainTypeName");
                HiddenField hfTrainTypeID   = (HiddenField)gvBook.Rows[i].FindControl("hfTrainTypeID");

                if (chk.Checked && hfKownledgeName.Value.Trim() == "")
                {
                    SessionSet.PageMessage = "请选择教材体系!";
                    return;
                }

                if (chk.Checked && hfTrainTypeName.Value.Trim() == "")
                {
                    SessionSet.PageMessage = "请选择培训类别!";
                    return;
                }

                if (chk.Checked)
                {
                    strSql = "select a.*,b.Short_Name from Book a inner join Org b on a.Publish_Org=b.Org_ID where a.Book_ID=" + gvBook.DataKeys[i].Value.ToString();
                    DataSet ds = RunSqlDataSet(strSql);
                    DataRow dr = ds.Tables[0].Rows[0];

                    BookBLL             bookBLL = new BookBLL();
                    RailExam.Model.Book book    = new RailExam.Model.Book();

                    book.bookId = Convert.ToInt32(dr["Book_ID"].ToString());

                    string strPath    = Server.MapPath(ConfigurationManager.AppSettings["BookDesigner"].ToString() + book.bookId + "/");
                    string strAimPath = Server.MapPath("../Online/Book/" + book.bookId + "/");
                    if (!Directory.Exists(strPath))
                    {
                        SessionSet.PageMessage = "有教材还未创建内容,暂不能导入!";
                        return;
                    }

                    book.bookName       = dr["Book_Name"].ToString();
                    book.bookNo         = dr["Book_No"].ToString();
                    book.authors        = dr["Authors"].ToString();
                    book.bookmaker      = dr["BookMaker"].ToString();
                    book.publishOrg     = Convert.ToInt32(dr["Publish_Org"].ToString());
                    book.publishOrgName = dr["Short_Name"].ToString();
                    book.revisers       = dr["Revisers"].ToString();
                    book.coverDesigner  = dr["Cover_Designer"].ToString();
                    book.keyWords       = dr["Keywords"].ToString();
                    book.pageCount      = Convert.ToInt32(dr["Page_Count"].ToString());
                    book.wordCount      = Convert.ToInt32(dr["Word_Count"].ToString());
                    book.Description    = dr["Description"].ToString();
                    book.url            = "../Book/" + dr["Book_ID"].ToString() + "/index.html";
                    book.Memo           = dr["Remark"].ToString();
                    book.knowledgeId    = Convert.ToInt32(hfKownledgeId.Value);
                    book.knowledgeName  = hfKownledgeName.Value;

                    ArrayList typeIDAL  = new ArrayList();
                    string[]  strTypeID = hfTrainTypeID.Value.Split(',');
                    for (int j = 0; j < strTypeID.Length; j++)
                    {
                        typeIDAL.Add(strTypeID[j]);
                    }
                    book.trainTypeidAL = typeIDAL;

                    bookBLL.AddBook(book);

                    strSql = "select * from Book_Chapter where Book_ID=" + gvBook.DataKeys[i].Value.ToString() + " order by Level_Num,Order_Index";
                    ds     = RunSqlDataSet(strSql);

                    BookChapterBLL bookChapterBll = new BookChapterBLL();
                    foreach (DataRow dr1 in ds.Tables[0].Rows)
                    {
                        RailExam.Model.BookChapter bookChapter = new RailExam.Model.BookChapter();

                        bookChapter.ChapterId           = Convert.ToInt32(dr1["Chapter_ID"].ToString());
                        bookChapter.BookId              = Convert.ToInt32(dr1["Book_ID"].ToString());
                        bookChapter.ChapterName         = dr1["Chapter_Name"].ToString();
                        bookChapter.ParentId            = Convert.ToInt32(dr1["Parent_ID"].ToString());
                        bookChapter.LevelNum            = Convert.ToInt32(dr1["Level_Num"].ToString());
                        bookChapter.OrderIndex          = Convert.ToInt32(dr1["Order_Index"].ToString());
                        bookChapter.ReferenceRegulation = dr1["REFERENCE_REGULATION"].ToString();
                        bookChapter.Description         = dr1["Description"].ToString();
                        bookChapter.Memo = dr1["Remark"].ToString();
                        bookChapter.Url  = "../Book/" + dr1["Book_ID"].ToString() + "/" + dr1["Chapter_ID"].ToString() + ".htm";

                        bookChapterBll.AddBookChapter(bookChapter);
                    }

                    CopyTemplate(strPath, strAimPath);
                }
            }
            BindGrid();
        }