private ReturnValue SendSystemNoticeToPersonals(SystemNotice systemNotice, string personals) { BLLJIMP.BLLUser bllUser = new BLLUser(""); BLLJIMP.BLLWeixin bllWeixin = new BLLWeixin(""); BLLWeixin.TMTaskNotification notificaiton = new BLLWeixin.TMTaskNotification(); notificaiton.Url = string.Format("http://{0}/WuBuHui/MyCenter/SystemMessageBox.aspx", System.Web.HttpContext.Current.Request.Url.Host); var accessToken = bllWeixin.GetAccessToken(); string[] userArray = personals.Split(','); int successCount = 0; foreach (string userId in userArray) { successCount += SendSystemNoticeToUserId(systemNotice, userId) ? 1 : 0; try { notificaiton.First = "您好,您有新系统消息"; notificaiton.Keyword1 = systemNotice.Title; notificaiton.Keyword2 = systemNotice.NoticeTypeString; notificaiton.Remark = "点击查看"; bllWeixin.SendTemplateMessage(accessToken, bllUser.GetUserInfo(userId).WXOpenId, notificaiton); } catch (Exception) { continue; } } return(new ReturnValue { Code = 0, Msg = string.Format("成功将消息发送到{0}个人.", successCount) }); }
void GetInternal() { var client = new WebLib.NetClient(); var task = client.Create <XmlDocument>(HttpMethod.Get, "https://blog.iccfish.com/feed/", "").Send(); if (task == null || !task.IsSuccess || task.Result == null) { Success = false; } else { Success = true; SystemNotice = new List <SystemNotice>(); var nodes = task.Result.SelectNodes("//item"); foreach (var node in nodes.Cast <XmlNode>()) { var no = new SystemNotice(node.SelectSingleNode("title").InnerText.Trim(), node.SelectSingleNode("link").InnerText.Trim(), node.SelectSingleNode("pubDate").InnerText.Trim().ToDateTimeNullable() ?? DateTime.Now, false, node.SelectSingleNode("description").InnerText.Trim() ); SystemNotice.Add(no); } } _operation.PostOperationCompleted(_ => OnDownloadComplete(), null); }
/// <summary> /// 数据保存 /// </summary> protected void btnSave_Click(object sender, EventArgs e) { SystemNotice notice = new SystemNotice(); if (IntParam > 0) { AuthUserOperationPermission(Permission.Edit); notice = FacadeManage.aideNativeWebFacade.GetSystemNoticeInfo(IntParam); } else { AuthUserOperationPermission(Permission.Add); notice.PublisherTime = DateTime.Now; } notice.MoblieContent = txtMobile.Text; notice.WebContent = txtWeb.Text; notice.IsHot = cbHot.Checked; notice.IsTop = cbTop.Checked; notice.Nullity = cbNullity.Checked; notice.Publisher = CtrlHelper.GetText(txtPublisher); notice.SortID = CtrlHelper.GetInt(txtSort, 1); notice.NoticeTitle = CtrlHelper.GetText(txtTitle); int result = IntParam > 0 ? FacadeManage.aideNativeWebFacade.UpdateSystemNotice(notice) : FacadeManage.aideNativeWebFacade.InsertSystemNotice(notice); if (result > 0) { ShowInfo("新闻公告操作成功", "SystemNoticeList.aspx", 1000); } else { ShowError("新闻公告操作失败"); } }
/// <summary> /// 更新一条数据 通过ID更新所有 /// </summary> public bool Update(SystemNotice model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update SystemNotice set "); strSql.Append(" NoticeTitle = @NoticeTitle , "); strSql.Append(" NoticeContent = @NoticeContent , "); strSql.Append(" NoticeType = @NoticeType , "); strSql.Append(" NoticeStatus = @NoticeStatus , "); strSql.Append(" NoticeAddDate = @NoticeAddDate , "); strSql.Append(" NoticeRealseAccount = @NoticeRealseAccount "); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4), new SqlParameter("@NoticeTitle", SqlDbType.VarChar, 200), new SqlParameter("@NoticeContent", SqlDbType.VarChar, -1), new SqlParameter("@NoticeType", SqlDbType.Int, 4), new SqlParameter("@NoticeStatus", SqlDbType.Int, 4), new SqlParameter("@NoticeAddDate", SqlDbType.DateTime), new SqlParameter("@NoticeRealseAccount", SqlDbType.VarChar, 50) }; parameters[0].Value = model.Id; parameters[1].Value = model.NoticeTitle; parameters[2].Value = model.NoticeContent; parameters[3].Value = model.NoticeType; parameters[4].Value = model.NoticeStatus; parameters[5].Value = model.NoticeAddDate; parameters[6].Value = model.NoticeRealseAccount; return(sqlhelper.ExecNon(strSql.ToString(), parameters) > 0 ? true : false); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SystemNotice model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into SystemNotice("); strSql.Append("NoticeTitle,NoticeContent,NoticeType,NoticeStatus,NoticeAddDate,NoticeRealseAccount"); strSql.Append(") values ("); strSql.Append("@NoticeTitle,@NoticeContent,@NoticeType,@NoticeStatus,@NoticeAddDate,@NoticeRealseAccount"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@NoticeTitle", SqlDbType.VarChar, 200), new SqlParameter("@NoticeContent", SqlDbType.VarChar, -1), new SqlParameter("@NoticeType", SqlDbType.Int, 4), new SqlParameter("@NoticeStatus", SqlDbType.Int, 4), new SqlParameter("@NoticeAddDate", SqlDbType.DateTime), new SqlParameter("@NoticeRealseAccount", SqlDbType.VarChar, 50) }; parameters[0].Value = model.NoticeTitle; parameters[1].Value = model.NoticeContent; parameters[2].Value = model.NoticeType; parameters[3].Value = model.NoticeStatus; parameters[4].Value = model.NoticeAddDate; parameters[5].Value = model.NoticeRealseAccount; return(sqlhelper.ExecNon(strSql.ToString(), parameters)); }
public JsonResult AddUpdateNotice(SystemNotice notice) { JsonResult result = null; try { BaseResultDto <string> resultDto = new BaseResultDto <string>(); //添加或者修改 if (notice.Id > 0) { //修改 resultDto = HttpHelper.CreatHelper().DoPostObject <BaseResultDto <string> >(string.Format("{0}Notice/Update", this.WebApiUrl), notice); } else { notice.NoticeAddDate = System.DateTime.Now; notice.NoticeRealseAccount = this.UserInfo.UserName; //添加 resultDto = HttpHelper.CreatHelper().DoPostObject <BaseResultDto <string> >(string.Format("{0}Notice/Add", this.WebApiUrl), notice); } result = Json(new { status = resultDto.ErrorCode, message = resultDto.ErrorMsg }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { result = Json(new { status = -1, message = ex.Message }, JsonRequestBehavior.AllowGet); } return(result); }
public bool Update(SystemNotice model, List <string> fileds, string sqlWhere) { StringBuilder strSql = new StringBuilder(); strSql.AppendFormat("update {0} set ", model.GetType().Name); List <string> filedsList = new List <string>(); List <SqlParameter> sqlParameter = new List <SqlParameter>(); SqlParameter Param = new SqlParameter("@Id", SqlDbType.Int, 4); if (string.IsNullOrEmpty(sqlWhere)) { Param.Value = model.Id; sqlParameter.Add(Param); } foreach (string filed in fileds) { filedsList.Add(string.Format("{0}=@{0}", filed)); Param = new SqlParameter(string.Format("@{0}", filed), model.GetType().GetProperty(filed).GetValue(model, null)); sqlParameter.Add(Param); } strSql.AppendFormat("{0}", string.Join(",", filedsList.ToArray())); if (string.IsNullOrEmpty(sqlWhere)) { strSql.Append(" where Id=@Id "); } else { strSql.AppendFormat(" where 1=1 and {0} ", sqlWhere); } SqlParameter[] parameters = sqlParameter.ToArray(); return(sqlhelper.ExecNon(strSql.ToString(), parameters) > 0 ? true : false); }
public static PacketWriter QuitNotice(SystemNotice notice, NoticeType type = NoticeType.Mint, List <string> parameters = null, short durationSec = 0) { parameters ??= new(); PacketWriter pWriter = PacketWriter.Of(SendOp.Notice); pWriter.Write(NoticePacketMode.Quit); WriteNotice(pWriter, notice, type, parameters, durationSec); return(pWriter); }
public void PublishSystemNotice(string title, string content) { var notice = new SystemNotice(); notice.Title = title; notice.Content = content; notice.FADateTime = DateTime.Now; notice.AdminUserId = 1; _systemNoticeRepository.Insert(notice); }
private bool SendSystemNoticeToUserId(SystemNotice systemNotice, string userId) { systemNotice.UserId = userId; systemNotice.Receivers = userId; if (this.GetCount <UserInfo>(string.Format("UserId='{0}'", systemNotice.UserId)) < 1) { return(false); } return(this.Add(systemNotice)); }
/// <summary> /// 数据保存 /// </summary> protected void btnSave_Click(object sender, EventArgs e) { SystemNotice notice = new SystemNotice(); if (IntParam > 0) { if (!AuthUserOperationPermission(Permission.Edit)) { return; } notice = FacadeManage.aideNativeWebFacade.GetSystemNoticeInfo(IntParam); } else { if (!AuthUserOperationPermission(Permission.Add)) { return; } notice.PublisherTime = DateTime.Now; } //if(upImage.ImgThumbnailsWidth>10) //{ //} string filepath = upImage.FilePath; if (string.IsNullOrEmpty(filepath)) { ShowError("广告图片未上传"); return; } notice.MoblieContent = filepath.Substring(7, filepath.Length - 7); //notice.WebContent = txtWeb.Text; notice.IsHot = cbHot.Checked; notice.IsTop = cbTop.Checked; notice.Nullity = cbNullity.Checked; notice.Publisher = ddtype.SelectedValue; notice.SortID = CtrlHelper.GetInt(txtSort, 1); notice.NoticeTitle = CtrlHelper.GetText(txtTitle); notice.PlatformType = 1; int result = IntParam > 0 ? FacadeManage.aideNativeWebFacade.UpdateSystemNotice(notice) : FacadeManage.aideNativeWebFacade.InsertSystemNotice(notice); if (result > 0) { ShowInfo("新闻公告操作成功", "SystemNoticeList.aspx", 1000); } else { ShowError("新闻公告操作失败"); } }
public static Packet Notice(SystemNotice notice, NoticeType type = NoticeType.Mint) { PacketWriter pWriter = PacketWriter.Of(SendOp.NOTICE); pWriter.WriteEnum(NoticePacketMode.Send); pWriter.WriteShort((short)type); pWriter.WriteByte(0x1); pWriter.WriteInt(0x1); pWriter.WriteInt((int)notice); pWriter.WriteInt(); pWriter.WriteShort(); return(pWriter); }
/// <summary> /// 页面加载 /// </summary> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //获取网站站点配置 ConfigInfo info = Fetch.GetWebSiteConfig(); string imgDomain = info != null ? info.Field2 : ""; //获取置顶新闻图片 bannerNews = Fetch.GetUploadFileUrl(imgDomain, "/Site/toplogo.png"); //获取广告图 IList <Ads> list = Fetch.GetAdsList(); if (list != null) { foreach (var item in list) { if (item.Type == 0) { bannerAds = bannerAds + string.Format("<div class=\"slider-item\"><a href=\"{0}\"><img src=\"{1}\" title=\"{2}\"></a></div>", string.IsNullOrEmpty(item.LinkURL) ? "javascript:;" : item.LinkURL, Fetch.GetUploadFileUrl(imgDomain, item.ResourceURL), item.Title); } } } bannerAds = bannerAds == null ? "<div class=\"slider-item\"><a href=\"javascript:;\"><img src=\"/image/banner.png\" title=\"网站首页\"/></a></div>" : bannerAds; //绑定新闻公告 IList <SystemNotice> snList = FacadeManage.aideNativeWebFacade.GetHomePageNews(); if (snList != null) { SystemNotice notice = snList[0]; if (notice != null && notice.IsTop) { snList.RemoveAt(0); //显示置顶新闻公告 title = notice.NoticeTitle.Length > 20 ? (notice.NoticeTitle.Substring(0, 20) + "...") : notice.NoticeTitle; time = notice.PublisherTime.ToString("yyyy-MM-dd"); content = notice.MoblieContent.Length > 140 ? (notice.MoblieContent.Substring(0, 140) + "...") : notice.MoblieContent; content = !string.IsNullOrEmpty(content) ? (content + string.Format(" <a href=\"/News/Details.aspx?id={0}\">详情>></a>", notice.NoticeID)) : ""; } if (snList.Count > 12) { snList.RemoveAt(12); } //显示新闻信息列表 rpNews.DataSource = snList; rpNews.DataBind(); } } }
public static PacketWriter Error(Player player, SystemNotice error, ChatType type) { PacketWriter pWriter = PacketWriter.Of(SendOp.UserChat); pWriter.WriteLong(); pWriter.WriteLong(); pWriter.WriteUnicodeString(player.Name); pWriter.WriteByte(1); pWriter.WriteInt((int)error); pWriter.WriteInt((int)type); pWriter.WriteByte(); pWriter.WriteInt(); // Channel pWriter.WriteByte(); return(pWriter); }
public BaseResultDto <string> Update(SystemNotice model) { BaseResultDto <string> resultDto = new BaseResultDto <string>(); try { resultDto.ErrorCode = helper.Update <SystemNotice>(model) ? 1 : 0; resultDto.ErrorMsg = "修改成功"; } catch (Exception ex) { resultDto.ErrorCode = -1; resultDto.ErrorMsg = ex.Message; } return(resultDto); }
public BaseResultDto <string> Add(SystemNotice model) { BaseResultDto <string> resultDto = new BaseResultDto <string>(); try { resultDto.ErrorCode = helper.Add <SystemNotice>(model); resultDto.ErrorMsg = "添加成功"; } catch (Exception ex) { resultDto.ErrorCode = -1; resultDto.ErrorMsg = ex.Message; } return(resultDto); }
public static void WriteNotice(PacketWriter pWriter, SystemNotice notice, NoticeType type = NoticeType.Mint, List <string> parameters = null, short durationSec = 0) { pWriter.WriteShort((short)type); pWriter.WriteByte(0x1); pWriter.WriteInt(0x1); pWriter.Write(notice); pWriter.WriteInt(parameters.Count); foreach (string parameter in parameters) { pWriter.WriteUnicodeString(parameter); } if (type.HasFlag(NoticeType.Mint)) { pWriter.WriteShort(durationSec); } }
public JsonResult DelNotice(SystemNotice notice) { JsonResult result = null; try { //删除公告 BaseResultDto <string> resultDto = HttpHelper.CreatHelper().DoGetObject <BaseResultDto <string> >(string.Format("{0}Notice/Delete?Id={1}", this.WebApiUrl, notice.Id)); result = Json(new { status = resultDto.ErrorCode, message = resultDto.ErrorMsg }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { result = Json(new { status = -1, message = ex.Message }, JsonRequestBehavior.AllowGet); } return(result); }
public static Packet Notice(SystemNotice notice, NoticeType type = NoticeType.Mint, List <string> parameters = null) { parameters ??= new List <string>(); PacketWriter pWriter = PacketWriter.Of(SendOp.NOTICE); pWriter.WriteEnum(NoticePacketMode.Send); pWriter.WriteShort((short)type); pWriter.WriteByte(0x1); pWriter.WriteInt(0x1); pWriter.WriteInt((int)notice); pWriter.WriteInt(parameters.Count); foreach (string parameter in parameters) { pWriter.WriteUnicodeString(parameter); } return(pWriter); }
/// <summary> /// 数据绑定 /// </summary> protected void BindData() { if (IntParam > 0) { SystemNotice notice = FacadeManage.aideNativeWebFacade.GetSystemNoticeInfo(IntParam); if (notice != null) { CtrlHelper.SetText(txtPublisher, notice.Publisher); CtrlHelper.SetText(txtTitle, notice.NoticeTitle); CtrlHelper.SetText(txtSort, notice.SortID.ToString()); txtMobile.Text = notice.MoblieContent; txtWeb.Text = notice.WebContent; cbHot.Checked = notice.IsHot; cbNullity.Checked = notice.Nullity; cbTop.Checked = notice.IsTop; } } }
/// <summary> /// 新增新闻公告 /// </summary> /// <param name="notice">公告信息</param> /// <returns></returns> public int InsertSystemNotice(SystemNotice notice) { string sql = @"INSERT INTO SystemNotice(NoticeTitle,MoblieContent,WebContent,SortID,Publisher,PublisherTime,IsHot,IsTop,Nullity) VALUES(@NoticeTitle,@MoblieContent,@WebContent,@SortID,@Publisher,@PublisherTime,@IsHot,@IsTop,@Nullity)"; var prams = new List <DbParameter> { Database.MakeInParam("NoticeTitle", notice.NoticeTitle), Database.MakeInParam("MoblieContent", notice.MoblieContent), Database.MakeInParam("WebContent", notice.WebContent), Database.MakeInParam("SortID", notice.SortID), Database.MakeInParam("Publisher", notice.Publisher), Database.MakeInParam("PublisherTime", notice.PublisherTime), Database.MakeInParam("IsHot", notice.IsHot), Database.MakeInParam("IsTop", notice.IsTop), Database.MakeInParam("Nullity", notice.Nullity) }; return(Database.ExecuteNonQuery(CommandType.Text, sql, prams.ToArray())); }
/// <summary> /// 得到一个对象实体 /// </summary> public SystemNotice GetModel(string where) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Id, NoticeTitle, NoticeContent, NoticeType, NoticeStatus, NoticeAddDate, NoticeRealseAccount "); strSql.Append(" from SystemNotice "); strSql.Append(" where "); strSql.Append(where); var dt = sqlhelper.GetTable(strSql.ToString()); SystemNotice model = null; if (dt.Rows.Count > 0) { model = Mapper.DynamicMap <IDataReader, List <SystemNotice> >(dt.CreateDataReader()).FirstOrDefault(); } return(model); }
public void SendNoticeToAllUser() { BLLUser bllUser = new BLLUser(); List <UserInfo> userList = bllUser.GetAllUsers("UserID", Site); string noticeTypeName = GetNoticeTypeName(NoticeType.SystemMessage); string noticeContent = GetContentHtml(NoticeType.SystemMessage, null, null, Notice); foreach (var item in userList) { SystemNotice systemNotice = new SystemNotice(); systemNotice.SerialNum = GetGUID(TransacType.SendSystemNotice); systemNotice.Title = noticeTypeName; systemNotice.Ncontent = noticeContent; systemNotice.NoticeType = (int)NoticeType.SystemMessage; systemNotice.InsertTime = DateTime.Now; systemNotice.WebsiteOwner = Site; systemNotice.SendType = (int)SendType.Personal; SendSystemNoticeToUserId(systemNotice, item.UserID); } }
/// <summary> /// 修改公告信息 /// </summary> /// <param name="notice">公告信息</param> /// <returns></returns> public int UpdateSystemNotice(SystemNotice notice) { string sqlQuery = @"UPDATE SystemNotice SET NoticeTitle=@NoticeTitle,MoblieContent=@MoblieContent,WebContent=@WebContent,SortID= @SortID, Publisher= @Publisher,PublisherTime= @PublisherTime,IsHot=@IsHot,IsTop=@IsTop,Nullity=@Nullity WHERE NoticeID= @NoticeID"; var prams = new List <DbParameter> { Database.MakeInParam("NoticeTitle", notice.NoticeTitle), Database.MakeInParam("MoblieContent", notice.MoblieContent), Database.MakeInParam("WebContent", notice.WebContent), Database.MakeInParam("SortID", notice.SortID), Database.MakeInParam("Publisher", notice.Publisher), Database.MakeInParam("PublisherTime", notice.PublisherTime), Database.MakeInParam("IsHot", notice.IsHot), Database.MakeInParam("IsTop", notice.IsTop), Database.MakeInParam("Nullity", notice.Nullity), Database.MakeInParam("NoticeID", notice.NoticeID) }; return(Database.ExecuteNonQuery(CommandType.Text, sqlQuery, prams.ToArray())); }
/// <summary> /// 设置消息为已读 /// </summary> /// <param name="context"></param> /// <returns></returns> private string SetRead(HttpContext context) { int id = int.Parse(context.Request["Id"]); SystemNotice model = bllNotice.Get <SystemNotice>(string.Format("AutoID={0}", id)); if (model.Readtime == null) { model.Readtime = DateTime.Now; } else { resp.Status = 1; } if (bllNotice.Update(model)) { resp.Status = 1; } return(Common.JSONHelper.ObjectToJson(resp)); }
private ReturnValue SendSystemNoticeToAll(SystemNotice systemNotice, string websiteOwner) { BLLJIMP.BLLWeixin bllWeixin = new BLLWeixin(""); BLLWeixin.TMTaskNotification notificaiton = new BLLWeixin.TMTaskNotification(); notificaiton.Url = string.Format("http://{0}/WuBuHui/MyCenter/SystemMessageBox.aspx", System.Web.HttpContext.Current.Request.Url.Host); var acctoken = bllWeixin.GetAccessToken(); List <UserInfo> userList = new List <UserInfo>(); if (WebsiteOwner.Equals("wubuhui")) { userList = this.GetList <UserInfo>(string.Format("WebsiteOwner='{0}' and Phone is not null and Phone <>''", websiteOwner)); } else { userList = this.GetList <UserInfo>(string.Format("WebsiteOwner='{0}'", websiteOwner)); } int successCount = 0; foreach (UserInfo uinfo in userList) { successCount += SendSystemNoticeToUserId(systemNotice, uinfo.UserID) ? 1 : 0; try { notificaiton.First = "您好,您有新系统消息"; notificaiton.Keyword1 = systemNotice.Title; notificaiton.Keyword2 = systemNotice.NoticeTypeString; notificaiton.Remark = "点击查看"; bllWeixin.SendTemplateMessage(acctoken, uinfo.WXOpenId, notificaiton); } catch (Exception) { continue; } } return(new ReturnValue { Code = 0, Msg = string.Format("成功将消息发送到{0}个人.", successCount) }); }
private ReturnValue SendSystemNoticeToGroups(SystemNotice systemNotice, string groups, string websiteOwner) { BLLJIMP.BLLWeixin bllWeixin = new BLLWeixin(""); BLLWeixin.TMTaskNotification notificaiton = new BLLWeixin.TMTaskNotification(); notificaiton.Url = string.Format("http://{0}/WuBuHui/MyCenter/SystemMessageBox.aspx", System.Web.HttpContext.Current.Request.Url.Host); var acctoken = bllWeixin.GetAccessToken(); string[] groupArray = groups.Split(','); string strWhere = string.Format("TagName like '%{0}%'", groupArray[0].Trim()); foreach (string group in groupArray) { strWhere += string.Format(" or TagName like '%{0}%'", group); } List <UserInfo> userList = this.GetList <UserInfo>(string.Format("WebsiteOwner='{0}' and ({1})", websiteOwner, strWhere)); int successCount = 0; foreach (UserInfo uinfo in userList) { successCount += SendSystemNoticeToUserId(systemNotice, uinfo.UserID) ? 1 : 0; try { notificaiton.First = "您好,您有新系统消息"; notificaiton.Keyword1 = systemNotice.Title; notificaiton.Keyword2 = systemNotice.NoticeTypeString; notificaiton.Remark = "点击查看"; bllWeixin.SendTemplateMessage(acctoken, uinfo.WXOpenId, notificaiton); } catch (Exception) { continue; } } return(new ReturnValue { Code = 0, Msg = string.Format("成功将消息发送到{0}个人.", successCount) }); }
public ReturnValue SendSystemMessage(string title, string ncontent, int noticeType, int sendType, string receivers, string redirectUrl, string websiteOwner) { SystemNotice systemNotice = new SystemNotice(); systemNotice.SerialNum = GetGUID(TransacType.SendSystemNotice); systemNotice.Title = title; systemNotice.Ncontent = ncontent; systemNotice.NoticeType = noticeType; systemNotice.RedirectUrl = redirectUrl; systemNotice.InsertTime = DateTime.Now; systemNotice.WebsiteOwner = websiteOwner; systemNotice.SendType = sendType; systemNotice.Receivers = receivers; ReturnValue rc; rc.Code = 0; rc.Msg = string.Empty; switch ((SendType)sendType) { case SendType.All: rc = SendSystemNoticeToAll(systemNotice, websiteOwner); break; case SendType.Group: rc = SendSystemNoticeToGroups(systemNotice, receivers, websiteOwner); break; case SendType.Personal: rc = SendSystemNoticeToPersonals(systemNotice, receivers); break; default: throw new Exception("未定义的发送类型"); } return(rc); }
/// <summary> /// 加载页面标签 /// </summary> protected override void OnPreRenderComplete(EventArgs e) { base.OnPreRenderComplete(e); //获取新闻公告详情 int noticeid = GameRequest.GetQueryInt("id", 1); if (noticeid > 0) { SystemNotice notice = FacadeManage.aideNativeWebFacade.GetWebNewsInfo(noticeid); if (notice != null) { NewsTitle = notice.NoticeTitle; Resource = notice.Publisher; Time = notice.PublisherTime.ToString("yyyy-MM-dd"); Content = notice.WebContent; Intro = notice.MoblieContent.Length > 100? notice.MoblieContent.Substring(0, 100): notice.MoblieContent; } } //设置页面标签 AddMetaTitle(string.IsNullOrEmpty(NewsTitle) ? "新闻公告" : NewsTitle); AddMetaTag("keywords", AppConfig.PageKey); AddMetaTag("description", string.IsNullOrEmpty(Intro) ? AppConfig.PageDescript : Intro); }
public async Task <List <Entity.Web.SystemNotice> > LoadAsync() { var client = new WebLib.NetClient(); var task = client.Create <string>(HttpMethod.Get, "https://forum.iccfish.com/forum.php?mod=rss" + (Fid > 0 ? "&fid=" + Fid : ""), ""); var result = await task.SendAsync(); if (!task.IsValid()) { return(null); } var ret = new List <SystemNotice>(); await Task.Factory.StartNew(() => { var doc = new XmlDocument(); doc.LoadXml(result); var nodes = doc.SelectNodes("//item"); foreach (var node in nodes.Cast <XmlNode>()) { var categoryName = node.SelectSingleNode("category").InnerText.Trim(); var no = new SystemNotice(node.SelectSingleNode("title").InnerText.Trim(), node.SelectSingleNode("link").InnerText.Trim(), node.SelectSingleNode("pubDate").InnerText.Trim().ToDateTimeNullable() ?? DateTime.Now, categoryName.IndexOf("新闻") > -1 || categoryName.IndexOf("公告") > -1, "作者:" + node.SelectSingleNode("author").InnerText.Trim() + "\n\n" + node.SelectSingleNode("description").InnerText.Trim() ); ret.Add(no); } }); return(ret); }