Exemplo n.º 1
0
        protected void btnDel_Click(object sender, EventArgs e)
        {
            BookBLL objbll = new BookBLL();
            IList <RailExam.Model.Book> objList = objbll.GetAllBookInfo(0);

            ArrayList objBookIDList = new ArrayList();

            foreach (RailExam.Model.Book book in objList)
            {
                objBookIDList.Add(book.bookId.ToString());
            }

            string[] fileList = Directory.GetFileSystemEntries(Server.MapPath("/RailExamBao/Online/Book/"));

            foreach (string file in fileList)
            {
                if (Directory.Exists(file))
                {
                    if (objBookIDList.IndexOf(Path.GetFileName(file)) == -1 && Path.GetFileName(file) != "template")
                    {
                        Directory.Delete(file, true);
                    }
                }
            }
            SessionSet.PageMessage = "整理成功!";
        }
Exemplo n.º 2
0
        private ArrayList GetBookList()
        {
            BookBLL objBookbll = new BookBLL();
            IList <RailExam.Model.Book> objList = objBookbll.GetAllBookInfo(SessionSet.OrganizationID);

            ArrayList objBookList = new ArrayList();

            foreach (RailExam.Model.Book obj in objList)
            {
                objBookList.Add(obj.bookId);
            }
            return(objBookList);
        }
Exemplo n.º 3
0
        private ArrayList GetBookIDList()
        {
            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> bookList = bookBLL.GetAllBookInfo(SessionSet.OrganizationID);

            ArrayList bookIDList = new ArrayList();

            foreach (RailExam.Model.Book book in bookList)
            {
                bookIDList.Add(book.bookId);
            }

            return(bookIDList);
        }
Exemplo n.º 4
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            BookBLL        objbll               = new BookBLL();
            BookChapterBLL objChapterbll        = new BookChapterBLL();
            IList <RailExam.Model.Book> objList = objbll.GetAllBookInfo(0);

            ArrayList objBookIDList = new ArrayList();

            foreach (RailExam.Model.Book book in objList)
            {
                if (Directory.Exists(Server.MapPath("../Online/Book/" + book.bookId + "/")))
                {
                    SaveBookCover(book.bookId.ToString());
                    objChapterbll.GetIndex(book.bookId.ToString());
                }
            }
            SessionSet.PageMessage = "发布成功!";
        }
Exemplo n.º 5
0
        private void BindGrid()
        {
            ArrayList objList = GetNowBookList();

            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> AllBookList = bookBLL.GetAllBookInfo(SessionSet.OrganizationID);
            IList <RailExam.Model.Book> NewBookList = new List <RailExam.Model.Book>();

            foreach (RailExam.Model.Book book in AllBookList)
            {
                if (objList.IndexOf(book.bookId.ToString()) == -1)
                {
                    NewBookList.Add(book);
                }
            }

            TrainTypeBLL     trainTypeBLL     = new TrainTypeBLL();
            BookTrainTypeBLL bookTrainTypeBLL = new BookTrainTypeBLL();

            foreach (RailExam.Model.Book book in NewBookList)
            {
                IList <BookTrainType> bookTrainTypeList = bookTrainTypeBLL.GetBookTrainTypeByBookID(book.bookId);
                string strTrainTypeNames = "";
                foreach (BookTrainType bookTrainType in bookTrainTypeList)
                {
                    if (strTrainTypeNames == "")
                    {
                        strTrainTypeNames = strTrainTypeNames + GetTrainTypeName("/" + bookTrainType.TrainTypeName, trainTypeBLL.GetTrainTypeInfo(bookTrainType.TrainTypeID).ParentID);
                    }
                    else
                    {
                        strTrainTypeNames = strTrainTypeNames + "," + GetTrainTypeName("/" + bookTrainType.TrainTypeName, trainTypeBLL.GetTrainTypeInfo(bookTrainType.TrainTypeID).ParentID);
                    }
                }
                book.trainTypeNames = strTrainTypeNames;
            }

            gvBook.DataSource = NewBookList;
            gvBook.DataBind();
        }
