protected void btnQuery_Click(object sender, EventArgs e) { 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 strKnowledgeID = Request.QueryString.Get("id"); if (!string.IsNullOrEmpty(strKnowledgeID)) { if (strKnowledgeID != "0") { string[] str1 = strKnowledgeID.Split(new char[] { '/' }); int nKnowledgeId = int.Parse(str1[str1.LongLength - 1].ToString()); books = bookBLL.GetAssistBookByAssistBookCategoryID(nKnowledgeId, txtAssistBookName.Text, txtKeyWords.Text, txtAuthors.Text, orgID); } else { books = bookBLL.GetAssistBookByAssistBookCategoryID(0, txtAssistBookName.Text, txtKeyWords.Text, txtAuthors.Text, orgID); } } //string strTrainTypeID = Request.QueryString.Get("id1"); //if (!string.IsNullOrEmpty(strTrainTypeID)) //{ // string[] str2 = strTrainTypeID.Split(new char[] { '/' }); // int nTrainTypeID = int.Parse(str2[str2.LongLength - 1].ToString()); // books = bookBLL.GetAssistBookByTrainTypeID(nTrainTypeID, txtAssistBookName.Text, txtKeyWords.Text, txtAuthors.Text, PrjPub.CurrentLoginUser.OrgID); //} if (books != null) { Grid1.DataSource = books; Grid1.DataBind(); } }
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(); } }
private void BindGridByCategoryID() { string assistCategoryID = ViewState["KnowledgeID"].ToString(); //int postID = Convert.ToInt32(ViewState["PostID"].ToString()); //int orgID = Convert.ToInt32(ViewState["OrgID"].ToString()); //int techID = Convert.ToInt32(ViewState["Tech"].ToString()); //int leader = Convert.ToInt32(ViewState["Leader"].ToString()); AssistBookBLL bookBLL = new AssistBookBLL(); IList <RailExam.Model.AssistBook> bookList = new List <RailExam.Model.AssistBook>(); //if(assistCategoryID != "0") //{ bookList = bookBLL.GetAssistBookByAssistBookCategoryID(Convert.ToInt32(assistCategoryID), 1); //} //else //{ // bookList = bookBLL.GetAllAssistBookInfo(0); //} if (bookList.Count > 0) { foreach (RailExam.Model.AssistBook book in bookList) { 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>"; } } gvBook.DataSource = bookList; gvBook.DataBind(); } }