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 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 BindOrgTree() { OrganizationBLL organizationBLL = new OrganizationBLL(); int railSystemID = PrjPub.GetRailSystemId(); if ((PrjPub.CurrentLoginUser.SuitRange == 1 || railSystemID != 0) && PrjPub.IsServerCenter) { IList <RailExam.Model.Organization> organizationList = organizationBLL.GetOrganizationsByLevel(2); string strOwnIDs = string.Empty; if (railSystemID != 0) { IList <RailExam.Model.Organization> organizationList1 = organizationBLL.GetOrganizations(PrjPub.CurrentLoginUser.StationOrgID); foreach (RailExam.Model.Organization organization in organizationList1) { strOwnIDs += strOwnIDs == string.Empty ? organization.OrganizationId.ToString() : "," + organization.OrganizationId; } } if (organizationList.Count > 0) { TreeViewNode tvn = null; foreach (Organization organization in organizationList) { if ((organization.IdPath + "/").IndexOf("/1/") >= 0 && organization.LevelNum != 1 && railSystemID != 0 && railSystemID != organization.RailSystemID) { continue; } if (organization.LevelNum != 1 && strOwnIDs != string.Empty && (organization.IdPath + "/").IndexOf("/1/") < 0 && ("," + strOwnIDs + ",").IndexOf("," + organization.OrganizationId + ",") < 0) { continue; } tvn = new TreeViewNode(); tvn.ID = organization.OrganizationId.ToString(); tvn.Value = organization.OrganizationId.ToString(); tvn.Text = organization.ShortName; tvn.ToolTip = organization.FullName; if (organization.ParentId == 0) { tvView.Nodes.Add(tvn); } else { try { tvView.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn); } catch { tvView.Nodes.Clear(); SessionSet.PageMessage = "Êý¾Ý´íÎó£¡"; return; } } } } if (tvView.Nodes.Count > 0) { tvView.Nodes[0].Expanded = true; } } else { string strOrgID; if (PrjPub.IsServerCenter) { strOrgID = PrjPub.CurrentLoginUser.StationOrgID.ToString(); } else { strOrgID = ConfigurationManager.AppSettings["StationID"].ToString(); } int stationID = organizationBLL.GetStationOrgID(Convert.ToInt32(strOrgID)); RailExam.Model.Organization organization = organizationBLL.GetOrganization(stationID); TreeViewNode tvn = null; tvn = new TreeViewNode(); tvn.ID = organization.OrganizationId.ToString(); tvn.Value = organization.IdPath.ToString(); tvn.Text = organization.ShortName; tvn.ToolTip = organization.FullName; tvView.Nodes.Add(tvn); } tvView.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(); 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 BindOrganizationTree() { OrganizationBLL organizationBLL = new OrganizationBLL(); IList <RailExam.Model.Organization> organizationList = new List <RailExam.Model.Organization>(); int railSystemID = 0; if (PrjPub.IsServerCenter) { SystemRoleBLL roleBll = new SystemRoleBLL(); SystemRole role = roleBll.GetRole(PrjPub.CurrentLoginUser.RoleID); railSystemID = role.RailSystemID; } if (PrjPub.IsServerCenter && (PrjPub.CurrentLoginUser.SuitRange == 1 || railSystemID != 0)) { SystemRoleBLL roleBll = new SystemRoleBLL(); SystemRole role = roleBll.GetRole(PrjPub.CurrentLoginUser.RoleID); organizationList = organizationBLL.GetOrganizations(); string strOwnIDs = string.Empty; if (railSystemID != 0) { IList <RailExam.Model.Organization> organizationList1 = organizationBLL.GetOrganizations(PrjPub.CurrentLoginUser.StationOrgID); foreach (RailExam.Model.Organization organization in organizationList1) { strOwnIDs += strOwnIDs == string.Empty ? organization.OrganizationId.ToString() : "," + organization.OrganizationId; } } if (organizationList.Count > 0) { TreeViewNode tvn = null; tvn = new TreeViewNode(); //tvn.ID = "0"; //tvn.Value = "0"; //tvn.Text = PrjPub.GetRailNameBao(); //tvn.ToolTip = PrjPub.GetRailNameBao(); //tvOrganization.Nodes.Add(tvn); foreach (RailExam.Model.Organization organization in organizationList) { if ((organization.IdPath + "/").IndexOf("/1/") >= 0 && organization.LevelNum != 1 && railSystemID != 0 && railSystemID != organization.RailSystemID) { continue; } if (organization.LevelNum != 1 && strOwnIDs != string.Empty && (organization.IdPath + "/").IndexOf("/1/") < 0 && ("," + strOwnIDs + ",").IndexOf("," + organization.OrganizationId + ",") < 0) { continue; } tvn = new TreeViewNode(); tvn.ID = organization.OrganizationId.ToString(); tvn.Value = organization.OrganizationId.ToString(); tvn.Text = organization.ShortName; tvn.ToolTip = organization.FullName; try { if (organization.ParentId == 0) { tvn.Expanded = true; tvOrganization.Nodes.Add(tvn); } else { tvOrganization.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn); } } catch { tvOrganization.Nodes.Clear(); SessionSet.PageMessage = "数据错误!"; return; } } } //Pub.BuildComponentArtTreeView(tvOrganization, (IList)organizationList, "OrganizationId", // "ParentId", "ShortName", "FullName", "OrganizationId", null, null, null); } else { string strOrgID; if (PrjPub.IsServerCenter) { strOrgID = PrjPub.CurrentLoginUser.StationOrgID.ToString(); } else { strOrgID = ConfigurationManager.AppSettings["StationID"].ToString(); } int stationID = organizationBLL.GetStationOrgID(Convert.ToInt32(strOrgID)); organizationList = organizationBLL.GetOrganizations(stationID); if (organizationList.Count > 0) { TreeViewNode tvn = null; tvn = new TreeViewNode(); tvn.ID = "0"; tvn.Value = "0"; tvn.Text = PrjPub.GetRailNameBao(); tvn.ToolTip = PrjPub.GetRailNameBao(); tvOrganization.Nodes.Add(tvn); foreach (RailExam.Model.Organization organization in organizationList) { tvn = new TreeViewNode(); tvn.ID = organization.OrganizationId.ToString(); tvn.Value = organization.OrganizationId.ToString(); tvn.Text = organization.ShortName; tvn.ToolTip = organization.FullName; if (organization.LevelNum == 2) { tvn.Expanded = true; } try { if (organization.LevelNum == 2) { tvOrganization.FindNodeById("0").Nodes.Add(tvn); } else { tvOrganization.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn); } } catch { tvOrganization.Nodes.Clear(); SessionSet.PageMessage = "数据错误!"; return; } } } } tvOrganization.DataBind(); if (tvOrganization.Nodes.Count > 0) { tvOrganization.Nodes[0].Expanded = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //if (PrjPub.IsWuhan()) //{ // gradesGrid.Levels[0].Columns[3].HeadingText = "员工编码"; // lblWorkNo.Text = "上岗证号"; //} //else //{ // gradesGrid.Levels[0].Columns[3].HeadingText = "工资编号"; // lblWorkNo.Text = "工资编号"; //} hfRoleID.Value = PrjPub.CurrentLoginUser.RoleID.ToString(); if (PrjPub.HasEditRight("成绩查询")) { HfUpdateRight.Value = "True"; } else { HfUpdateRight.Value = "False"; } if (!PrjPub.IsServerCenter) { btnExam.Visible = false; } lblWorkNo.Text = "上岗证号"; hfOrganizationId.Value = ConfigurationManager.AppSettings["StationID"].ToString(); string qsExamId = Request.QueryString.Get("eid"); int orgID = Convert.ToInt32(Request.QueryString.Get("OrgID")); string OrganizationName = ""; string strExamineeName = ""; decimal dScoreLower = 0; decimal dScoreUpper = 1000; IList <RandomExamResult> examResults = null; RandomExamResultBLL bllExamResult = new RandomExamResultBLL(); string strSql = ""; OracleAccess db = new OracleAccess(); //examResults = bllExamResult.GetRandomExamResults(Convert.ToInt32(qsExamId), OrganizationName,string.Empty, // strExamineeName, string.Empty, dScoreLower, // dScoreUpper, Convert.ToInt32(orgID)); RandomExamBLL objBll = new RandomExamBLL(); RailExam.Model.RandomExam objExam = objBll.GetExam(Convert.ToInt32(qsExamId)); RandomExamArrangeBLL objArrangebll = new RandomExamArrangeBLL(); IList <RandomExamArrange> objArrangeList = objArrangebll.GetRandomExamArranges(Convert.ToInt32(qsExamId)); string strChooseID = string.Empty; if (objArrangeList.Count > 0) { if (PrjPub.IsServerCenter && orgID == objExam.OrgId) { strChooseID = objArrangeList[0].UserIds; int count = 0; EmployeeBLL objEmployeeBll = new EmployeeBLL(); string[] str = strChooseID.Split(','); for (int i = 0; i < str.Length; i++) { if (str[i] == string.Empty) { continue; } Employee employee = objEmployeeBll.GetChooseEmployeeInfo(str[i]); if (employee.EmployeeID == 0) { continue; } count++; } lblMaxCount.Text = count.ToString(); } else if (PrjPub.IsServerCenter && orgID != objExam.OrgId) { string[] strEmployee = objArrangeList[0].UserIds.Split(','); OrganizationBLL orgBll = new OrganizationBLL(); EmployeeBLL employeeBll = new EmployeeBLL(); int count = 0; for (int i = 0; i < strEmployee.Length; i++) { Employee employee = employeeBll.GetChooseEmployeeInfo(strEmployee[i]); int stationOrgID = orgBll.GetStationOrgID(employee.OrgID); if (stationOrgID == orgID) { count++; } } lblMaxCount.Text = count.ToString(); } else { strSql = "select a.* from Random_Exam_Arrange_Detail a " + " inner join Computer_Room b on a.Computer_Room_ID=b.Computer_Room_ID " + " inner join Computer_Server c on b.Computer_Server_ID=c.Computer_Server_ID " + " where c.Computer_Server_No='" + PrjPub.ServerNo + "'" + " and a.Random_Exam_ID=" + qsExamId; DataSet dsArrange = db.RunSqlDataSet(strSql); foreach (DataRow dr in dsArrange.Tables[0].Rows) { if (strChooseID == string.Empty) { strChooseID = dr["User_Ids"].ToString(); } else { strChooseID += "," + dr["User_Ids"].ToString(); } } int count = 0; EmployeeBLL objEmployeeBll = new EmployeeBLL(); string[] str = strChooseID.Split(','); for (int i = 0; i < str.Length; i++) { if (str[i] == string.Empty) { continue; } Employee employee = objEmployeeBll.GetChooseEmployeeInfo(str[i]); if (employee.EmployeeID == 0) { continue; } count++; } lblMaxCount.Text = count.ToString(); } } DataSet ds = GetDataSet(true); if (ds != null && ds.Tables.Count == 2) { //foreach (DataRow dr in ds.Tables[0].Rows) //{ // if(dr["OrganizationId"].ToString() != hfOrganizationId.Value) // { // btnOutPutWord.Enabled = false; // break; // } //} gradesGrid.DataSource = ds; gradesGrid.DataBind(); BindGrid(); } else { SessionSet.PageMessage = "数据错误!"; return; } hfIsServer.Value = PrjPub.IsServerCenter.ToString(); //当是路局服务器时,屏蔽上传按钮 if (PrjPub.IsServerCenter) { btnUpload.Visible = false; } } else { if (Request.Form.Get("OutPut") != null && Request.Form.Get("OutPut") != "") { OutputWord(Request.Form.Get("OutPut")); } if (Request.Form.Get("Refresh") != null && Request.Form.Get("Refresh") != "") { DownloadAll(Request.Form.Get("Refresh")); } if (Request.Form.Get("RefreshExcel") != null && Request.Form.Get("RefreshExcel") != "") { DownloadExcel(); } if (Request.Form.Get("IsUpload") != null && Request.Form.Get("IsUpload") != "") { DataSet ds = GetDataSet(false); gradesGrid.DataSource = ds; gradesGrid.DataBind(); BindGrid(); //string strId = Request.QueryString.Get("eid"); //RandomExamBLL objBll = new RandomExamBLL(); //RailExam.Model.RandomExam obj = objBll.GetExam(Convert.ToInt32(strId)); //SystemLogBLL objLogBll = new SystemLogBLL(); //objLogBll.WriteLog("“" + obj.ExamName + "”上传考试成绩和答卷"); SessionSet.PageMessage = "上传成功!"; } if (Request.Form.Get("RefreshList") != null && Request.Form.Get("RefreshList") != "") { DataSet ds = GetDataSet(false); gradesGrid.DataSource = ds; gradesGrid.DataBind(); BindGrid(); } } btnUpload.Visible = false; // 包神这里用不著上传 2014-03-18 }
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(); } }
protected void btnSaveAdd_Click(object sender, EventArgs e) { EmployeeBLL objBll = new EmployeeBLL(); OrganizationBLL organizationBLL = new OrganizationBLL(); int orgID = organizationBLL.GetStationOrgID(Convert.ToInt32(hfOrgID.Value)); IList <RailExam.Model.Employee> objView = new List <Employee>(); if (hfType.Value != "Edit") { objView = objBll.GetEmployeeByWhereClause("GetStationOrgID(a.Org_ID)=" + orgID + " and Work_No='" + txtWorkNoEdit.Text.Trim() + "'"); if (objView.Count > 0) { SessionSet.PageMessage = "该工资编号在当前单位已经存在!"; return; } if (txtHomePhone.Text.Trim() != string.Empty) { objView = objBll.GetEmployeeByWhereClause("Home_Phone='" + txtHomePhone.Text.Trim() + "'"); if (objView.Count > 0) { SessionSet.PageMessage = "该员工编码在系统中已经存在!"; return; } } } else { if (ViewState["OldWorkNo"].ToString() != txtWorkNoEdit.Text.Trim()) { objView = objBll.GetEmployeeByWhereClause("GetStationOrgID(a.Org_ID)=" + orgID + " and Work_No='" + txtWorkNoEdit.Text.Trim() + "'"); if (objView.Count > 0) { SessionSet.PageMessage = "该工资编号在当前单位已经存在!"; return; } } if (txtHomePhone.Text.Trim() != string.Empty) { objView = objBll.GetEmployeeByWhereClause("a.Employee_ID!=" + Request.QueryString.Get("id") + " and Home_Phone='" + txtHomePhone.Text.Trim() + "'"); if (objView.Count > 0) { SessionSet.PageMessage = "该员工编码在系统中已经存在!"; return; } } } SaveEmployeeInfo(); if (hfType.Value != "Edit") { Response.Write("<script>window.opener.frames['ifEmployeeInfo'].form1.Refresh.value='true';window.opener.frames['ifEmployeeInfo'].form1.submit();</script>"); } else { Response.Write("<script>window.opener.form1.Refresh.value='true';window.opener.form1.submit();</script>"); } RailExam.Model.EmployeeDetail obj = new RailExam.Model.EmployeeDetail(); GetEmployeeInfo(obj); ddlRoleNameEdit.SelectedValue = "0"; if (hfType.Value == "Insert") { if (txtPostNameEdit.Text == string.Empty) { PostBLL objPostBll = new PostBLL(); txtPostNameEdit.Text = objPostBll.GetPost(Convert.ToInt32(hfPostID.Value)).PostName; } if (txtOrgNameEdit.Text == string.Empty) { OrganizationBLL objOrgBll = new OrganizationBLL(); txtOrgNameEdit.Text = objOrgBll.GetOrganization(Convert.ToInt32(hfOrgID.Value)).ShortName; } } dateBirthday.DateValue = DateTime.Today.ToString("yyyy-MM-dd"); dateBeginDate.DateValue = DateTime.Today.ToString("yyyy-MM-dd"); hfType.Value = "Insert"; }
private IList <Employee> BindGrid() { string RandomExamID = Request.QueryString.Get("eid"); string OrgID = Request.QueryString.Get("OrgID"); string OrganizationName = ""; string strExamineeName = ""; decimal dScoreLower = -1000; decimal dScoreUpper = 1000; IList <RandomExamResult> examResults = null; RandomExamResultBLL bllExamResult = new RandomExamResultBLL(); examResults = bllExamResult.GetRandomExamResults(Convert.ToInt32(RandomExamID), OrganizationName, string.Empty, strExamineeName, string.Empty, dScoreLower, dScoreUpper, Convert.ToInt32(OrgID)); string strID = string.Empty; foreach (RandomExamResult result in examResults) { if (strID == string.Empty) { strID = result.ExamineeId.ToString(); } else { strID = strID + "," + result.ExamineeId; } } RandomExamBLL objBll = new RandomExamBLL(); RailExam.Model.RandomExam objExam = objBll.GetExam(Convert.ToInt32(RandomExamID)); RandomExamArrangeBLL objArrangebll = new RandomExamArrangeBLL(); IList <RandomExamArrange> objArrangeList = objArrangebll.GetRandomExamArranges(Convert.ToInt32(RandomExamID)); string strChooseID = string.Empty; if (objArrangeList.Count > 0) { if (PrjPub.IsServerCenter && Convert.ToInt32(OrgID) == objExam.OrgId) { strChooseID = objArrangeList[0].UserIds; } else if (PrjPub.IsServerCenter && Convert.ToInt32(OrgID) != objExam.OrgId) { string[] strEmployee = objArrangeList[0].UserIds.Split(','); OrganizationBLL orgBll = new OrganizationBLL(); EmployeeBLL employeeBll = new EmployeeBLL(); int count = 0; for (int i = 0; i < strEmployee.Length; i++) { Employee employee = employeeBll.GetChooseEmployeeInfo(strEmployee[i]); int stationOrgID = orgBll.GetStationOrgID(employee.OrgID); if (stationOrgID == Convert.ToInt32(OrgID)) { if (strChooseID == string.Empty) { strChooseID = strEmployee[i]; } else { strChooseID += "," + strEmployee[i]; } } } } else { string strSql = "select a.* from Random_Exam_Arrange_Detail a " + " inner join Computer_Room b on a.Computer_Room_ID=b.Computer_Room_ID " + " inner join Computer_Server c on b.Computer_Server_ID=c.Computer_Server_ID " + " where c.Computer_Server_No='" + PrjPub.ServerNo + "'" + " and a.Random_Exam_ID=" + RandomExamID; OracleAccess db = new OracleAccess(); DataSet dsArrange = db.RunSqlDataSet(strSql); foreach (DataRow dr in dsArrange.Tables[0].Rows) { if (strChooseID == string.Empty) { strChooseID = dr["User_Ids"].ToString(); } else { strChooseID += "," + dr["User_Ids"].ToString(); } } } } string[] str = strChooseID.Split(','); string strNoResult = ""; for (int i = 0; i < str.Length; i++) { if (str[i] == string.Empty) { continue; } if (("," + strID + ",").IndexOf(("," + str[i] + ",")) < 0) { if (strNoResult == string.Empty) { strNoResult = str[i]; } else { strNoResult = strNoResult + "," + str[i]; } } } EmployeeBLL objbll = new EmployeeBLL(); IList <Employee> objList = new List <Employee>(); if (strNoResult != string.Empty) { string[] strNo = strNoResult.Split(','); for (int i = 0; i < strNo.Length; i++) { Employee employee = objbll.GetChooseEmployeeInfo(strNo[i]); if (employee.EmployeeID != 0) { objList.Add(employee); } } } Session["NoExamInfo"] = objList; return(objList); }
private void ExportArrange() { // 根据 ProgressBar.htm 显示进度条界面 string templateFileName = Path.Combine(Server.MapPath("."), "ProgressBar.htm"); StreamReader reader = new StreamReader(@templateFileName, System.Text.Encoding.GetEncoding("gb2312")); string html = reader.ReadToEnd(); reader.Close(); Response.Write(html); Response.Flush(); System.Threading.Thread.Sleep(200); string strExamId = Request.QueryString.Get("id"); RandomExamArrangeBLL eaBll = new RandomExamArrangeBLL(); IList <RailExam.Model.RandomExamArrange> ExamArranges = eaBll.GetRandomExamArranges(int.Parse(strExamId)); RandomExamBLL objBll = new RandomExamBLL(); RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(Request.QueryString.Get("id"))); EmployeeBLL psBLL = new EmployeeBLL(); DataSet ds = new DataSet(); string[] str = ExamArranges[0].UserIds.Split(','); IList <Employee> objList = new List <Employee>(); if (str[0] != "") { OracleAccess db = new OracleAccess(); string strSql; OrganizationBLL orgBll = new OrganizationBLL(); for (int i = 0; i < str.Length; i++) { Employee obj = psBLL.GetChooseEmployeeInfo(str[i]); obj.RowNum = i + 1; if (PrjPub.CurrentLoginUser.RoleID != 1) { if (orgBll.GetStationOrgID(obj.OrgID) == PrjPub.CurrentLoginUser.StationOrgID) { objList.Add(obj); } } else { objList.Add(obj); } } if (objList.Count > 0) { ds.Tables.Add(ConvertToDataTable((IList)objList)); if (ViewState["Sort"] != null) { ds.Tables[0].DefaultView.Sort = ViewState["Sort"].ToString(); } DataColumn dc = ds.Tables[0].Columns.Add("ComputeRoom"); strSql = "select a.*,c.Short_Name||'-'||b.Computer_Room_Name as ComputeRoom " + " from Random_Exam_Arrange_Detail a " + " inner join Computer_Room b on a.Computer_Room_ID=b.Computer_Room_ID" + " inner join Org c on b.Org_ID=c.Org_ID" + " where Random_Exam_ID='" + strExamId + "'"; DataSet dsDetail = db.RunSqlDataSet(strSql); foreach (DataRow dr in ds.Tables[0].Rows) { string strUser = "******" + dr["EmployeeID"] + ","; DataRow[] drs = dsDetail.Tables[0].Select("','+User_Ids+',' like '%" + strUser + "%'"); if (drs.Length > 0) { dr["ComputeRoom"] = drs[0]["ComputeRoom"].ToString(); } else { dr["ComputeRoom"] = string.Empty; } } } System.Threading.Thread.Sleep(10); string jsBlock = "<script>SetPorgressBar('导出考生信息','" + ((1 * 100) / ((double)(ds.Tables[0].Rows.Count + 1))).ToString("0.00") + "'); </script>"; Response.Write(jsBlock); Response.Flush(); #region OWC11 /* * SpreadsheetClass xlsheet = new SpreadsheetClass(); * Worksheet ws = (Worksheet)xlsheet.Worksheets[1]; * ws.Cells.Font.set_Size(10); * ws.Cells.Font.set_Name("宋体"); * * ws.Cells[1, 1] = objRandomExam.ExamName + " 参加考试学员名单"; * Range range = ws.get_Range(ws.Cells[1, 1], ws.Cells[1, 7]); * range.set_MergeCells(true); * range.set_HorizontalAlignment(XlHAlign.xlHAlignCenter); * range.Font.set_Name("宋体"); * * * //write headertext * ws.Cells[2, 1] = "序号"; * ((Range)ws.Cells[2, 1]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter); * * * ws.Cells[2, 2] = "姓名"; * ws.get_Range(ws.Cells[2, 2], ws.Cells[2, 2]).set_MergeCells(true); * ws.get_Range(ws.Cells[2, 2], ws.Cells[2, 2]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter); * * if (PrjPub.IsWuhan()) * { * ws.Cells[2, 3] = "员工编码"; * } * else * { * ws.Cells[2, 3] = "工资编号"; * } * ws.get_Range(ws.Cells[2, 3], ws.Cells[2, 3]).set_MergeCells(true); * ws.get_Range(ws.Cells[2, 3], ws.Cells[2, 3]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter); * * ws.Cells[2, 4] = "职名"; * ws.get_Range(ws.Cells[2, 4], ws.Cells[2, 4]).set_MergeCells(true); * ws.get_Range(ws.Cells[2, 4], ws.Cells[2, 4]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter); * * ws.Cells[2, 5] = "组织机构"; * ws.get_Range(ws.Cells[2, 5], ws.Cells[2, 7]).set_MergeCells(true); * ws.get_Range(ws.Cells[2, 5], ws.Cells[2, 7]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter); * * ws.Cells[2, 8] = "考试地点"; * ws.get_Range(ws.Cells[2, 8], ws.Cells[2, 10]).set_MergeCells(true); * ws.get_Range(ws.Cells[2, 8], ws.Cells[2, 10]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter); * * int j = 0; * foreach(DataRow dr in ds.Tables[0].Rows) * { * ws.Cells[3 + j, 1] = j + 1; * * ws.Cells[3 + j, 2] = dr["EmployeeName"].ToString(); * ws.get_Range(ws.Cells[3 + j, 2], ws.Cells[3 + j, 2]).set_MergeCells(true); * ws.get_Range(ws.Cells[3 + j, 2], ws.Cells[3 + j, 2]).set_HorizontalAlignment(XlHAlign.xlHAlignLeft); * * ws.Cells[3 + j, 3] = "'" + dr["StrWorkNo"].ToString(); * ws.get_Range(ws.Cells[3 + j, 3], ws.Cells[3 + j, 3]).set_MergeCells(true); * ws.get_Range(ws.Cells[3 + j, 3], ws.Cells[3 + j, 3]).set_HorizontalAlignment(XlHAlign.xlHAlignLeft); * * * ws.Cells[3 + j, 4] = dr["PostName"].ToString(); * ws.get_Range(ws.Cells[3 + j, 4], ws.Cells[3 + j, 4]).set_MergeCells(true); * ws.get_Range(ws.Cells[3 + j, 4], ws.Cells[3 + j, 4]).set_HorizontalAlignment(XlHAlign.xlHAlignLeft); * * ws.Cells[3 + j, 5] = dr["OrgName"].ToString(); * ws.get_Range(ws.Cells[3 + j, 5], ws.Cells[3 + j, 7]).set_MergeCells(true); * ws.get_Range(ws.Cells[3 + j, 5], ws.Cells[3 + j, 7]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter); * * ws.Cells[3 + j, 8] = dr["ComputeRoom"].ToString(); * ws.get_Range(ws.Cells[3 + j, 8], ws.Cells[3 + j, 10]).set_MergeCells(true); * ws.get_Range(ws.Cells[3 + j, 8], ws.Cells[3 + j, 10]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter); * * j++; * * System.Threading.Thread.Sleep(10); * jsBlock = "<script>SetPorgressBar('导出考生信息','" + (((j + 1) * 100) / ((double)(ds.Tables[0].Rows.Count + 1))).ToString("0.00") + "'); </script>"; * Response.Write(jsBlock); * Response.Flush(); * } * * ws.Name = "1-1"; * ws.Cells.Columns.AutoFit(); * * * ((Worksheet)xlsheet.Worksheets[1]).Activate(); * * string path = Server.MapPath("../Excel/Excel.xls"); * if (File.Exists(path)) * File.Delete(path); * xlsheet.Export(path, SheetExportActionEnum.ssExportActionNone, SheetExportFormat.ssExportAsAppropriate); */ #endregion Excel.Application objApp = new Excel.ApplicationClass(); Excel.Workbooks objbooks = objApp.Workbooks; Excel.Workbook objbook = objbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet); Excel.Worksheet objSheet = (Excel.Worksheet)objbook.Worksheets[1]; //取得sheet1 Excel.Range rang1; string filename = ""; try { //生成.xls文件完整路径名 filename = Server.MapPath("/RailExamBao/Excel/Excel.xls"); if (File.Exists(filename.ToString())) { File.Delete(filename.ToString()); } objSheet.Cells.Font.Size = 10; objSheet.Cells.Font.Name = "宋体"; objSheet.Cells[1, 1] = objRandomExam.ExamName + " 参加考试学员名单"; rang1 = objSheet.get_Range(objSheet.Cells[1, 1], objSheet.Cells[1, 6]); rang1.Merge(0); rang1.HorizontalAlignment = XlHAlign.xlHAlignCenter; rang1.Font.Bold = true; objSheet.Cells.Font.Size = 17; objSheet.Cells.Font.Name = "宋体"; objSheet.Cells.Font.Size = 12; objSheet.Cells.Font.Name = "宋体"; //write headertext objSheet.Cells[2, 1] = "序号"; ((Excel.Range)objSheet.Cells[2, 1]).HorizontalAlignment = XlHAlign.xlHAlignCenter; objSheet.Cells[2, 2] = "姓名"; objSheet.get_Range(objSheet.Cells[2, 2], objSheet.Cells[2, 2]).Merge(0); objSheet.get_Range(objSheet.Cells[2, 2], objSheet.Cells[2, 2]).HorizontalAlignment = XlHAlign.xlHAlignCenter; objSheet.Cells[2, 3] = "员工编码"; objSheet.get_Range(objSheet.Cells[2, 3], objSheet.Cells[2, 3]).Merge(0); objSheet.get_Range(objSheet.Cells[2, 3], objSheet.Cells[2, 3]).HorizontalAlignment = XlHAlign.xlHAlignCenter; objSheet.Cells[2, 4] = "职名"; objSheet.get_Range(objSheet.Cells[2, 4], objSheet.Cells[2, 4]).Merge(0); objSheet.get_Range(objSheet.Cells[2, 4], objSheet.Cells[2, 4]).HorizontalAlignment = XlHAlign.xlHAlignCenter; objSheet.Cells[2, 5] = "组织机构(车间)"; objSheet.get_Range(objSheet.Cells[2, 5], objSheet.Cells[2, 5]).Merge(0); objSheet.get_Range(objSheet.Cells[2, 5], objSheet.Cells[2, 5]).HorizontalAlignment = XlHAlign.xlHAlignCenter; objSheet.Cells[2, 6] = "考试地点"; objSheet.get_Range(objSheet.Cells[2, 6], objSheet.Cells[2, 6]).Merge(0); objSheet.get_Range(objSheet.Cells[2, 6], objSheet.Cells[2, 6]).HorizontalAlignment = XlHAlign.xlHAlignCenter; int j = 0; foreach (DataRow dr in ds.Tables[0].Rows) { objSheet.Cells[3 + j, 1] = j + 1; objSheet.Cells[3 + j, 2] = dr["EmployeeName"].ToString(); objSheet.get_Range(objSheet.Cells[6 + j, 2], objSheet.Cells[6 + j, 2]).Merge(0); objSheet.get_Range(objSheet.Cells[6 + j, 2], objSheet.Cells[6 + j, 2]).HorizontalAlignment = XlHAlign.xlHAlignLeft; objSheet.Cells[3 + j, 3] = "'" + dr["StrWorkNo"].ToString(); objSheet.get_Range(objSheet.Cells[3 + j, 3], objSheet.Cells[3 + j, 3]).Merge(0); objSheet.get_Range(objSheet.Cells[3 + j, 3], objSheet.Cells[3 + j, 3]).HorizontalAlignment = XlHAlign.xlHAlignLeft; objSheet.Cells[3 + j, 4] = dr["PostName"].ToString(); objSheet.get_Range(objSheet.Cells[3 + j, 4], objSheet.Cells[3 + j, 4]).Merge(0); objSheet.get_Range(objSheet.Cells[3 + j, 4], objSheet.Cells[3 + j, 4]).HorizontalAlignment = XlHAlign.xlHAlignLeft; objSheet.Cells[3 + j, 5] = dr["OrgName"].ToString(); objSheet.get_Range(objSheet.Cells[3 + j, 5], objSheet.Cells[3 + j, 5]).Merge(0); objSheet.get_Range(objSheet.Cells[3 + j, 5], objSheet.Cells[3 + j, 5]).HorizontalAlignment = XlHAlign.xlHAlignLeft; objSheet.Cells[3 + j, 6] = dr["ComputeRoom"].ToString(); objSheet.get_Range(objSheet.Cells[3 + j, 6], objSheet.Cells[3 + j, 6]).Merge(0); objSheet.get_Range(objSheet.Cells[3 + j, 6], objSheet.Cells[3 + j, 6]).HorizontalAlignment = XlHAlign.xlHAlignLeft; j++; System.Threading.Thread.Sleep(10); jsBlock = "<script>SetPorgressBar('导出考生信息','" + (((j + 1) * 100) / ((double)(ds.Tables[0].Rows.Count + 1))).ToString("0.00") + "'); </script>"; Response.Write(jsBlock); Response.Flush(); } objSheet.Cells.Columns.AutoFit(); objApp.Visible = false; objbook.Saved = true; objbook.SaveCopyAs(filename); } catch (Exception ex) { throw ex; } finally { objbook.Close(Type.Missing, filename, Type.Missing); objbooks.Close(); objApp.Application.Workbooks.Close(); objApp.Application.Quit(); objApp.Quit(); GC.Collect(); } } Response.Write("<script>top.returnValue='true';window.close();</script>"); }
private void BindOrganizationTree() { OrganizationBLL organizationBLL = new OrganizationBLL(); if (PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.SuitRange == 1) { IList <RailExam.Model.Organization> organizationList = organizationBLL.GetOrganizations(); Pub.BuildComponentArtTreeView(tvView, (IList)organizationList, "OrganizationId", "ParentId", "ShortName", "FullName", "IdPath", null, null, null); } else { string strOrgID; if (PrjPub.IsServerCenter) { strOrgID = PrjPub.CurrentLoginUser.StationOrgID.ToString(); } else { strOrgID = ConfigurationManager.AppSettings["StationID"].ToString(); } int stationID = organizationBLL.GetStationOrgID(Convert.ToInt32(strOrgID)); IList <RailExam.Model.Organization> organizationList = organizationBLL.GetOrganizations(stationID); if (organizationList.Count > 0) { TreeViewNode tvn = null; foreach (RailExam.Model.Organization organization in organizationList) { tvn = new TreeViewNode(); tvn.ID = organization.OrganizationId.ToString(); tvn.Value = organization.IdPath.ToString(); tvn.Text = organization.ShortName; tvn.ToolTip = organization.FullName; if (organization.ParentId == 1) { tvView.Nodes.Add(tvn); } else { try { tvView.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn); } catch { tvView.Nodes.Clear(); SessionSet.PageMessage = "数据错误!"; return; } } } } tvView.DataBind(); } if (tvView.Nodes.Count > 0) { tvView.Nodes[0].Expanded = true; } }
protected void btnOk_Click(object sender, EventArgs e) { OracleAccess db = new OracleAccess(); string strSql = "select * from Employee where Employee_ID=" + ViewState["EmployeeID"]; DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0]; int orgID; if (ddlWorkgroup.SelectedValue != "0") { orgID = Convert.ToInt32(ddlWorkgroup.SelectedValue); } else { orgID = Convert.ToInt32(ddlWorkshop.SelectedValue); } OrganizationBLL organizationBLL = new OrganizationBLL(); EmployeeBLL objEmployeeBll = new EmployeeBLL(); IList <RailExam.Model.Employee> objView = objEmployeeBll.GetEmployeeByWhereClause("GetStationOrgID(a.Org_ID)=" + organizationBLL.GetStationOrgID(orgID) + " and Work_No='" + txtWorkNo.Text.Trim() + "'"); if (objView.Count > 0) { SessionSet.PageMessage = "该员工编码在本单位已经存在!"; return; } strSql = "update Employee " + " set Employee_Name='" + txtName.Text + "'," + "Org_ID=" + orgID + "," + "Work_No='" + txtWorkNo.Text + "'," + "identity_CardNo='" + txtPostNo.Text + "'," + "PinYin_Code='" + Pub.GetChineseSpell(txtName.Text) + "' " + " where Employee_ID=" + ViewState["EmployeeID"]; db.ExecuteNonQuery(strSql); strSql = "insert into ZJ_Employee_Work " + " values(Employee_Work_Seq.nextval, " + dr["EMPLOYEE_ID"] + ", to_char(sysdate,'yyyy-mm-dd')," + dr["org_id"] + "," + orgID + "," + dr["Post_ID"] + "," + dr["Post_ID"] + "," + "'',sysdate,'" + PrjPub.CurrentLoginUser.EmployeeName + "'," + "to_date('" + dr["Post_Date"] + "','YYYY-MM-DD HH24:MI:SS'))"; db.ExecuteNonQuery(strSql); string transferID = Request.QueryString.Get("transferID"); EmployeeTransferBLL objTransferBll = new EmployeeTransferBLL(); objTransferBll.DeleteEmployeeTransfer(Convert.ToInt32(transferID)); SystemLogBLL objLogBll = new SystemLogBLL(); objLogBll.WriteLog("将" + dr["Employee_Name"] + "调至" + lblOrg.Text); Response.Write("<script>window.returnValue='true';window.close();</script>"); }
private void BindItemCategoryTree() { OrganizationBLL organizationsBLL = new OrganizationBLL(); int railSystemID = 0; string strOwnIDs = string.Empty; if (PrjPub.CurrentLoginUser != null || PrjPub.CurrentStudent != null) { railSystemID = PrjPub.GetRailSystemId(); if (railSystemID != 0) { IList <RailExam.Model.Organization> organizationList1 = organizationsBLL.GetOrganizations(PrjPub.CurrentLoginUser.StationOrgID); foreach (RailExam.Model.Organization organization in organizationList1) { strOwnIDs += strOwnIDs == string.Empty ? organization.OrganizationId.ToString() : "," + organization.OrganizationId; } } } if (Request.QueryString.Get("Type") == "Station") { IList <RailExam.Model.Organization> organizations = organizationsBLL.GetOrganizationsByLevel(2); foreach (RailExam.Model.Organization organization in organizations) { if (!organization.IsEffect) { continue; } if (organization.LevelNum == 1) { continue; } if ((organization.IdPath + "/").IndexOf("/1/") >= 0 && organization.LevelNum != 1 && railSystemID != 0 && railSystemID != organization.RailSystemID) { continue; } if (organization.LevelNum != 1 && strOwnIDs != string.Empty && (organization.IdPath + "/").IndexOf("/1/") < 0 && ("," + strOwnIDs + ",").IndexOf("," + organization.OrganizationId + ",") < 0) { continue; } TreeViewNode tvNode = new TreeViewNode(); tvNode.ID = organization.OrganizationId.ToString(); tvNode.Text = organization.ShortName; tvOrganization.Nodes.Add(tvNode); } } else if (Request.QueryString.Get("Type") == "Online") { IList <RailExam.Model.Organization> organizations = organizationsBLL.GetOrganizations(); IList <RailExam.Model.Organization> organizationList = new List <Organization>(); foreach (Organization organization in organizations) { if (!organization.IsEffect) { continue; } organizationList.Add(organization); } Pub.BuildComponentArtTreeView(tvOrganization, (IList)organizationList, "OrganizationId", "ParentId", "ShortName", "FullName", "OrganizationId", null, null, null); } else { if (PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.SuitRange == 1) { IList <RailExam.Model.Organization> organizations = organizationsBLL.GetOrganizations(); foreach (RailExam.Model.Organization organization in organizations) { if (!organization.IsEffect) { continue; } if (organization.LevelNum != 1) { if ((organization.IdPath + "/").IndexOf("/1/") >= 0 && railSystemID != 0 && railSystemID != organization.RailSystemID) { continue; } if (strOwnIDs != string.Empty && (organization.IdPath + "/").IndexOf("/1/") < 0 && ("," + strOwnIDs + ",").IndexOf("," + organization.OrganizationId + ",") < 0) { continue; } } TreeViewNode tvn = new TreeViewNode(); tvn.ID = organization.OrganizationId.ToString(); tvn.Value = organization.OrganizationId.ToString(); tvn.Text = organization.ShortName; tvn.ToolTip = organization.FullName; if (organization.ParentId == 0) { tvn.Expanded = true; tvOrganization.Nodes.Add(tvn); continue; } try { tvOrganization.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn); } catch { tvOrganization.Nodes.Clear(); SessionSet.PageMessage = "数据错误!"; return; } } } else { string strOrgID; if (PrjPub.IsServerCenter) { if (!string.IsNullOrEmpty(Request.QueryString.Get("OrgID"))) { strOrgID = Request.QueryString.Get("OrgID"); } else { strOrgID = PrjPub.CurrentLoginUser.StationOrgID.ToString(); } } else { strOrgID = ConfigurationManager.AppSettings["StationID"].ToString(); } int stationID = organizationsBLL.GetStationOrgID(Convert.ToInt32(strOrgID)); IList <RailExam.Model.Organization> organizationList = organizationsBLL.GetOrganizations(stationID); if (organizationList.Count > 0) { TreeViewNode tvn = null; foreach (RailExam.Model.Organization organization in organizationList) { if (!organization.IsEffect) { continue; } tvn = new TreeViewNode(); tvn.ID = organization.OrganizationId.ToString(); tvn.Value = organization.IdPath.ToString(); tvn.Text = organization.ShortName; tvn.ToolTip = organization.FullName; if (organization.ParentId == 1) { tvOrganization.Nodes.Add(tvn); } else { try { tvOrganization.FindNodeById(organization.ParentId.ToString()).Nodes.Add(tvn); } catch { tvOrganization.Nodes.Clear(); SessionSet.PageMessage = "数据错误!"; return; } } } } tvOrganization.DataBind(); } if (tvOrganization.Nodes.Count > 0) { tvOrganization.Nodes[0].Expanded = true; } } if (tvOrganization.Nodes.Count > 0) { tvOrganization.Nodes[0].Expanded = true; } }
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>(); 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); } } string strPostID = Request.QueryString.Get("id2"); if (!string.IsNullOrEmpty(strPostID)) { if (strPostID != "0") { int nPostID = int.Parse(strPostID); books = bookBLL.GetBookByPostID(nPostID, txtBookName.Text, txtKeyWords.Text, txtAuthors.Text, orgID); } else { books = bookBLL.GetBookByPostID(0, txtBookName.Text, txtKeyWords.Text, txtAuthors.Text, orgID); } } 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(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (PrjPub.CurrentLoginUser == null) { Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!"); return; } 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 { string strDeleteID = Request.Form.Get("DeleteID"); if (!string.IsNullOrEmpty(strDeleteID)) { DeleteData(int.Parse(strDeleteID)); BindGrid(); } if (Request.Form.Get("Refresh") == "true") { BindGrid(); } } string strUpID = Request.Form.Get("UpID"); if (strUpID != null && strUpID != "") { if (Request.QueryString.Get("type") == "Courseware") { CoursewareBLL objBll = new CoursewareBLL(); RailExam.Model.Courseware obj = objBll.GetCourseware(Convert.ToInt32(strUpID)); obj.OrderIndex = obj.OrderIndex - 1; objBll.UpdateCourseware(obj); } if (Request.QueryString.Get("type") == "TrainType") { int trainTypeID = Convert.ToInt32(Request.QueryString.Get("id")); CoursewareTrainTypeBLL objTrainTypeBll = new CoursewareTrainTypeBLL(); CoursewareTrainType objTrainType = objTrainTypeBll.GetCoursewareTrainType(Convert.ToInt32(strUpID), trainTypeID); objTrainType.OrderIndex = objTrainType.OrderIndex - 1; objTrainTypeBll.UpdateCoursewareTrainType(objTrainType); } BindGrid(); } string strDownID = Request.Form.Get("DownID"); if (strDownID != null && strDownID != "") { if (Request.QueryString.Get("type") == "Courseware") { CoursewareBLL objBll = new CoursewareBLL(); RailExam.Model.Courseware obj = objBll.GetCourseware(Convert.ToInt32(strDownID)); obj.OrderIndex = obj.OrderIndex + 1; objBll.UpdateCourseware(obj); } if (Request.QueryString.Get("type") == "TrainType") { int trainTypeID = Convert.ToInt32(Request.QueryString.Get("id")); CoursewareTrainTypeBLL objTrainTypeBll = new CoursewareTrainTypeBLL(); CoursewareTrainType objTrainType = objTrainTypeBll.GetCoursewareTrainType(Convert.ToInt32(strDownID), trainTypeID); objTrainType.OrderIndex = objTrainType.OrderIndex + 1; objTrainTypeBll.UpdateCoursewareTrainType(objTrainType); } BindGrid(); } }
protected void btnSave_Click(object sender, EventArgs e) { EmployeeBLL objBll = new EmployeeBLL(); OrganizationBLL organizationBLL = new OrganizationBLL(); int orgID = organizationBLL.GetStationOrgID(Convert.ToInt32(hfOrgID.Value)); IList <RailExam.Model.Employee> objView = new List <Employee>(); if (hfType.Value != "Edit") { objView = objBll.GetEmployeeByWhereClause("GetStationOrgID(a.Org_ID)=" + orgID + " and Work_No='" + txtWorkNoEdit.Text.Trim() + "'"); if (objView.Count > 0) { SessionSet.PageMessage = "该工资编号在当前单位已经存在!"; return; } if (txtHomePhone.Text.Trim() != string.Empty) { objView = objBll.GetEmployeeByWhereClause("Home_Phone='" + txtHomePhone.Text.Trim() + "'"); if (objView.Count > 0) { SessionSet.PageMessage = "该员工编码在系统中已经存在!"; return; } } } else { if (ViewState["OldWorkNo"].ToString() != txtWorkNoEdit.Text.Trim()) { objView = objBll.GetEmployeeByWhereClause("GetStationOrgID(a.Org_ID)=" + orgID + " and Work_No='" + txtWorkNoEdit.Text.Trim() + "'"); if (objView.Count > 0) { SessionSet.PageMessage = "该工资编号在当前单位已经存在!"; return; } } if (txtHomePhone.Text.Trim() != string.Empty) { objView = objBll.GetEmployeeByWhereClause("Employee_ID!=" + Request.QueryString.Get("id") + " and Home_Phone='" + txtHomePhone.Text.Trim() + "'"); if (objView.Count > 0) { SessionSet.PageMessage = "该员工编码在系统中已经存在!"; return; } } } SaveEmployeeInfo(); if (hfType.Value != "Edit") { Response.Write("<script>window.opener.frames['ifEmployeeInfo'].form1.Refresh.value='true';window.opener.frames['ifEmployeeInfo'].form1.submit();window.close();</script>"); } else { Response.Write("<script>window.opener.form1.Refresh.value='true';window.opener.form1.submit();window.close();</script>"); } }