Beispiel #1
0
        private Image GetRecentTopicIcon(Enumerators.PostStatus tStatus, int tReplies)
        {
            var image = new Image { ID = "postIcon" };

            switch (tStatus)
            {
                case Enumerators.PostStatus.Closed:
                    image.SkinID = "FolderNewLocked";

                    break;
                default:
                    image.SkinID = "FolderNew";
                    if (tReplies > Config.HotTopicNum)
                        image.SkinID = "FolderNewHot";
                    break;
            }
            image.GenerateEmptyAlternateText = true;
            image.ApplyStyleSheetSkin(Page);
            return image;
        }
Beispiel #2
0
        private static void SendSubscriptions(Enumerators.Subscription subType, TopicInfo topic, ReplyInfo reply,HttpContext context)
        {
            int replyid = -1;
            int authorid = topic.AuthorId;
            int[] memberids = { };
            StringBuilder Message = new StringBuilder("<html><body>Hello {0}");
            string strSubject = String.Empty;
            HttpContext.Current = context;
            if (reply != null)
            {
                replyid = reply.Id;
                authorid = reply.AuthorId;
            }
            Message.Append("<br/><p>");

            ISubscription dal = Factory<ISubscription>.Create("Subscription");
            switch (subType)
            {
                case Enumerators.Subscription.ForumSubscription:

                    memberids = dal.GetForumSubscriptionList(topic.ForumId);

                    if (memberids.Length > 0)
                    {
                        strSubject = Config.ForumTitle.Replace("&trade;", "").Replace("&copy;", "") + " - New posting";

                        Message.AppendFormat(
                            "{0} has posted to the forum {1} at {2} that you requested notification on.",
                            topic.AuthorName, topic.Forum.Subject, Config.ForumTitle);
                    }
                    break;
                case Enumerators.Subscription.TopicSubscription:

                    memberids = dal.GetTopicSubscriptionList(topic.Id);

                    if (memberids.Length > 0)
                    {
                        strSubject = Config.ForumTitle.Replace("&trade;", "").Replace("&copy;", "") + " - Reply to a posting";
                        Message.AppendFormat("{0} has replied to a topic on <b>{1}</b> that you requested notification to.", reply.AuthorName, Config.ForumTitle);
                    }

                    break;
            }
            Message.AppendFormat(" Regarding the subject - {0}.", topic.Subject);
            Message.Append("<br/>");
            Message.Append("<br/>");
            Message.AppendFormat("You can view the posting <a href=\"{0}Content/Forums/topic.aspx?whichpage=-1&TOPIC={1}", Config.ForumUrl, topic.Id);
            if (replyid > 0)
                Message.AppendFormat("#{0}", replyid);
            Message.Append("\">here</a>");
            Message.Append("</p></body></html>");
            foreach (int id in memberids)
            {
                MemberInfo member = Members.GetMember(id);
                //don't send the author notification of their own posts
                if (id == authorid)
                    continue;
                SnitzEmail email = new SnitzEmail
                {
                    subject = strSubject,
                    msgBody = String.Format(Message.ToString(), member.Username),
                    toUser = new MailAddress(member.Email, member.Username),
                    IsHtml = true,
                    FromUser = "******"
                };
                email.Send();
            }
        }
 private static Image GetForumIcon(string username, DateTime lasthere, Enumerators.PostStatus fStatus, DateTime? tLastPost)
 {
     var image = new Image {ID = "imgTopicIcon", EnableViewState = false, SkinID = "FolderNew"};
     string imagedir = Config.ImageDirectory;
     switch (fStatus)
     {
         case Enumerators.PostStatus.Open:
             image.AlternateText = webResources.lblOldPosts;
             image.SkinID = "Folder";
             image.ImageUrl = imagedir + "/folders/foldernoposts.png";
             if (username != "")
                 if (tLastPost > lasthere)
                 {
                     image.SkinID = "FolderNew";
                     image.ImageUrl = imagedir + "/folders/foldernewposts.png";
                     image.AlternateText = webResources.lblNewPosts;
                 }
             break;
         default:
             image.SkinID = "FolderLocked";
             image.ImageUrl = imagedir + "/folders/folder_locked.png";
             image.AlternateText = webResources.lblLockedForum;
             break;
     }
     return image;
 }