private void LoadNotice() { NoticeStrategyBuilder noticeBuilder = new NoticeStrategyBuilder(); ArrayList arA = new ArrayList(); arA.Add("080104"); arA.Add(base.user.UserCode); arA.Add(user.BuildStationCodes()); //ArrayList arB = new ArrayList();//为状态赋值 //arB.Add("1"); noticeBuilder.AddStrategy(new Strategy(DAL.QueryStrategy.NoticeStrategyName.status, "1,2")); if (_IsOther) { noticeBuilder.AddStrategy(new Strategy(DAL.QueryStrategy.NoticeStrategyName.Type, "99")); } else { noticeBuilder.AddStrategy(new Strategy(DAL.QueryStrategy.NoticeStrategyName.Type, "1")); } noticeBuilder.AddStrategy(new Strategy(DAL.QueryStrategy.NoticeStrategyName.AccessRange, arA)); noticeBuilder.AddOrder("SubmitDate", false); string sql = noticeBuilder.BuildMainQueryString(); //sql += " and status='1'"; QueryAgent qa = new QueryAgent(); qa.SetTopNumber(this.intListNoticeNum); EntityData entityNotice = qa.FillEntityData("Notice", sql); qa.Dispose(); entityNotice.CurrentTable.Columns.Add("NoticeClassTitle"); //改动 for (int i = 0; i < entityNotice.CurrentTable.Rows.Count; i++) { //改动 if (entityNotice.CurrentTable.Rows[i]["NoticeClass"].ToString() != string.Empty) { entityNotice.CurrentTable.Rows[i]["NoticeClassTitle"] = entityNotice.CurrentTable.Rows[i]["NoticeClass"].ToString() + ":" + entityNotice.CurrentTable.Rows[i]["Title"].ToString(); } else { entityNotice.CurrentTable.Rows[i]["NoticeClassTitle"] = "" + entityNotice.CurrentTable.Rows[i]["Title"].ToString(); } //改动 string strTmp = entityNotice.CurrentTable.Rows[i]["NoticeClassTitle"].ToString(); if (strTmp.Length > 20) { entityNotice.CurrentTable.Rows[i]["NoticeClassTitle"] = strTmp.Substring(0, 20) + "...";//改动 } } rpNotice.DataSource = entityNotice; rpNotice.DataBind(); entityNotice.Dispose(); // 检查当前用户权限 this.hylNewNotice.Visible = (this.IsInRole("080101"))?true:false; }
private void LoadData() { string DocType = Request["DocType"].ToString() + ""; NoticeStrategyBuilder noticeBuilder = new NoticeStrategyBuilder(); noticeBuilder.AddStrategy(new Strategy(DAL.QueryStrategy.NoticeStrategyName.status, "1")); if (DocType != "") { noticeBuilder.AddStrategy(new Strategy(DAL.QueryStrategy.NoticeStrategyName.Type, DocType)); } if (!user.HasRight("080105")) //判断通知监控 { ArrayList arA = new ArrayList(); arA.Add("080104"); arA.Add(user.UserCode); arA.Add(user.BuildStationCodes()); noticeBuilder.AddStrategy(new Strategy(DAL.QueryStrategy.NoticeStrategyName.AccessRange, arA)); } //查询通知 string title = this.TB_NoticeTitle.Text.Trim(); if (title.Length > 0) { noticeBuilder.AddStrategy(new Strategy(DAL.QueryStrategy.NoticeStrategyName.Title, "%" + title + "%")); } string name = this.SP_Notice.Value.Trim(); if (name.Length > 0) { noticeBuilder.AddStrategy(new Strategy(DAL.QueryStrategy.NoticeStrategyName.SubmitPerson, name)); } if (this.dtNoticeDateBegin.Value != "" || this.dtNoticeDateEnd.Value != "") { ArrayList al = new ArrayList(); al.Add(this.dtNoticeDateBegin.Value); al.Add(this.dtNoticeDateEnd.Value); noticeBuilder.AddStrategy(new Strategy(DAL.QueryStrategy.NoticeStrategyName.SubmitDate, al)); } string noticeClass = this.DDLNoticeClass.Value.Trim(); if (noticeClass.Length > 0) { noticeBuilder.AddStrategy(new Strategy(DAL.QueryStrategy.NoticeStrategyName.NoticeClass, noticeClass)); } noticeBuilder.AddOrder("SubmitDate", false); string sql = noticeBuilder.BuildMainQueryString(); QueryAgent qa = new QueryAgent(); EntityData entityNotice = qa.FillEntityData("Notice", sql); qa.Dispose(); entityNotice.CurrentTable.Columns.Add("NoticeClassTitle"); //改动 for (int i = 0; i < entityNotice.CurrentTable.Rows.Count; i++) { //改动 if (entityNotice.CurrentTable.Rows[i]["NoticeClass"].ToString() != string.Empty) { entityNotice.CurrentTable.Rows[i]["NoticeClassTitle"] = entityNotice.CurrentTable.Rows[i]["NoticeClass"].ToString() + ":" + entityNotice.CurrentTable.Rows[i]["Title"].ToString(); } else { entityNotice.CurrentTable.Rows[i]["NoticeClassTitle"] = "" + entityNotice.CurrentTable.Rows[i]["Title"].ToString(); } //改动 string strTmp = entityNotice.CurrentTable.Rows[i]["NoticeClassTitle"].ToString(); if (strTmp.Length > 20) { entityNotice.CurrentTable.Rows[i]["NoticeClassTitle"] = strTmp.Substring(0, 20) + "..."; //改动 } } this.dgNoticeList.DataSource = DisPoseNotice(entityNotice.CurrentTable); this.dgNoticeList.DataBind(); if (DocType == "99") { lblTitle.InnerText = "公告"; ((System.Web.UI.HtmlControls.HtmlInputButton) this.Form1.FindControl("btnAddNew")).Value = "新增公告"; } else { lblTitle.InnerText = "通知"; ((System.Web.UI.HtmlControls.HtmlInputButton) this.Form1.FindControl("btnAddNew")).Value = "新增通知"; } this.tdNewNotice.Visible = user.HasOperationRight("080101"); // 080101为通知新增权限 bool IsInRole = user.HasOperationRight("080102"); // 080102为通知修改权限 strRole = (IsInRole)?"Modify":"View"; }