public IList<Core.Business.Messages> GetAllMessages() { IList<Core.Business.Messages> messageslist = new List<Core.Business.Messages>(); SqlServerUtility sql = new SqlServerUtility(connectionString); SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllMessages); if (reader != null) { while (reader.Read()) { Core.Business.Messages messages = new Core.Business.Messages(); if (!reader.IsDBNull(0)) messages.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) messages.Content = reader.GetString(1); if (!reader.IsDBNull(2)) messages.Type = reader.GetInt32(2); if (!reader.IsDBNull(3)) messages.DateCreated = reader.GetDateTime(3); if (!reader.IsDBNull(4)) messages.SendDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) messages.IsRead = reader.GetInt32(5); if (!reader.IsDBNull(6)) messages.AuthorId = reader.GetInt64(6); if (!reader.IsDBNull(7)) messages.AccountId = reader.GetInt64(7); if (!reader.IsDBNull(8)) messages.Title = reader.GetString(8); if (!reader.IsDBNull(9)) messages.Attachments = reader.GetString(9); if (!reader.IsDBNull(10)) messages.AuthorName = reader.GetString(10); if (!reader.IsDBNull(11)) messages.AccountName = reader.GetString(11); messages.MarkOld(); messageslist.Add(messages); } reader.Close(); } return messageslist; }
//根据作者Id,类型,是否已读查询邮件 public IList<Core.Business.Messages> GetMessagesByAccountIdOrAuthorId(CY.UME.Core.Business.Messages messages, PagingInfo pageInfo, String Sorts) { IList<Core.Business.Messages> messageslist = new List<Core.Business.Messages>(); SqlServerUtility sql = new SqlServerUtility(connectionString); string filter = SetStrFilter(messages); if (Sorts.Length <= 0) Sorts = "Id DESC"; sql.AddParameter("@PageNumber", SqlDbType.Int, pageInfo.CurrentPage); sql.AddParameter("@PageSize", SqlDbType.Int, pageInfo.PageSize); sql.AddParameter("@Tables", SqlDbType.NVarChar, "Messages"); sql.AddParameter("@PK", SqlDbType.NVarChar, "Id"); sql.AddParameter("@Sort", SqlDbType.NVarChar, Sorts); sql.AddParameter("@Fields", SqlDbType.NVarChar, "[Id],[Content],[Type],[DateCreated],[SendDate],[IsRead],[AuthorId],[AccountId],[Title],[Attachments],[AuthorName],[AccountName]"); sql.AddParameter("@Filter", SqlDbType.NVarChar, filter); SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount"); if (reader != null) { while (reader.Read()) { Core.Business.Messages message = new Core.Business.Messages(); if (!reader.IsDBNull(0)) message.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) message.Content = reader.GetString(1); if (!reader.IsDBNull(2)) message.Type = reader.GetInt32(2); if (!reader.IsDBNull(3)) message.DateCreated = reader.GetDateTime(3); if (!reader.IsDBNull(4)) message.SendDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) message.IsRead = reader.GetInt32(5); if (!reader.IsDBNull(6)) message.AuthorId = reader.GetInt64(6); if (!reader.IsDBNull(7)) message.AccountId = reader.GetInt64(7); if (!reader.IsDBNull(8)) message.Title = reader.GetString(8); if (!reader.IsDBNull(9)) message.Attachments = reader.GetString(9); if (!reader.IsDBNull(10)) message.AuthorName = reader.GetString(10); if (!reader.IsDBNull(11)) message.AccountName = reader.GetString(11); message.MarkOld(); messageslist.Add(message); } reader.Close(); } return messageslist; }
public Core.Business.Messages Select(Int64 id) { SqlServerUtility sql = new SqlServerUtility(connectionString); sql.AddParameter("@Id", SqlDbType.BigInt, id); SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectMessages); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.Messages messages = new Core.Business.Messages(); if (!reader.IsDBNull(0)) messages.Id = reader.GetInt64(0); if (!reader.IsDBNull(1)) messages.Content = reader.GetString(1); if (!reader.IsDBNull(2)) messages.Type = reader.GetInt32(2); if (!reader.IsDBNull(3)) messages.DateCreated = reader.GetDateTime(3); if (!reader.IsDBNull(4)) messages.SendDate = reader.GetDateTime(4); if (!reader.IsDBNull(5)) messages.IsRead = reader.GetInt32(5); if (!reader.IsDBNull(6)) messages.AuthorId = reader.GetInt64(6); if (!reader.IsDBNull(7)) messages.AccountId = reader.GetInt64(7); if (!reader.IsDBNull(8)) messages.Title = reader.GetString(8); if (!reader.IsDBNull(9)) messages.Attachments = reader.GetString(9); if (!reader.IsDBNull(10)) messages.AuthorName = reader.GetString(10); if (!reader.IsDBNull(11)) messages.AccountName = reader.GetString(11); reader.Close(); return messages; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
protected void SendMessage_Click(object sender, EventArgs e) { long msgId = 0; if (!long.TryParse(HF_MsgId.Value, out msgId)) { LblReplyMsg.Text = "请刷新页面"; return; } CY.UME.Core.Business.Messages message = CY.UME.Core.Business.Messages.Load(msgId); if (message == null) { LblReplyMsg.Text = "请刷新页面"; return; } string Title = "回复:" + LblTitle.Text; string Content = TxtContent.InnerText; if (Title.Trim().Length <= 0) { Title = "来自" + CurrentAccount.Name + "的Me邮"; } CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(message.AuthorId); if (account == null) { LblReplyMsg.Text = "回复用户不存在"; return; } //接收者的信息 CY.UME.Core.Business.Messages message1 = new Core.Business.Messages(); message1.AuthorId = CurrentAccount.Id; message1.AuthorName = CurrentAccount.Name; message1.AccountId = account.Id; message1.AccountName = account.Name; message1.Title = Title; message1.Content = Content; message1.Type = 2; message1.DateCreated = message1.SendDate = DateTime.Now; message1.IsRead = 0; message1.Save(); //发送者的信息 CY.UME.Core.Business.Messages message2 = new Core.Business.Messages(); message2.AuthorId = CurrentAccount.Id; message2.AuthorName = CurrentAccount.Name; message2.AccountId = account.Id; message2.AccountName = account.Name; message2.Title = Title; message2.Content = Content; message2.Type = 1; message2.DateCreated = message2.SendDate = DateTime.Now; message2.IsRead = 0; message2.Save(); base.ShowAlert("提示", "邮件发送成功!<span>3</span>秒后将自动跳转。", true, "Index.aspx", true); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; string PageSizeStr = context.Request.QueryString["pagesize"]; string CurrentPageStr = context.Request.QueryString["currentpage"]; string LoadType = context.Request.QueryString["type"]; string IsReadStr = context.Request.QueryString["isread"]; int CurrentPage = 1; int PageSize = 0; int IsRead = 2; if (!int.TryParse(PageSizeStr, out PageSize) || !int.TryParse(CurrentPageStr, out CurrentPage)) { context.Response.Write("{success:false,msg:'参数错误。'}"); return; } try { CY.UME.Core.Business.Account CurrentAccount = CY.UME.Core.Global.GetCurrentAccount(); if (CurrentAccount == null) { context.Response.Write("{success:false,msg:'用户登录超时,请重新登录!'}"); return; } CY.UME.Core.PagingInfo pageinfo = new Core.PagingInfo { CurrentPage = CurrentPage, PageSize = PageSize }; CY.UME.Core.Business.Messages message = new Core.Business.Messages(); int Type = 0; if (String.IsNullOrEmpty(LoadType) || !int.TryParse(LoadType, out Type)) { message.Type = 2;//收件 message.AccountId = CurrentAccount.Id; } else { if (Type == 2) { message.Type = 2;//收件 message.AccountId = CurrentAccount.Id; } if (Type == 1) {//发件 message.AuthorId = CurrentAccount.Id; } if (Type == 3 || Type == 4) {//草稿或已删除 message.AccountId = CurrentAccount.Id; } } if (int.TryParse(IsReadStr, out IsRead) && IsRead != 2) message.IsRead = 0;//未读邮件 message.Type = Type; CY.UME.Web.Message.Index index = new Web.Message.Index(); context.Response.Write("{success:true,html:'" + index.BindMessages(message, pageinfo) + "'}"); } catch { context.Response.Write("{success:false,msg:'服务器忙,请稍后重试。'}"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CY.UME.Core.PagingInfo pageInfo = new Core.PagingInfo { CurrentPage = 1, PageSize = CY.Utility.Common.ConvertUtility.ConvertToInt(HF_PageSize.Value, 10) }; string LoadType = Request.QueryString["t"]; int Type = 0; CY.UME.Core.Business.Messages message = new Core.Business.Messages(); //收件、发件、草稿、已删除、通知(或许) if (String.IsNullOrEmpty(LoadType) || !int.TryParse(LoadType, out Type)) { Type = 2;//收件 message.AccountId = CurrentAccount.Id; Tab.Index = 0; } else { if (Type == 2) {//收件 message.AccountId = CurrentAccount.Id; Tab.Index = 0; } if (Type == 1) {//发件 message.AuthorId = CurrentAccount.Id; LblDescription.Text = "收件人"; Tab.Index = 1; } if (Type == 3 || Type == 4) {//草稿或已删除 message.AccountId = CurrentAccount.Id; message.AuthorId = CurrentAccount.Id; Tab.Index = 3; } if (Type == 4) {//已删除 Tab.Index = 2; } } message.Type = Type; HF_LoadType.Value = Type.ToString(); if (Request.QueryString["i"] != null) HF_Select_Index.Value = Request.QueryString["i"]; //总条数 Total = CY.UME.Core.Business.Messages.GetMessagesNumberByAccountIdOrAuthorId(message); if (Request.QueryString["ir"] != null) {//未读邮件 message.IsRead = 0; HF_IsRead.Value = "0"; } LblMessageList.Text = BindMessages(message, pageInfo); HF_TotalRecords.Value = CY.UME.Core.Business.Messages.GetMessagesNumberByAccountIdOrAuthorId(message).ToString();//筛选后的总数,用于分页 //未读邮件数量 if (message.Type == 2) {//收件里面的未读邮件 message.IsRead = 0; UnRead = CY.UME.Core.Business.Messages.GetMessageUnReadAndReadTotalByAccountIdAndType(message); MsgNumInfo = "<a href=\"?t=2&ir=0\" title=\"只显示未读邮件\"><b>" + UnRead + "封未读</b></a><span> / 共" + Total + "封</span>"; } HF_SiteUrl.Value = SiteUrl; } }
protected void SendMessage_Click(object sender, EventArgs e) { string[] AccountArray = HF_StrId.Value.Split(','); string Title = string.Empty; if (TxtTitle.Text.Trim().Length > 499) Title = TxtTitle.Text.Substring(0, 499); else Title = TxtTitle.Text; string Content = TxtContent.InnerText; if (Title.Trim().Length <= 0) { Title = "来自" + CurrentAccount.Name + "的Me邮"; } foreach (string AccountStrId in AccountArray) { long AccountId = 0; if (!long.TryParse(AccountStrId, out AccountId)) continue; CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(AccountId); if (account == null) continue; //接收者的信息 CY.UME.Core.Business.Messages message1 = new Core.Business.Messages(); message1.AuthorId = CurrentAccount.Id; message1.AuthorName = CurrentAccount.Name; message1.AccountId = account.Id; message1.AccountName = account.Name; message1.Title = Title; message1.Content = Content; message1.Type = 2; message1.DateCreated = message1.SendDate = DateTime.Now; message1.IsRead = 0; message1.Save(); //发送者的信息 CY.UME.Core.Business.Messages message2 = new Core.Business.Messages(); message2.AuthorId = CurrentAccount.Id; message2.AuthorName = CurrentAccount.Name; message2.AccountId = account.Id; message2.AccountName = account.Name; message2.Title = Title; message2.Content = Content; message2.Type = 1; message2.DateCreated = message2.SendDate = DateTime.Now; message2.IsRead = 0; message2.Save(); ////AsynResult为实现了IAsyncResult接口的类,当不调用cb回调函数时,该请求不会返回到客户端,会一直处于连接等待状态(不同于轮询) //CY.UME.Core.Business.AsynResult asynResult = new CY.UME.Core.Business.AsynResult(context, cb, extraData); //String content = context.Request.Params["content"]; //String accountId = context.Request.Params["accountId"]; ////向Message类中添加该消息 //CY.UME.Core.Business.CometMessage.Instance().AddMessage(content, asynResult, accountId); } string AlertScript = ""; AlertScript += "var html = '<table align=\"center\" cellpadding=\"0\" cellspacing=\"0\" width=\"95%\"><tr><td align=\"right\"><img src=\"" + SiteUrl + "/Theme/V3/images/successful.jpg\" /></td><td>邮件发送成功!<span>3</span>秒后自动跳转。</td></tr></table>';"; AlertScript += "ShowMsgBOx($(SetMsgBoxHTML('提示', html, 450, false)));"; AlertScript += "var s = parseInt($('.window_td7').find('span').html());"; AlertScript += "var c = setInterval(function () { if (s <= 0) { window.location.href = 'Index.aspx'; }else{$('.window_td7').find('span').html(s -= 1);} }, 1000);"; AlertScript += "$('.window_a11_save_button').click(function () { window.location.href = 'Index.aspx'; });"; AlertScript += "$('.window_a13_cancel_button').click(function () { clearInterval(c); });"; base.ExecuteClientScript(AlertScript); //Page.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alert('添加成功');window.location.href=" + url + ";</script>"); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; CY.UME.Core.Business.Account CurrentAccount = CY.UME.Core.Global.GetCurrentAccount(); if (CurrentAccount == null) { context.Response.Write("{success:false,msg:'用户未登录。'}"); return; } string SiteUrl = CY.UME.Core.Global.GetSiteUrl(); StringBuilder sb = new StringBuilder(); CY.UME.Core.Business.Messages message = new Core.Business.Messages(); message.Type = 2;//收件 message.IsRead = 0; message.AccountId = CurrentAccount.Id; //收件箱里面未读的数量 int MyMailNum = CY.UME.Core.Business.Messages.GetMessagesNumberByAccountIdOrAuthorId(message); int MessageNum = 0; CY.UME.Core.PagingInfo pageInfo = new Core.PagingInfo { CurrentPage = 1, PageSize = int.MaxValue }; CY.UME.Web.Message.ReplyTips ReplyTips = new Web.Message.ReplyTips(); List<CY.UME.Core.Business.Notice> NoticeList = ReplyTips.GetNoticeList(pageInfo); StringBuilder SBLeaveMessage = new StringBuilder(); StringBuilder SBGroupAndActive = new StringBuilder(); StringBuilder SBApplication = new StringBuilder(); if (NoticeList != null && NoticeList.Count > 0) { for (int i = 0; i < NoticeList.Count; i++) { switch (NoticeList[i].Type) { case "friend": //sb.Append("{Count:'" + NoticeList[i].Id + "',Type:'" + NoticeList[i].Type + "'"); if (NoticeList[i].InstanceId.Length > 0) { long accountId; if (CY.Utility.Common.ParseUtility.TryParseInt64(NoticeList[i].InstanceId, out accountId)) { CY.UME.Core.Business.Account account = CY.UME.Core.Business.Account.Load(accountId); if (account == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } SBApplication.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBApplication.Append("你收到<span class=\"msg_color\">" + NoticeList[i].Num + "条</span>好友请求"); SBApplication.Append("<a target=\"_blank\" href=\"javascript:void(0);\" class=\"confirm\">查看</a>"); SBApplication.Append("</li>"); MessageNum++; } } break; case "groupinvite": //sb.Append("{Count:'" + NoticeList[i].Id + "',InstanceId:'" + NoticeList[i].InstanceId + "',Type:'" + NoticeList[i].Type + "'"); if (NoticeList[i].InstanceId.Length > 0) { int groupinviteId = 0; int.TryParse(NoticeList[i].InstanceId, out groupinviteId); CY.UME.Core.Business.Group GroupInviteGroup = CY.UME.Core.Business.Group.Load(groupinviteId); if (GroupInviteGroup == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } SBGroupAndActive.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBGroupAndActive.Append("你收到<span class=\"msg_color\">" + NoticeList[i].Num + "条</span>群组邀请"); SBGroupAndActive.Append("<a target=\"_blank\" href=\"javascript:void(0);\" class=\"confirm\">查看</a>"); SBGroupAndActive.Append("</li>"); MessageNum++; } break; case "activeInviteFriend": //sb.Append("{Count:'" + NoticeList[i].Id + "',InstanceId:'" + NoticeList[i].InstanceId + "',Type:'" + NoticeList[i].Type + "'"); if (NoticeList[i].InstanceId.Length > 0) { int activeInviteFriendId = 0; int.TryParse(NoticeList[i].InstanceId, out activeInviteFriendId); CY.UME.Core.Business.Activities active = CY.UME.Core.Business.Activities.Load(activeInviteFriendId); if (active == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } SBGroupAndActive.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBGroupAndActive.Append("你收到<span class=\"msg_color\">" + NoticeList[i].Num + "条</span>活动邀请"); SBGroupAndActive.Append("<a target=\"_blank\" href=\"javascript:void(0);\" class=\"confirm\">查看</a>"); SBGroupAndActive.Append("</li>"); MessageNum++; } break; case "info": //sb.Append("{Count:'" + NoticeList[i].Id + "',Type:'" + NoticeList[i].Type + "'"); SBApplication.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBApplication.Append("你收到<span class=\"msg_color\">" + NoticeList[i].Num + "条</span>留言"); SBApplication.Append("<a target=\"_blank\" href=\"" + SiteUrl + "/Home.aspx#msg\" class=\"confirm\">查看</a>"); SBApplication.Append("</li>"); MessageNum++; break; //case "inforeply": // long inforId; // if (CY.Utility.Common.ParseUtility.TryParseInt64(NoticeList[i].InstanceId, out inforId)) // { // CY.UME.Core.Business.SpaceComment spacecomm = CY.UME.Core.Business.SpaceComment.Load(inforId); // CY.UME.Core.Business.SpaceComment spacecomm2 = CY.UME.Core.Business.SpaceComment.Load(spacecomm.ReferedId); // if (spacecomm2 == null) // { // NoticeList[i].DeleteOnSave(); // NoticeList[i].Save(); // continue; // } // else // { // sb.Append("{Count:'" + NoticeList[i].Id + "',InstanceId:'" + NoticeList[i].InstanceId + "',Type:'" + NoticeList[i].Type + "'"); // sb.Append(",SpaceComment:'"); // sb.Append(CY.Utility.Common.StringUtility.EscapeString( // CY.Utility.Common.StringUtility.CutString(spacecomm2.Content, 25, "..."))); // sb.Append("',SpaceOwerId:'"); // sb.Append(spacecomm2.AccountId); // sb.Append("'"); //MessageNum++; // } // } // break; case "blogreply": long blogId; if (CY.Utility.Common.ParseUtility.TryParseInt64(NoticeList[i].InstanceId, out blogId)) { CY.UME.Core.Business.Blog blog = CY.UME.Core.Business.Blog.Load(blogId); if (blog == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } SBLeaveMessage.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBLeaveMessage.Append("你收到<span class=\"msg_color\">" + NoticeList[i].Num + "条</span>日志的回复"); SBLeaveMessage.Append("</li>"); MessageNum++; } break; case "miniblogreply": if (NoticeList[i].InstanceId.Length > 0) { long miniblogId; if (CY.Utility.Common.ParseUtility.TryParseInt64(NoticeList[i].InstanceId, out miniblogId)) { CY.UME.Core.Business.MiniBlog miniblog = CY.UME.Core.Business.MiniBlog.Load(miniblogId); if (miniblog == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } SBLeaveMessage.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBLeaveMessage.Append("你收到<span class=\"msg_color\">" + NoticeList[i].Num + "条</span> <a target=\"_blank\" href=\"" + SiteUrl + "/MiniBlogList.aspx?SpaceId=" + miniblog.AccountId + "&MiniBlogId=" + miniblog.Id + "\">"); SBLeaveMessage.Append(CY.Utility.Common.StringUtility.CutString(miniblog.Content, 10, "...")); SBLeaveMessage.Append("</a> 微博的回复"); SBLeaveMessage.Append("</li>"); MessageNum++; } } break; case "picreply": long picId; if (CY.Utility.Common.ParseUtility.TryParseInt64(NoticeList[i].InstanceId, out picId)) { CY.UME.Core.Business.Picture pic = CY.UME.Core.Business.Picture.Load(picId); if (pic == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } CY.UME.Core.Business.Album album = CY.UME.Core.Business.Album.Load(pic.AlbumId); if (album == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } SBLeaveMessage.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBLeaveMessage.Append("你收到<span class=\"msg_color\">" + NoticeList[i].Num + "条</span> <a target=\"_blank\" href=\"" + SiteUrl + "/Album/PictureDetailInfo.aspx?pictureId=" + pic.Id + "\">"); SBLeaveMessage.Append(CY.Utility.Common.StringUtility.CutString(pic.Name, 10, "...")); SBLeaveMessage.Append("</a> 图片的回复"); SBLeaveMessage.Append("</li>"); MessageNum++; } break; case "topicreply": if (NoticeList[i].InstanceId.Length > 0) { Guid topicId = new Guid(NoticeList[i].InstanceId); CY.UME.Core.Business.Topic topic = CY.UME.Core.Business.Topic.Load(topicId); CY.UME.Core.Business.TopicExtend topicex = CY.UME.Core.Business.TopicExtend.Load(topicId); CY.UME.Core.Business.Group TopicReplyGroup = CY.UME.Core.Business.Group.Load(int.Parse(topicex.InstanceId)); if (topic == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } SBLeaveMessage.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBLeaveMessage.Append("你收到<span class=\"msg_color\">" + NoticeList[i].Num + "条</span> <a target=\"_blank\" href=\"" + SiteUrl + "/Group/TopicDetailInfo.aspx?TopicId=" + topic.Id + "\">"); SBLeaveMessage.Append(CY.Utility.Common.StringUtility.CutString(topic.Title, 10, "...")); SBLeaveMessage.Append("</a> 群组话题的回复"); SBLeaveMessage.Append("</li>"); MessageNum++; } break; case "groupinforeply": if (NoticeList[i].InstanceId.Length > 0) { int groupinfoId = 0; if (!int.TryParse(NoticeList[i].InstanceId, out groupinfoId)) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } CY.UME.Core.Business.Group groupInfo = CY.UME.Core.Business.Group.Load(groupinfoId); if (groupInfo == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } SBLeaveMessage.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBLeaveMessage.Append("你收到<span class=\"msg_color\">" + NoticeList[i].Num + "条</span> 来自“"); SBLeaveMessage.Append("<a target=\"_blank\" href=\"" + SiteUrl + "/Group/Group.aspx?groupId=" + groupinfoId + "\">"); SBLeaveMessage.Append(CY.Utility.Common.StringUtility.CutString(groupInfo.Name, 10, "...")); SBLeaveMessage.Append("” </a>群组留言的回复"); SBLeaveMessage.Append("</li>"); MessageNum++; } break; case "activitesinforeply": if (NoticeList[i].InstanceId.Length > 0) { int activeId = 0; if (!int.TryParse(NoticeList[i].InstanceId, out activeId)) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } CY.UME.Core.Business.Activities ActivitesInfoReply = CY.UME.Core.Business.Activities.Load(activeId); if (ActivitesInfoReply == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } SBLeaveMessage.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBLeaveMessage.Append("你收到<span class=\"msg_color\">" + NoticeList[i].Num + "条</span> “"); SBLeaveMessage.Append("<a target=\"_blank\" href=\"" + SiteUrl + "/Activities/ActiveDetail2.aspx?aid=" + ActivitesInfoReply + "\">"); SBLeaveMessage.Append(CY.Utility.Common.StringUtility.CutString(ActivitesInfoReply.Name, 10, "...")); SBLeaveMessage.Append("” </a>活动的回复"); SBLeaveMessage.Append("</li>"); MessageNum++; } break; case "activeTopicReply": if (NoticeList[i].InstanceId.Length > 0) { Guid topicId = new Guid(); topicId = new Guid(NoticeList[i].InstanceId.ToString()); CY.UME.Core.Business.Topic topic = CY.UME.Core.Business.Topic.Load(topicId); if (topic == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } CY.UME.Core.Business.TopicExtend te = CY.UME.Core.Business.TopicExtend.Load(topicId); if (te == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } CY.UME.Core.Business.Activities active = CY.UME.Core.Business.Activities.Load(int.Parse(te.InstanceId)); if (active == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } SBLeaveMessage.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBLeaveMessage.Append("你收到<span class=\"msg_color\">" + NoticeList[i].Num + "条 <a target=\"_blank\" href=\"" + SiteUrl + "/Group/TopicDetailInfo.aspx?TopicId=" + topic.Id + "\">"); SBLeaveMessage.Append(CY.Utility.Common.StringUtility.CutString(topic.Title, 10, "...")); SBLeaveMessage.Append("</a> 活动话题的回复"); SBLeaveMessage.Append("</li>"); MessageNum++; } break; case "activeCheck": if (NoticeList[i].InstanceId.Length > 0) { int id = CY.Utility.Common.ConvertUtility.ConvertToInt(NoticeList[i].InstanceId, 0); CY.UME.Core.Business.Activities active = CY.UME.Core.Business.Activities.Load(id); if (active == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } SBLeaveMessage.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBLeaveMessage.Append("你的“"); SBLeaveMessage.Append("<a target=\"_blank\" class=\"a_tag\" title=\"" + active.Name + "\" href=\"" + SiteUrl + "/Activities/ActiveDetail2.aspx?aid=" + active.Id + "\">"); SBLeaveMessage.Append(CY.Utility.Common.StringUtility.CutString(active.Name, 16, "...")); SBLeaveMessage.Append("</a>”活动已经通过管理员审核"); SBLeaveMessage.Append("<a href=\"javascript:void(0);\" class=\"confirm\">忽略</a>"); SBLeaveMessage.Append("</li>"); MessageNum++; } break; case "activeCheckNo": if (NoticeList[i].InstanceId.Length > 0) { int id = CY.Utility.Common.ConvertUtility.ConvertToInt(NoticeList[i].InstanceId, 0); CY.UME.Core.Business.Activities active = CY.UME.Core.Business.Activities.Load(id); if (active == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } //sb.Append("{Count:1,InstanceId:'" + NoticeList[i].InstanceId + "'"); //sb.Append(",Type:'" + NoticeList[i].Type + "'"); //sb.Append(",activeId:" + active.Id); //sb.Append(",activeName:'" + CY.Utility.Common.StringUtility.EscapeString(active.Name) + "'"); //sb.Append(",content:'" + CY.Utility.Common.StringUtility.EscapeString(NoticeList[i].Content) + "'"); MessageNum++; } break; case "relativegroup"://友情小组 if (NoticeList[i].InstanceId.Length > 0) { Guid id = new Guid(NoticeList[i].InstanceId); CY.UME.Core.Business.RelativeGroup rg = CY.UME.Core.Business.RelativeGroup.Load(id); if (rg == null || rg.IsChecked) continue; CY.UME.Core.Business.Group group = CY.UME.Core.Business.Group.Load(rg.GroupId); CY.UME.Core.Business.Group relativeGroup = CY.UME.Core.Business.Group.Load(rg.RelativeGroupId); if (group == null || relativeGroup == null) { NoticeList[i].DeleteOnSave(); NoticeList[i].Save(); continue; } SBGroupAndActive.Append("<li InstanceId=\"" + NoticeList[i].InstanceId + "\" Type=\"" + NoticeList[i].Type + "\">"); SBGroupAndActive.Append("你收到<span class=\"msg_color\">" + NoticeList[i].Num + "条</span>友情小组邀请"); SBGroupAndActive.Append("<a target=\"_blank\" href=\"javascript:void(0);\" class=\"confirm\">查看</a>"); SBGroupAndActive.Append("</li>"); MessageNum++; } break; } } } else { } //CY.Utility.Common.StringUtility.EscapeString( context.Response.Write("{success:true,html:'"); if (SBLeaveMessage.Length > 0) context.Response.Write("<ul>" + SBLeaveMessage.ToString() + "</ul>"); if (SBGroupAndActive.Length > 0) context.Response.Write("<ul>" + SBGroupAndActive.ToString() + "</ul>"); if (SBApplication.Length > 0) context.Response.Write("<ul>" + SBApplication.ToString() + "</ul>"); context.Response.Write("',mailnum:'" + MyMailNum + "',msgnum:'" + MessageNum + "'}"); }