Exemplo n.º 6
0
        private void BindBookTree()
        {
            tvBook.Nodes.Clear();
            BookBLL objBookBll = new BookBLL();
            IList <RailExam.Model.Book> objBookList = null;

            if (Request.QueryString.Get("StandardID") != null && Request.QueryString.Get("StandardID") != "")
            {
                objBookList = objBookBll.GetTrainCourseBookChapterTree(Convert.ToInt32(ViewState["PostID"].ToString()));
            }
            else
            {
                objBookList = objBookBll.GetAllBookInfo(1);
            }

            ArrayList objList = GetChapterList();

            if (objBookList.Count > 0)
            {
                TreeViewNode tvn = null;

                foreach (RailExam.Model.Book book in objBookList)
                {
                    tvn              = new TreeViewNode();
                    tvn.ID           = book.bookId.ToString();
                    tvn.Value        = book.bookId.ToString();
                    tvn.Text         = book.bookName;
                    tvn.ToolTip      = book.bookName;
                    tvn.ShowCheckBox = true;

                    tvBook.Nodes.Add(tvn);

                    if (objList.Count > 0)
                    {
                        if (objList.IndexOf(book.bookId.ToString()) != -1)
                        {
                            tvn.Checked = true;
                        }
                    }

                    BookChapterBLL objBookChapterBll = new BookChapterBLL();
                    IList <RailExam.Model.BookChapter> objBookChapterList =
                        objBookChapterBll.GetTrainCourseBookChapterTree(book.bookId);

                    if (objBookChapterList.Count > 0)
                    {
                        foreach (BookChapter objBookChapter in objBookChapterList)
                        {
                            tvn              = new TreeViewNode();
                            tvn.ID           = objBookChapter.ChapterId.ToString();
                            tvn.Value        = book.bookId.ToString();
                            tvn.Text         = objBookChapter.ChapterName;
                            tvn.ToolTip      = objBookChapter.ChapterName;
                            tvn.ShowCheckBox = true;

                            if (objList.Count > 0)
                            {
                                if (objList.IndexOf(objBookChapter.ChapterId) != -1)
                                {
                                    tvn.Checked = true;
                                }
                            }

                            if (objBookChapter.ParentId == 0)
                            {
                                try
                                {
                                    tvBook.FindNodeById(book.bookId.ToString()).Nodes.Add(tvn);
                                }
                                catch
                                {
                                    tvBook.Nodes.Clear();
                                    Response.Write("数据错误!");
                                    return;
                                }
                            }
                            else
                            {
                                try
                                {
                                    tvBook.FindNodeById(objBookChapter.ParentId.ToString()).Nodes.Add(tvn);
                                }
                                catch
                                {
                                    tvBook.Nodes.Clear();
                                    Response.Write("数据错误!");
                                    return;
                                }
                            }
                        }
                    }
                }
            }
            tvBook.DataBind();
            tvBook.ExpandAll();
        }
Exemplo n.º 7
0
        private void BindGrid()
        {
            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> books         = new List <RailExam.Model.Book>();
            IList <RailExam.Model.Book> booksViaPosts = new List <RailExam.Model.Book>();

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

            string strKnowledgeIDPath = Request.QueryString.Get("id");

            if (!string.IsNullOrEmpty(strKnowledgeIDPath))
            {
                if (strKnowledgeIDPath != "0")
                {
                    books = bookBLL.GetBookByKnowledgeID(Convert.ToInt32(strKnowledgeIDPath), orgID);
                }
                else
                {
                    if (PrjPub.CurrentLoginUser.SuitRange == 1)
                    {
                        books = bookBLL.GetAllBookInfo(0);
                    }
                    else
                    {
                        books = bookBLL.GetAllBookInfo(orgID);
                    }
                }
            }

            string strTrainTypeIDPath = Request.QueryString.Get("id1");

            if (!string.IsNullOrEmpty(strTrainTypeIDPath))
            {
                if (strTrainTypeIDPath != "0")
                {
                    books = bookBLL.GetBookByTrainTypeID(Convert.ToInt32(strTrainTypeIDPath), orgID);
                }
                else
                {
                    if (PrjPub.CurrentLoginUser.SuitRange == 1)
                    {
                        books = bookBLL.GetAllBookInfo(0);
                    }
                    else
                    {
                        books = bookBLL.GetAllBookInfo(orgID);
                    }
                }
            }

            OracleAccess oa = new OracleAccess();

            if (!string.IsNullOrEmpty(txtPost.Text.Trim()) || !string.IsNullOrEmpty(hfPostID.Value))
            {
                string postID = this.hfPostID.Value;

                string sql = String.Format(
                    @"select book_id from BOOK_RANGE_POST t 
                        where 
                            post_id = {0} 
                            or 
                            post_id in 
                                (select post_id from POST t where parent_id = {0})",
                    postID
                    );

                DataSet dsBookIDs = oa.RunSqlDataSet(sql);
                if (dsBookIDs != null && dsBookIDs.Tables.Count > 0)
                {
                    foreach (RailExam.Model.Book book in books)
                    {
                        DataRow[] drs = dsBookIDs.Tables[0].Select("book_id=" + book.bookId);
                        if (drs.Length > 0)
                        {
                            booksViaPosts.Add(book);
                        }
                    }
                    books.Clear();
                    books = booksViaPosts;
                }
            }

            int railSystemid = PrjPub.RailSystemId();

            if (railSystemid != 0)
            {
                string sql = String.Format(
                    @"select book_id from BOOK_RANGE_ORG t 
                        where 
                            org_Id in (select org_id from org where rail_System_Id={0} and level_num=2) ",
                    railSystemid
                    );

                DataSet dsBookIDs = oa.RunSqlDataSet(sql);
                if (dsBookIDs != null && dsBookIDs.Tables.Count > 0)
                {
                    foreach (RailExam.Model.Book book in books)
                    {
                        DataRow[] drs = dsBookIDs.Tables[0].Select("book_id=" + book.bookId);
                        if (drs.Length > 0)
                        {
                            booksViaPosts.Add(book);
                        }
                    }
                    books.Clear();
                    books = booksViaPosts;
                }
            }

            if (books.Count > 0)
            {
                foreach (RailExam.Model.Book book in books)
                {
                    if (book.authors == null)
                    {
                        book.authors = "-1";
                    }

                    if (book.bookName.Length <= 30)
                    {
                        book.bookName = "<a onclick=OpenIndex('" + book.bookId + "') href=# title=" + book.bookName + " > " + book.bookName + " </a>";
                    }
                    else
                    {
                        book.bookName = "<a onclick=OpenIndex('" + book.bookId + "') href=# title=" + book.bookName + " > " + book.bookName.Substring(0, 15) + "...</a>";
                    }
                }

                Grid1.DataSource = books;
                Grid1.DataBind();
            }
        }
