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