Exemple #1
0
        private static bool NewAndPostsALot(IMember member)
        {
            var ts     = new TopicService(ApplicationContext.Current.DatabaseContext);
            var topics = ts.GetAuthorLatestTopics(member.Id);
            var topicsInHourAfterSignup     = new List <ReadOnlyTopic>();
            var topicsInFirstDayAfterSignup = new List <ReadOnlyTopic>();

            foreach (var topic in topics)
            {
                if ((topic.Created - member.CreateDate).Hours <= 1)
                {
                    topicsInHourAfterSignup.Add(topic);
                }

                if ((topic.Created - member.CreateDate).Days <= 1)
                {
                    topicsInFirstDayAfterSignup.Add(topic);
                }
            }

            if (topicsInHourAfterSignup.Count >= 3)
            {
                return(true);
            }

            if (topicsInFirstDayAfterSignup.Count >= 5)
            {
                return(true);
            }

            var cs       = new CommentService(ApplicationContext.Current.DatabaseContext, ts);
            var comments = cs.GetAllCommentsForMember(member.Id);

            var commentsInHourAfterSignup     = new List <Comment>();
            var commentsInFirstDayAfterSignup = new List <Comment>();

            foreach (var comment in comments)
            {
                if ((comment.Created - member.CreateDate).Hours <= 1)
                {
                    commentsInHourAfterSignup.Add(comment);
                }

                if ((comment.Created - member.CreateDate).Days <= 1)
                {
                    commentsInFirstDayAfterSignup.Add(comment);
                }
            }

            if (commentsInHourAfterSignup.Count >= 3)
            {
                return(true);
            }

            if (commentsInFirstDayAfterSignup.Count >= 5)
            {
                return(true);
            }

            return(false);
        }