Exemplo n.º 8
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();
        }
Exemplo n.º 9
0
        private void BindGrid()
        {
            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> books = new List <RailExam.Model.Book>();

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

            string strKnowledgeIDPath = Request.QueryString.Get("id");

            if (!string.IsNullOrEmpty(strKnowledgeIDPath))
            {
                if (strKnowledgeIDPath != "0")
                {
                    books = bookBLL.GetBookByKnowledgeID(Convert.ToInt32(strKnowledgeIDPath), orgID);
                }
                else
                {
                    if (PrjPub.CurrentLoginUser.SuitRange == 1)
                    {
                        books = bookBLL.GetAllBookInfo(0);
                    }
                    else
                    {
                        books = bookBLL.GetAllBookInfo(orgID);
                    }
                }
            }

            string strTrainTypeIDPath = Request.QueryString.Get("id1");

            if (!string.IsNullOrEmpty(strTrainTypeIDPath))
            {
                if (strTrainTypeIDPath != "0")
                {
                    books = bookBLL.GetBookByTrainTypeID(Convert.ToInt32(strTrainTypeIDPath), orgID);
                }
                else
                {
                    if (PrjPub.CurrentLoginUser.SuitRange == 1)
                    {
                        books = bookBLL.GetAllBookInfo(0);
                    }
                    else
                    {
                        books = bookBLL.GetAllBookInfo(orgID);
                    }
                }
            }

            string strPostID = Request.QueryString.Get("id2");

            if (!string.IsNullOrEmpty(strPostID))
            {
                if (strPostID != "0")
                {
                    books = bookBLL.GetBookByPostID(Convert.ToInt32(strPostID), orgID);
                }
                else
                {
                    if (PrjPub.CurrentLoginUser.SuitRange == 1)
                    {
                        books = bookBLL.GetAllBookInfo(0);
                    }
                    else
                    {
                        books = bookBLL.GetAllBookInfo(orgID);
                    }
                }
            }

            if (books.Count > 0)
            {
                foreach (RailExam.Model.Book book in books)
                {
                    if (book.bookName.Length <= 15)
                    {
                        book.bookName = "<a onclick=OpenIndex('" + book.bookId + "') href=# title=" + book.bookName + " > " + book.bookName + " </a>";
                    }
                    else
                    {
                        book.bookName = "<a onclick=OpenIndex('" + book.bookId + "') href=# title=" + book.bookName + " > " + book.bookName.Substring(0, 15) + "...</a>";
                    }
                }
                Grid1.DataSource = books;
                Grid1.DataBind();
            }
        }