protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int railSystemId = PrjPub.RailSystemId(); string str = ""; if (railSystemId != 0) { str = " and (Rail_System_ID= " + railSystemId + " or org_id=" + PrjPub.CurrentLoginUser.StationOrgID + ")"; } string strSql = "select * from org where level_num=2 " + str + " order by parent_id,order_index"; ListItem item = new ListItem(); item.Text = "--ÇëÑ¡Ôñ--"; item.Value = "0"; ddlOrg.Items.Add(item); OracleAccess db = new OracleAccess(); DataSet ds = db.RunSqlDataSet(strSql); foreach (DataRow dr in ds.Tables[0].Rows) { item = new ListItem(); item.Text = dr["Short_Name"].ToString(); item.Value = dr["Org_ID"].ToString(); ddlOrg.Items.Add(item); } if (PrjPub.CurrentLoginUser.SuitRange == 0) { ddlOrg.SelectedValue = PrjPub.CurrentLoginUser.StationOrgID.ToString(); ddlOrg.Enabled = false; } employeeList.Attributes.Add("onchange", "employeeList_onChange()"); } }
private void BindGrid() { string strIDPath = Request.QueryString["id"]; CoursewareBLL coursewareBLL = new CoursewareBLL(); IList <RailExam.Model.Courseware> coursewares = new List <RailExam.Model.Courseware>(); OrganizationBLL orgBll = new OrganizationBLL(); int orgID = orgBll.GetStationOrgID(PrjPub.CurrentLoginUser.OrgID); if (Request.QueryString.Get("type") == "Courseware") { coursewares = coursewareBLL.GetCoursewaresByCoursewareTypeID(Convert.ToInt32(strIDPath), orgID); } else { coursewares = coursewareBLL.GetCoursewaresByTrainTypeID(Convert.ToInt32(strIDPath), orgID); } OracleAccess oa = new OracleAccess(); int railSystemid = PrjPub.RailSystemId(); if (railSystemid != 0) { IList <RailExam.Model.Courseware> coursewaresVia = new List <RailExam.Model.Courseware>(); string sql = String.Format( @"select courseware_id from courseware_RANGE_ORG t where org_Id in (select org_id from org where rail_System_Id={0} and level_num=2) ", railSystemid ); DataSet dscoursewareIDs = oa.RunSqlDataSet(sql); if (dscoursewareIDs != null && dscoursewareIDs.Tables.Count > 0) { foreach (RailExam.Model.Courseware courseware in coursewares) { DataRow[] drs = dscoursewareIDs.Tables[0].Select("courseware_id=" + courseware.CoursewareID); if (drs.Length > 0) { coursewaresVia.Add(courseware); } } coursewares.Clear(); coursewares = coursewaresVia; } } if (coursewares != null) { foreach (RailExam.Model.Courseware obj in coursewares) { if (obj.CoursewareName.Length <= 20) { obj.CoursewareName = "<a onclick=OpenIndex('" + obj.CoursewareID + "') href=# title=" + obj.CoursewareName + " > " + obj.CoursewareName + " </a>"; } else { obj.CoursewareName = "<a onclick=OpenIndex('" + obj.CoursewareID + "') href=# title=" + obj.CoursewareName + " > " + obj.CoursewareName.Substring(0, 20) + "...</a>"; } } Grid1.DataSource = coursewares; Grid1.DataBind(); } }
protected void btnQuery_Click(object sender, EventArgs e) { 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 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.GetBookByKnowledgeID(nKnowledgeId, txtBookName.Text, txtKeyWords.Text, txtAuthors.Text, orgID); } else { books = bookBLL.GetBookByKnowledgeID(0, txtBookName.Text, txtKeyWords.Text, txtAuthors.Text, orgID); } } string strTrainTypeID = Request.QueryString.Get("id1"); if (!string.IsNullOrEmpty(strTrainTypeID)) { if (strTrainTypeID != "0") { string[] str2 = strTrainTypeID.Split(new char[] { '/' }); int nTrainTypeID = int.Parse(str2[str2.LongLength - 1].ToString()); books = bookBLL.GetBookByTrainTypeID(nTrainTypeID, txtBookName.Text, txtKeyWords.Text, txtAuthors.Text, orgID); } else { books = bookBLL.GetBookByTrainTypeID(0, txtBookName.Text, txtKeyWords.Text, txtAuthors.Text, orgID); } } if (string.IsNullOrEmpty(hfPostID.Value)) { txtPost.Text = string.Empty; } OracleAccess oa = new OracleAccess(); if (this.txtPost.Text.Trim().Length > 0) { 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 != null) { 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(); } }
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(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (PrjPub.CurrentLoginUser == null) { Response.Redirect("../Common/Error.aspx?error=Session过期请重新登录本系统!"); return; } int railSystemId = PrjPub.RailSystemId(); string str = ""; if (railSystemId != 0) { str = " and (Rail_System_ID= " + railSystemId + " or org_id=" + PrjPub.CurrentLoginUser.StationOrgID + ")"; } string strSql = "select * from org where level_num=2 " + str + " and Is_Effect=1 order by parent_id,order_index"; OracleAccess db = new OracleAccess(); DataSet ds = db.RunSqlDataSet(strSql); ListItem item1 = new ListItem(); item1.Text = "--请选择--"; item1.Value = "0"; ddlOrg.Items.Add(item1); foreach (DataRow dr in ds.Tables[0].Rows) { ListItem item = new ListItem(); item.Text = dr["Short_Name"].ToString(); item.Value = dr["Org_ID"].ToString(); ddlOrg.Items.Add(item); } //ddlOrg.SelectedValue = PrjPub.CurrentLoginUser.StationOrgID.ToString(); if (PrjPub.CurrentLoginUser.SuitRange == 0) { ddlOrg.Visible = false; lblOrg.Visible = false; } for (int i = 2010; i < 2027; i++) { ListItem item = new ListItem(); item.Text = i.ToString(); item.Value = i.ToString(); ddlYear.Items.Add(item); } ddlYear.Items.Insert(0, "--请选择--"); ddlYear.SelectedValue = DateTime.Now.Year.ToString(); //绑定培训计划类别 OracleAccess oracleAccess = new OracleAccess(); DataSet ds1 = oracleAccess.RunSqlDataSet("select * from ZJ_TRAINPLAN_TYPE"); ddlTrainPlanType.DataSource = ds1.Tables[0].DefaultView; ddlTrainPlanType.DataTextField = "TRAINPLAN_TYPE_NAME"; ddlTrainPlanType.DataValueField = "TRAINPLAN_TYPE_ID"; ddlTrainPlanType.DataBind(); hfSelect.Value = GetSql(); if (PrjPub.HasEditRight("培训计划") && PrjPub.IsServerCenter) { HfUpdateRight.Value = "True"; } else { HfUpdateRight.Value = "False"; } if (PrjPub.HasDeleteRight("培训计划") && PrjPub.IsServerCenter) { HfDeleteRight.Value = "True"; } else { HfDeleteRight.Value = "False"; } } }
protected void Page_Load(object sender, EventArgs e) { string strKnowledgeId = Request.QueryString.Get("id"); string strflag = Request.QueryString.Get("flag"); string strItemTypeID = Request.QueryString.Get("itemTypeID"); ItemBLL objItemBll = new ItemBLL(); string strBook = ""; if (!string.IsNullOrEmpty(strKnowledgeId)) { ComponentArt.Web.UI.TreeView tvBookBook = new ComponentArt.Web.UI.TreeView(); BookBLL bookBLL = new BookBLL(); IList <RailExam.Model.Book> bookList = null; if (strflag != null && strflag == "2") { int knowledgeID = Convert.ToInt32(strKnowledgeId); int postID = Convert.ToInt32(Request.QueryString.Get("PostID")); int orgID = Convert.ToInt32(Request.QueryString.Get("OrgID")); int leader = Convert.ToInt32(Request.QueryString.Get("Leader")); int techID = Convert.ToInt32(Request.QueryString.Get("Tech")); bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(knowledgeID, orgID, postID, leader, techID, 0); } else { if (PrjPub.CurrentLoginUser.SuitRange == 0 && Request.QueryString.Get("source") == "itemlist") { bookList = bookBLL.GetBookByKnowledgeIDPath(strKnowledgeId, PrjPub.CurrentLoginUser.StationOrgID); if (!string.IsNullOrEmpty(Request.QueryString.Get("postId"))) { string postID = Request.QueryString.Get("postId"); OracleAccess oa = new OracleAccess(); 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 ); IList <RailExam.Model.Book> booksViaPosts = new List <RailExam.Model.Book>(); DataSet dsBookIDs = oa.RunSqlDataSet(sql); if (dsBookIDs != null && dsBookIDs.Tables.Count > 0) { foreach (RailExam.Model.Book book in bookList) { DataRow[] drs = dsBookIDs.Tables[0].Select("book_id=" + book.bookId); if (drs.Length > 0) { booksViaPosts.Add(book); } } bookList.Clear(); bookList = booksViaPosts; } } } else { if (!string.IsNullOrEmpty(Request.QueryString.Get("RandomExamID"))) { string examId = Request.QueryString.Get("RandomExamID"); RandomExamBLL objBll = new RandomExamBLL(); RailExam.Model.RandomExam objexam = objBll.GetExam(Convert.ToInt32(examId)); string strPost = objexam.PostID; if (objexam.AutoSaveInterval == 1) { strPost = ""; } bookList = bookBLL.GetBookByKnowledgeIDPath(strKnowledgeId); OracleAccess oa = new OracleAccess(); if (strPost != "") { string sql = @"select book_id from BOOK_RANGE_POST t where post_id in (" + strPost + @")"; DataTable dt = oa.RunSqlDataSet(sql).Tables[0]; IList <RailExam.Model.Book> objList = new List <RailExam.Model.Book>(); foreach (RailExam.Model.Book book in bookList) { DataRow[] dr = dt.Select("book_id=" + book.bookId); if (dr.Length > 0) { objList.Add(book); } } bookList.Clear(); bookList = objList; } if (objexam.HasTrainClass) { string sql = "select * from ZJ_Train_Class_Subject_Book a " + " inner join ZJ_Train_Class_Subject b on a.Train_Class_Subject_ID = b.Train_Class_Subject_ID " + " where b.Train_Class_ID in (select Train_Class_ID from Random_Exam_Train_Class " + " where Random_Exam_ID=" + objexam.RandomExamId + ")"; DataTable dt = oa.RunSqlDataSet(sql).Tables[0]; foreach (DataRow dr in dt.Rows) { if (strBook == "") { strBook += dr["Book_ID"].ToString(); } else { strBook += "," + dr["Book_ID"]; } } } } else { bookList = bookBLL.GetBookByKnowledgeIDPath(strKnowledgeId); OracleAccess oa = new OracleAccess(); IList <RailExam.Model.Book> booksViaPosts = new List <RailExam.Model.Book>(); if (!string.IsNullOrEmpty(Request.QueryString.Get("postId"))) { string postID = Request.QueryString.Get("postId"); 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 bookList) { DataRow[] drs = dsBookIDs.Tables[0].Select("book_id=" + book.bookId); if (drs.Length > 0) { booksViaPosts.Add(book); } } bookList.Clear(); bookList = 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 bookList) { DataRow[] drs = dsBookIDs.Tables[0].Select("book_id=" + book.bookId); if (drs.Length > 0) { booksViaPosts.Add(book); } } bookList.Clear(); bookList = booksViaPosts; } } } } } if (bookList.Count > 0) { TreeViewNode tvn = null; foreach (RailExam.Model.Book book in bookList) { tvn = new TreeViewNode(); tvn.ID = book.bookId.ToString(); tvn.Value = book.bookId.ToString(); if (Request.QueryString.Get("item") != null && Request.QueryString.Get("item") == "no") { tvn.Text = book.bookName; } else { int n = objItemBll.GetItemsByBookID(book.bookId, Convert.ToInt32(strItemTypeID)); if (n > 0) { tvn.Text = book.bookName + "(" + n + "题)"; } else { tvn.Text = book.bookName; } } if (("," + strBook + ",").IndexOf("," + book.bookId + ",") >= 0) { tvn.ImageUrl = "~/App_Themes/" + StyleSheetTheme + "/Images/TreeView/RedBook.gif"; } else { tvn.ImageUrl = "~/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Book.gif"; } tvn.ToolTip = book.bookName; tvn.Attributes.Add("isBook", "true"); if (strflag != null && (strflag == "2" || strflag == "3" || strflag == "4")) { tvn.ShowCheckBox = true; if (strflag == "4") { string strBookIds = Request.QueryString.Get("bookIds"); if (("|" + strBookIds + "|").IndexOf("|" + book.bookId + "|") >= 0) { tvn.Checked = true; } } } //没有题目数量显示 if (Request.QueryString.Get("item") != null && Request.QueryString.Get("item") == "no") { if (strflag != null) { if (strflag == "2") { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&flag=" + strflag + "&id=" + book.bookId; } //屏蔽教材 else if (strflag == "1") { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&flag=" + strflag + "&id=" + book.bookId + "&StrategyID=" + Request.QueryString.Get("StrategyID"); } } else { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?item=no&id=" + book.bookId; } } else { if (strflag != null) { if (strflag == "2") { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&flag=" + strflag + "&id=" + book.bookId; } //屏蔽教材 else if (strflag == "1") { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&flag=" + strflag + "&id=" + book.bookId + "&StrategyID=" + Request.QueryString.Get("StrategyID"); } } else { tvn.ContentCallbackUrl = "../Common/GetBookChapter.aspx?itemTypeID=" + strItemTypeID + "&id=" + book.bookId; } } tvBookBook.Nodes.Add(tvn); } } Response.Clear(); Response.ClearHeaders(); Response.ContentType = "text/xml"; Response.Cache.SetNoStore(); string strXmlEncoding = string.Empty; try { strXmlEncoding = System.Configuration.ConfigurationManager.AppSettings["CallbackEncoding"]; } catch { strXmlEncoding = "gb2312"; #if DEBUG System.Diagnostics.Debug.WriteLine("Error Accessing Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif } if (string.IsNullOrEmpty(strXmlEncoding)) { strXmlEncoding = "gb2312"; #if DEBUG System.Diagnostics.Debug.WriteLine("CallbackEncoding Empty in Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif } else { try { System.Text.Encoding enc = System.Text.Encoding.GetEncoding(strXmlEncoding); } catch { #if DEBUG System.Diagnostics.Debug.WriteLine("Invalid Encoding in Web.Config File!\r\n" + "Using \"gb2312\"!"); #endif strXmlEncoding = "gb2312"; } } Response.Write("<?xml version=\"1.0\" encoding=\"" + strXmlEncoding + "\" standalone=\"yes\" ?>\r\n" + tvBookBook.GetXml()); Response.Flush(); Response.End(); } }