public Notice(PN_Notice m) { if (m != null) { FillModel(m); } }
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; } }
private void FillModel(PN_Notice m) { if (m == null) { return; } ID = m.ID; Topic = m.Topic; KeyWord = m.KeyWord; Content = m.Content.Replace("/RMS/SubModule/DownloadAttachment.aspx?", MCSFramework.Common.ConfigHelper.GetConfigString("WebSiteURL") + "/DownloadAttachment.aspx?"); CanComment = m.CanComment.ToUpper() == "Y"; InsertTime = m.InsertTime; Abstract = m["Abstract"]; if (Abstract == "") { if (Content.Length > 100) { Abstract = Content.Substring(0, 100); } else { Abstract = Content; } } Author = m["Author"]; #region 替换描述中的图片链接 Content = Content.Replace("src=\"/Admin/DownloadAttachment.aspx", "src=\"" + ConfigHelper.GetConfigString("WebSiteURL") + "DownloadAttachment.aspx"); Content = Content.Replace("src=\"/MClub/DownloadAttachment.aspx", "src=\"" + ConfigHelper.GetConfigString("WebSiteURL") + "DownloadAttachment.aspx"); #endregion #region 获取首要图片 string condition = " RelateType=80 AND RelateID=" + m.ID.ToString() + " AND MCS_SYS.dbo.UF_Spilt(ExtPropertys,'|',1)='Y'"; IList <ATMT_Attachment> lists = ATMT_AttachmentBLL.GetModelList(condition); if (lists.Count > 0 && ATMT_AttachmentBLL.IsImage(lists[0].ExtName)) { ImageGUID = lists[0].GUID; } #endregion #region 获取附件明细 Atts = new List <Attachment>(); IList <ATMT_Attachment> atts = ATMT_AttachmentBLL.GetAttachmentList(80, m.ID, new DateTime(1900, 1, 1), new DateTime(2100, 1, 1)); foreach (ATMT_Attachment att in atts.OrderBy(p => p.Name)) { Attachment v = new Attachment(); v.AttName = att.Name; v.ExtName = att.ExtName; v.GUID = att.GUID; v.UploadTime = att.UploadTime; v.FileSize = att.FileSize; Atts.Add(v); } #endregion }