/// <summary> /// 获取附件链接 默认取集合里的第一个附件 /// </summary> /// <param name="id">公告编号</param> /// <returns></returns> protected string GetUrl(string id) { StringBuilder sb = new StringBuilder(); if (!string.IsNullOrEmpty(id)) { EyouSoft.BLL.GovStructure.BNotice bll = new EyouSoft.BLL.GovStructure.BNotice(); EyouSoft.Model.ComStructure.MComAttach attachModel = new EyouSoft.Model.ComStructure.MComAttach(); EyouSoft.Model.GovStructure.MGovNotice noticeModel = new EyouSoft.Model.GovStructure.MGovNotice(); noticeModel = bll.GetGovNoticeModel(id); if (noticeModel != null) { if (noticeModel.ComAttachList != null && noticeModel.ComAttachList.Count > 0) { attachModel = noticeModel.ComAttachList.First(); sb.AppendFormat("<a target=\"_blank\" title=\"附件\" href=\"/CommonPage/FileDownLoad.aspx?doType=downLoad&filePath={0}&name={1}\" ><img src=\"/Images/fujian.gif\" /></a>", attachModel.FilePath, attachModel.Name); return(sb.ToString()); } } } return(string.Empty); }
/// <summary> /// 页面初始化 /// </summary> /// <param name="id">操作ID</param> protected void PageInit(string id) { EyouSoft.BLL.GovStructure.BNotice BLL = new EyouSoft.BLL.GovStructure.BNotice(); EyouSoft.Model.GovStructure.MGovNotice Model = BLL.GetGovNoticeModel(id); if (null != Model) { //浏览人数加1 int views = 0; Int32.TryParse(Model.Views.ToString(), out views); Model.Views = views + 1; BLL.UpdateGovNotice(Model); //插入浏览人相关信息 MGovNoticeBrowse viewModel = new MGovNoticeBrowse(); viewModel.IssueTime = DateTime.Now; viewModel.NoticeId = id; viewModel.OperatorId = this.SiteUserInfo.UserId; viewModel.Operator = this.SiteUserInfo.Name; BLL.AddGovNoticeBrowse(viewModel); //通知公告标题标题 this.lbTitle.Text = Model.Title; StringBuilder strSec = new StringBuilder(); if (null != Model.MGovNoticeReceiverList && Model.MGovNoticeReceiverList.Count > 0) { EyouSoft.BLL.ComStructure.BComDepartment secBLL = new EyouSoft.BLL.ComStructure.BComDepartment(); EyouSoft.Model.ComStructure.MComDepartment secModel; foreach (MGovNoticeReceiver m in Model.MGovNoticeReceiverList) { if (m.ItemType == EyouSoft.Model.EnumType.GovStructure.ItemType.指定部门) { if (!string.IsNullOrEmpty(m.ItemId)) { int[] intArry = Utils.GetIntArray(m.ItemId, ","); for (int j = 0; j < intArry.Length; j++) { secModel = secBLL.GetModel(intArry[j], this.SiteUserInfo.CompanyId); if (null != secModel) { strSec.Append(secModel.DepartName + ","); } } } } else { strSec.Append(m.ItemType.ToString() + ","); } } } //发布对象 this.lbObj.Text = strSec.Length > 0 ? strSec.ToString().Substring(0, strSec.Length - 1) : ""; //内容 this.lbContent.Text = Model.Content; IList <EyouSoft.Model.ComStructure.MComAttach> lstFiles = Model.ComAttachList; StringBuilder strFile = new StringBuilder(); if (null != lstFiles && lstFiles.Count > 0) { for (int i = 0; i < lstFiles.Count; i++) { strFile.AppendFormat("<span class='upload_filename'><a href='/CommonPage/FileDownLoad.aspx?doType=downLoad&filePath={0}&name={1}' target='_blank'>{1}</a></span>", lstFiles[i].FilePath, lstFiles[i].Name); } this.lbFile.Text = strFile.ToString(); } else { this.lbFile.Text = "无"; } //是否提醒 this.LbAwake.Text = Model.IsRemind == true ? "是" : "否"; //是否发送短信 //this.LbSendmsg.Text = Model.IsMsg == true ? "是" : "否"; //短信内容 //this.LbMsgcontent.Text = Model.MsgContent; this.lbTime.Text = string.Format("{0:yyyy-MM-dd HH:mm}", Model.IssueTime); this.lbSender.Text = Model.Operator; } }