public static List <Notice> GetNoticeListByCatalog(UserInfo User, int Catalog) { LogWriter.WriteLog("NoticeService.GetNoticeListByCatalog:UserName="******",Catalog=" + Catalog.ToString()); IList <PN_Notice> notices = null; string condition = "PN_Notice.ToAllStaff='Y' AND IsDelete ='N' AND PN_Notice.ApproveFlag=1"; condition += " AND MCS_SYS.dbo.UF_Spilt2('MCS_OA.dbo.PN_Notice',ExtPropertys,'Catalog')='" + Catalog.ToString() + "'"; condition += " AND (PN_Notice.ToAllOrganizeCity='Y' OR PN_Notice.ID IN (SELECT NoticeID FROM PN_ToOrganizeCity WHERE OrganizeCity=" + User.OrganizeCity.ToString() + "))"; notices = PN_NoticeBLL.GetModelList(condition); if (notices == null) { return(null); } List <Notice> lists = new List <Notice>(notices.Count); foreach (PN_Notice item in notices.OrderByDescending(p => p.InsertTime)) { Notice n = new Notice(item); n.HasRead = PN_HasReadUserBLL.IsRead(n.ID, User.UserName); lists.Add(n); } return(lists); }
/// <summary> /// 获取通知列表 /// </summary> /// <param name="AuthKey"></param> /// <returns></returns> public static List <Notice> GetMyNoticeList(UserInfo User) { LogWriter.WriteLog("NoticeService.GetMyNoticeList:UserName="******"PN_Notice.ToAllStaff='Y' AND IsDelete ='N' AND PN_Notice.ApproveFlag=1"; condition += " AND (PN_Notice.ToAllOrganizeCity='Y' OR PN_Notice.ID IN (SELECT NoticeID FROM PN_ToOrganizeCity WHERE OrganizeCity=" + User.OrganizeCity.ToString() + "))"; notices = PN_NoticeBLL.GetModelList(condition); } if (notices == null) { return(null); } List <Notice> lists = new List <Notice>(notices.Count); foreach (PN_Notice item in notices.OrderByDescending(p => p.InsertTime)) { Notice n = new Notice(item); n.HasRead = PN_HasReadUserBLL.IsRead(n.ID, User.UserName); lists.Add(n); } return(lists); }
private void BindNotice() { IList <PN_Notice> notices = null; //无导和有导店看不同的公告 if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "ViewALLNotice")) { //查看所有公告 notices = PN_NoticeBLL.GetModelList("PN_Notice.IsDelete ='N' AND PN_Notice.InsertTime > '" + DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") + "' AND PN_Notice.ApproveFlag=1 " + " ORDER BY MCS_SYS.dbo.UF_Spilt(PN_Notice.ExtPropertys,'|',1) DESC, PN_Notice.InsertTime DESC"); } else { notices = PN_NoticeBLL.GetNoticeByStaff((int)Session["UserID"]); } gv_Notice.BindGrid <PN_Notice>(notices.Where(p => p["Catalog"] == "" || int.Parse(p["Catalog"]) < 200).ToList()); //获取特殊公告 PN_Notice specialnotice = notices.FirstOrDefault(p => p["IsSpecial"] == "1"); if (specialnotice != null) { lab_SpecialPN.Text = specialnotice.Content; } }
protected void bt_Approve_Click(object sender, EventArgs e) { bt_OK_Click(null, null); PN_NoticeBLL noticebll = new PN_NoticeBLL((int)ViewState["ID"]); noticebll.Approve(1, (int)Session["UserID"]); MessageBox.ShowAndRedirect(this, "审核成功", "index.aspx?Catalog=" + ViewState["Catalog"].ToString()); }
public Notice(int NoticeID) { PN_Notice m = new PN_NoticeBLL(NoticeID).Model; if (m != null) { FillModel(m); } }
protected void ud_Notice_RowDeleting(object sender, GridViewDeleteEventArgs e) { int id = int.Parse(ud_Notice.DataKeys[e.RowIndex]["ID"].ToString()); PN_NoticeBLL _bll = new PN_NoticeBLL(id); if (_bll.Model.InsertStaff != (int)Session["UserID"] && _bll.Model.ApproveFlag == 1 && !Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "DelNotice")) { MessageBox.Show(Page, "对不起,你没有删除已审核公告的权限"); return; } _bll.SetIsDeleted(); BindGrid(); }
protected void ud_Notice_SelectedIndexChanging(object sender, GridViewSelectEventArgs e) { int id = int.Parse(ud_Notice.DataKeys[e.NewSelectedIndex]["ID"].ToString()); PN_NoticeBLL _bll = new PN_NoticeBLL(id); if (_bll.Model.ApproveFlag == 1) { if (_bll.Model.InsertStaff != (int)Session["UserID"] && !Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "UnApproveNotice")) { MessageBox.Show(Page, "对不起,你没有撤销已审核的公告的权限"); return; } _bll.Approve(2, (int)Session["UserID"]); } BindGrid(); }
private void BindNotice() { if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "ViewALLNotice")) { //查看所有公告 gv_Notice.BindGrid <PN_Notice>(PN_NoticeBLL.GetModelList("PN_Notice.IsDelete ='N' AND PN_Notice.InsertTime > '" + DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") + "' AND PN_Notice.ApproveFlag=1 ORDER BY MCS_SYS.dbo.UF_Spilt(PN_Notice.ExtPropertys,'|',1) DESC, PN_Notice.InsertTime DESC")); } else { gv_Notice.BindGrid <PN_Notice>(PN_NoticeBLL.GetNoticeByStaff((int)Session["UserID"])); } //获取特殊公告 IList <PN_Notice> pn = PN_NoticeBLL.GetModelList(" ID = (SELECT max(id) FROM [MCS_OA].[dbo].[PN_Notice] WHERE MCS_SYS.dbo.UF_Spilt(ExtPropertys,'|',2)=1 AND IsDelete='N')"); if (pn.Count > 0) { lab_SpecialPN.Text = pn[0].Content; } }
private void BindGrid() { int approveflag; string CanComment; #region 显示公告主题内容 PN_NoticeBLL noticebll = new PN_NoticeBLL(Convert.ToInt32(ViewState["ID"])); lbl_Topic.Text = noticebll.Model.Topic.ToString(); lbl_content.Text = noticebll.Model.Content.ToString(); PN_HasReadStaffBLL hasReadStaffbll = new PN_HasReadStaffBLL(); PN_CommentBLL commentbll = new PN_CommentBLL(); lab_hasRead.Text = hasReadStaffbll.GetReadCountByNotice(Convert.ToInt32(ViewState["ID"])).ToString(); lab_comment.Text = commentbll.GetCommentCountByNotice(Convert.ToInt32(ViewState["ID"])).ToString(); insertstaff = int.Parse(noticebll.Model.InsertStaff.ToString()); lbl_InsertStaffName.Text = new Org_StaffBLL(insertstaff).Model.RealName; lbl_InsertTime.Text = noticebll.Model.InsertTime.ToString(); approveflag = noticebll.Model.ApproveFlag; //是否可以添加评论 CanComment = noticebll.Model.CanComment; //审核标志 ViewState["Catalog"] = noticebll.Model["Catalog"]; #endregion #region 展示附件 UploadFile1.RelateID = Convert.ToInt32(ViewState["ID"]); UploadFile1.BindGrid(); #endregion #region 初始化时折叠评论内容和评论板 //UpdatePanel1.Visible = false; #endregion #region 判断此公告是否可以评论 if (CanComment == "N") { btn_LookComment.Visible = false; } #endregion }
public Notice(int NoticeID) { PN_Notice m = new PN_NoticeBLL(NoticeID).Model; if (m != null) FillModel(m); }
protected void bt_OK_Click(object sender, EventArgs e) { PN_NoticeBLL _noticebll = null; if ((int)ViewState["ID"] == 0) _noticebll = new PN_NoticeBLL(); else _noticebll = new PN_NoticeBLL((int)ViewState["ID"]); DropDownList ddl_Catalog = (DropDownList)UC_Notice.FindControl("PN_Notice_Catalog"); if (ddl_Catalog != null && ddl_Catalog.SelectedValue == "0") { MessageBox.Show(this, "请选择公告目录!"); return; } UC_Notice.GetData(_noticebll.Model); #region 判断置顶公告的截止日期 if (_noticebll.Model["IsTop"] == "Y") { if (_noticebll.Model["TopEndDate"] == "" || _noticebll.Model["TopEndDate"] == "1900-01-01") { MessageBox.Show(this, "请设定公告的置顶截止日期!"); return; } if (DateTime.Parse(_noticebll.Model["TopEndDate"]) < DateTime.Today) { MessageBox.Show(this, "设定公告的置顶截止日期不能小于今天!"); return; } } else { _noticebll.Model["TopEndDate"] = "1900-01-01"; } #endregion #region 判断非面向全体公告是否选择了面向职位及面向区域 if (_noticebll.Model.ToAllStaff == "N" && lb_PositionChild.Items.Count == 0) { MessageBox.Show(this, "请设定公告要面向发布的职位!"); return; } if (_noticebll.Model.ToAllOrganizeCity == "N" && lb_CityChild.Items.Count == 0) { MessageBox.Show(this, "请设定公告要面向发布的管理片区!"); return; } #endregion if ((int)ViewState["ID"] == 0) { _noticebll.Model.InsertStaff = (int)Session["UserID"]; _noticebll.Model.IsDelete = "N"; _noticebll.Model.ApproveFlag = 2; _noticebll.Model.Content = ckedit_content.Text; ViewState["ID"] = _noticebll.Add(); if (tab_PNToPosition.Visible == true) AddFaceTo(); } else { _noticebll.Model.UpdateStaff = (int)Session["UserID"]; _noticebll.Model.UpdateTime = Convert.ToDateTime(DateTime.Now.ToString()); _noticebll.Model.Content = ckedit_content.Text; _noticebll.Update(); UpdateFaceTo(); } //添加附件 UploadFile1.RelateID = (int)ViewState["ID"]; if (sender != null) MessageBox.ShowAndRedirect(this, "保存成功", "NoticeDetail.aspx?ID=" + ViewState["ID"].ToString()); }
private void BindData() { PN_NoticeBLL bll = new PN_NoticeBLL((int)ViewState["ID"]); UC_Notice.BindData(bll.Model); if (bll.Model["Catalog"] != "") ViewState["Catalog"] = int.Parse(bll.Model["Catalog"]); if (bll.Model.ApproveFlag == 1) { bt_Approve.Visible = false; bt_OK.Visible = false; bt_Clear1.Visible = false; bt_Detele1.Visible = false; bt_Insert1.Visible = false; bt_Clear2.Visible = false; bt_Detele2.Visible = false; bt_Insert2.Visible = false; bt_PreView.Visible = false; UploadFile1.CanDelete = false; UploadFile1.CanUpload = false; } tab_PNToPosition.Visible = bll.Model.ToAllStaff == "N"; tab_PNToOrganizeCity.Visible = bll.Model.ToAllOrganizeCity == "N"; UploadFile1.RelateID = (int)ViewState["ID"]; UploadFile1.BindGrid(); #region 显示所属职位,片区 if (tab_PNToPosition.Visible) { List<int> List = new List<int>(); List = PN_ToPositionBLL.GetPositionByNoticeID((int)ViewState["ID"]); lb_PositionChild.Items.Clear(); if (List != null) { foreach (int id in List) { Org_PositionBLL positionbll = new Org_PositionBLL(id); lb_PositionChild.Items.Add(new ListItem(positionbll.Model.Name, id.ToString())); } } } if (tab_PNToOrganizeCity.Visible) { List<int> List = new List<int>(); List = PN_ToOrganizeCityBLL.GetOrganizeCityByNoticeID((int)ViewState["ID"]); lb_CityChild.Items.Clear(); if (List != null) { foreach (int id in List) { Addr_OrganizeCityBLL organizeCitybll = new Addr_OrganizeCityBLL(id); lb_CityChild.Items.Add(new ListItem(organizeCitybll.Model.Name, id.ToString())); } } } #endregion ckedit_content.Text = bll.Model.Content; }
private void BindData() { PN_NoticeBLL bll = new PN_NoticeBLL((int)ViewState["ID"]); UC_Notice.BindData(bll.Model); if (bll.Model["Catalog"] != "") { ViewState["Catalog"] = int.Parse(bll.Model["Catalog"]); } if (bll.Model.ApproveFlag == 1) { bt_Approve.Visible = false; bt_OK.Visible = false; bt_Clear1.Visible = false; bt_Detele1.Visible = false; bt_Insert1.Visible = false; bt_Clear2.Visible = false; bt_Detele2.Visible = false; bt_Insert2.Visible = false; bt_PreView.Visible = false; UploadFile1.CanDelete = false; UploadFile1.CanUpload = false; } tab_PNToPosition.Visible = bll.Model.ToAllStaff == "N"; tab_PNToOrganizeCity.Visible = bll.Model.ToAllOrganizeCity == "N"; UploadFile1.RelateID = (int)ViewState["ID"]; UploadFile1.BindGrid(); #region 显示所属职位,片区 if (tab_PNToPosition.Visible) { List <int> List = new List <int>(); List = PN_ToPositionBLL.GetPositionByNoticeID((int)ViewState["ID"]); lb_PositionChild.Items.Clear(); if (List != null) { foreach (int id in List) { Org_PositionBLL positionbll = new Org_PositionBLL(id); lb_PositionChild.Items.Add(new ListItem(positionbll.Model.Name, id.ToString())); } } } if (tab_PNToOrganizeCity.Visible) { List <int> List = new List <int>(); List = PN_ToOrganizeCityBLL.GetOrganizeCityByNoticeID((int)ViewState["ID"]); lb_CityChild.Items.Clear(); if (List != null) { foreach (int id in List) { Addr_OrganizeCityBLL organizeCitybll = new Addr_OrganizeCityBLL(id); lb_CityChild.Items.Add(new ListItem(organizeCitybll.Model.Name, id.ToString())); } } } #endregion ckedit_content.Text = bll.Model.Content; }
private void BindGrid() { int approveflag = 1; DateTime dtBegin = DateTime.Parse(this.tbx_begin.Text); DateTime dtEnd = DateTime.Parse(this.tbx_end.Text).AddDays(1); #region 列表列隐藏 if (MCSTabControl1.SelectedIndex == 0) { //已审核公告 approveflag = 1; //是否有权限撤销公告 ud_Notice.Columns[ud_Notice.Columns.Count - 2].Visible = Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "UnApproveNotice"); //是否有权限删除公告 ud_Notice.Columns[ud_Notice.Columns.Count - 1].Visible = Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "DelNotice"); } else if (MCSTabControl1.SelectedIndex == 1) { //未审核公告 approveflag = 2; ud_Notice.Columns[ud_Notice.Columns.Count - 2].Visible = false; ud_Notice.Columns[ud_Notice.Columns.Count - 1].Visible = true; } else { //我的公告 ud_Notice.Columns[ud_Notice.Columns.Count - 2].Visible = true; ud_Notice.Columns[ud_Notice.Columns.Count - 1].Visible = true; } #endregion IList <PN_Notice> notices = null; if (MCSTabControl1.SelectedIndex < 2) { if (Right_Assign_BLL.GetAccessRight(Session["UserName"].ToString(), 2104, "ViewALLNotice")) { //查看所有公告 notices = PN_NoticeBLL.GetModelList("PN_Notice.IsDelete ='N' AND PN_Notice.InsertTime BETWEEN '" + tbx_begin.Text + "' AND '" + tbx_end.Text + " 23:59' AND PN_Notice.ApproveFlag=" + approveflag.ToString() + " ORDER BY MCS_SYS.dbo.UF_Spilt(PN_Notice.ExtPropertys,'|',1) DESC, PN_Notice.InsertTime DESC"); } else { notices = PN_NoticeBLL.GetNoticeByStaff((int)Session["UserID"], dtBegin, dtEnd, approveflag); } } else { //我发布的公告 notices = PN_NoticeBLL.GetModelList("PN_Notice.IsDelete ='N' AND PN_Notice.InsertTime BETWEEN '" + tbx_begin.Text + "' AND '" + tbx_end.Text + " 23:59' AND PN_Notice.InsertStaff=" + (int)Session["UserID"] + " Order BY PN_Notice.InsertTime desc"); } if (tbx_Search.Text.Trim() != "") { notices = notices.Where(p => p.KeyWord.Contains(tbx_Search.Text.Trim()) || p.Topic.Contains(tbx_Search.Text.Trim())).ToList(); } if ((int)ViewState["Catalog"] > 1) { notices = notices.Where(p => p["Catalog"] == ViewState["Catalog"].ToString()).ToList(); } else { notices = notices.Where(p => p["Catalog"] == "" || p["Catalog"] == "1").ToList(); } ud_Notice.BindGrid(notices); return; }
protected void bt_OK_Click(object sender, EventArgs e) { PN_NoticeBLL _noticebll = null; if ((int)ViewState["ID"] == 0) { _noticebll = new PN_NoticeBLL(); } else { _noticebll = new PN_NoticeBLL((int)ViewState["ID"]); } DropDownList ddl_Catalog = (DropDownList)UC_Notice.FindControl("PN_Notice_Catalog"); if (ddl_Catalog != null && ddl_Catalog.SelectedValue == "0") { MessageBox.Show(this, "请选择公告目录!"); return; } UC_Notice.GetData(_noticebll.Model); #region 判断置顶公告的截止日期 if (_noticebll.Model["IsTop"] == "Y") { if (_noticebll.Model["TopEndDate"] == "" || _noticebll.Model["TopEndDate"] == "1900-01-01") { MessageBox.Show(this, "请设定公告的置顶截止日期!"); return; } if (DateTime.Parse(_noticebll.Model["TopEndDate"]) < DateTime.Today) { MessageBox.Show(this, "设定公告的置顶截止日期不能小于今天!"); return; } } else { _noticebll.Model["TopEndDate"] = "1900-01-01"; } #endregion #region 判断非面向全体公告是否选择了面向职位及面向区域 if (_noticebll.Model.ToAllStaff == "N" && lb_PositionChild.Items.Count == 0) { MessageBox.Show(this, "请设定公告要面向发布的职位!"); return; } if (_noticebll.Model.ToAllOrganizeCity == "N" && lb_CityChild.Items.Count == 0) { MessageBox.Show(this, "请设定公告要面向发布的管理片区!"); return; } #endregion if ((int)ViewState["ID"] == 0) { _noticebll.Model.InsertStaff = (int)Session["UserID"]; _noticebll.Model.IsDelete = "N"; _noticebll.Model.ApproveFlag = 2; _noticebll.Model.Content = ckedit_content.Text; ViewState["ID"] = _noticebll.Add(); if (tab_PNToPosition.Visible == true) { AddFaceTo(); } } else { _noticebll.Model.UpdateStaff = (int)Session["UserID"]; _noticebll.Model.UpdateTime = Convert.ToDateTime(DateTime.Now.ToString()); _noticebll.Model.Content = ckedit_content.Text; _noticebll.Update(); UpdateFaceTo(); } //添加附件 UploadFile1.RelateID = (int)ViewState["ID"]; if (sender != null) { MessageBox.ShowAndRedirect(this, "保存成功", "NoticeDetail.aspx?ID=" + ViewState["ID"].ToString()); } }