protected void btnDelAssist_Click(object sender, EventArgs e) { AssistBookBLL objbll = new AssistBookBLL(); IList <RailExam.Model.AssistBook> objList = objbll.GetAllAssistBookInfo(0); ArrayList objBookIDList = new ArrayList(); foreach (RailExam.Model.AssistBook book in objList) { objBookIDList.Add(book.AssistBookId.ToString()); } string[] fileList = Directory.GetFileSystemEntries(Server.MapPath("/RailExamBao/Online/AssistBook/")); 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 = "整理成功!"; }
private void BindGrid() { AssistBookBLL bookBLL = new AssistBookBLL(); IList <RailExam.Model.AssistBook> books = new List <RailExam.Model.AssistBook>(); OrganizationBLL orgBll = new OrganizationBLL(); int orgID = orgBll.GetStationOrgID(PrjPub.CurrentLoginUser.OrgID); string strCategoryIDPath = Request.QueryString.Get("id"); if (!string.IsNullOrEmpty(strCategoryIDPath)) { if (strCategoryIDPath != "0") { books = bookBLL.GetAssistBookByAssistBookCategoryID(Convert.ToInt32(strCategoryIDPath), orgID); } else { books = bookBLL.GetAllAssistBookInfo(0); } } //string strTrainTypeIDPath = Request.QueryString.Get("id1"); //if (!string.IsNullOrEmpty(strTrainTypeIDPath)) //{ // books = bookBLL.GetAssistBookByTrainTypeIDPath(strTrainTypeIDPath, PrjPub.CurrentLoginUser.OrgID); //} if (books.Count > 0) { foreach (RailExam.Model.AssistBook book in books) { if (book.BookName.Length <= 15) { book.BookName = "<a onclick=OpenIndex('" + book.AssistBookId + "') href=# title=" + book.BookName + " > " + book.BookName + " </a>"; } else { book.BookName = "<a onclick=OpenIndex('" + book.AssistBookId + "') href=# title=" + book.BookName + " > " + book.BookName.Substring(0, 15) + " </a>"; } } Grid1.DataSource = books; Grid1.DataBind(); } }