Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
    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;
        }
    }
Ejemplo n.º 4
0
    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;
        }
    }
Ejemplo n.º 5
0
    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;
    }