Ejemplo n.º 1
0
        public bool AddNewDiscussionThreadNotification(ForumThread thread)
        {
            var notification = new Notification
            {
                Description        = thread.AddedByUser.FirstName + " " + thread.AddedByUser.LastName,
                Link               = string.Format(DiscussionPostLink, thread.AddedFor, thread.PostId),
                TypeOfNotification = NotificationType.NewDiscussionThreadNotification,
                AddedBy            = thread.AddedBy,
                Title              = "New Comment on Discussion Post",
                AddedOn            = DateTime.Now,
            };

            new MailerBl().AddNewDiscussionThreadMail(notification, thread.PostId);
            return(AddNotification(notification, UserDataAccesor.GetUserId(notification, thread.AddedFor)));
        }
Ejemplo n.º 2
0
        public bool AddNewDiscussionPostNotification(ForumPost post)
        {
            var notification = new Notification
            {
                Description        = post.AddedByUser.FirstName + " " + post.AddedByUser.LastName,
                Link               = string.Format(DiscussionPostLink, post.AddedBy, post.PostId),
                TypeOfNotification = NotificationType.NewDiscussionPostNotification,
                AddedBy            = post.AddedBy,
                Title              = "New Post in Discussion Forum",
                AddedOn            = DateTime.Now,
            };

            new MailerBl().AddNewDiscussionMail(notification);
            return(AddNotification(notification, UserDataAccesor.GetUserId(notification, post.AddedBy)));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Function which add help notification
        /// Calls AddNotification() to save in the database.
        /// </summary>
        /// <param name="forumPost">Release object</param>
        /// <param name="userId">UseId</param>
        /// <returns>Returns true if Notification is added successfully else false.</returns>
        internal bool AddHelpNotification(ForumPost forumPost, int userId)
        {
            string featureText, helpLink;

            switch (forumPost.CategoryId)
            {
            case (int)ForumUserHelpCategories.Bug:
                featureText = "New Bug Raised";
                helpLink    = string.Format(HelpLink, "Bugs");
                break;

            case (int)ForumUserHelpCategories.Help:
                featureText = "Need a Help ";
                helpLink    = string.Format(HelpLink, "Help");
                break;

            case (int)ForumUserHelpCategories.Idea:
                featureText = "New Idea for TT";
                helpLink    = string.Format(HelpLink, "Idea");
                break;

            default:
                featureText = "New Activity";
                helpLink    = string.Format(HelpLink, "");
                break;
            }

            var notification = new Notification
            {
                Description        = "",
                Link               = helpLink,
                TypeOfNotification = NotificationType.NewFeatureRequestNotification,
                AddedBy            = userId,
                Title              = featureText,
                AddedOn            = DateTime.Now,
            };

            return(AddNotification(notification, UserDataAccesor.GetUserId(notification, userId)));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Function which add user notification
        /// Calls AddNotification() to save in the database.
        /// </summary>
        /// <param name="user">Release object</param>
        /// <param name="managerId">manager Id</param>
        /// <param name="isNewUser">true if user is new</param>
        /// <returns>Returns true if Notification is added successfully else false.</returns>
        internal bool UserNotification(User user, int managerId, bool isNewUser = true)
        {
            var notificationManagementLink = "/Setting/UserSetting?settingName=Notification&user="******"New user ""{0}"" added!", user.FullName)
                                   : string.Format(@"User ""{0}"" has been activated.", user.FullName));

            var notification = new Notification
            {
                Description        = description,
                Link               = notificationManagementLink,
                TypeOfNotification = isNewUser ? NotificationType.NewUserNotification
                                                            : NotificationType.UserActivatedNotification,
                AddedBy = managerId,
                Title   = description,
                AddedOn = DateTime.Now,
            };

            return(AddNotification(notification, UserDataAccesor.GetUserId(notification, managerId)));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Add Notification for Thread
        /// </summary>
        /// <param name="thread"></param>
        internal bool AddNewThreadNotification(Threads thread)
        {
            int userId = FeedbackDataAccesor.GetTraineebyFeedbackId(thread.FeedbackId);

            if (userId == 0)
            {
                return(false);
            }

            var notification = new Notification
            {
                Description        = "New Note Added To Feedback",
                Link               = string.Format(FeedbackLink, userId, thread.FeedbackId),
                TypeOfNotification = NotificationType.NewNoteToFeedback,
                AddedBy            = thread.AddedBy.UserId,
                Title              = "New Note Added to Feedback",
                AddedOn            = DateTime.Now,
            };

            new MailerBl().AddNewFeedbackThreadMail(notification, thread.FeedbackId);
            return(AddNotification(notification, UserDataAccesor.GetUserId(notification, userId)));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Function which takes version generates notification message, list of userId, link
        /// Calls AddNotification() to save in the database.
        /// </summary>
        /// <param name="release">Release object</param>
        /// <param name="userId">UseId</param>
        /// <returns>Returns true if Notification is added successfully else false.</returns>
        internal bool AddReleaseNotification(Release release, int userId)
        {
            NotificationType notificationType;
            string           featureText;

            if (!release.IsPublished)
            {
                // This feature has gone obsolete.

                if (release.IsNew)
                {
                    notificationType = NotificationType.NewFeatureRequestNotification;
                    featureText      = "New Feature/Bug Request";
                }
                else
                {
                    notificationType = NotificationType.FeatureModifiedNotification;
                    featureText      = "Feature Details Updated";
                }
            }
            else
            {
                notificationType = NotificationType.NewReleaseNotification;
                featureText      = "New Release";
            }

            var notification = new Notification
            {
                Description        = ReleaseDescription + release.Major + "." + release.Minor + "." + release.Patch,
                Link               = string.Format(ReleaseLink, release.ReleaseId),
                TypeOfNotification = notificationType,
                AddedBy            = userId,
                Title              = featureText,
                AddedOn            = release.ReleaseDate ?? DateTime.Now,
            };

            return(AddNotification(notification, UserDataAccesor.GetUserId(notification, userId)));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Function which takes feedback data and user list to whom notification is to be added,
        /// Calls AddNotification() to save in the database.
        /// </summary>
        /// <param name="feedback">Contain Feedback object as parameter.</param>
        /// <returns>Returns a boolean value as feedback notification is added successfully or not.</returns>
        internal bool AddFeedbackNotification(Feedback feedback)
        {
            NotificationType notificationType;
            string           notificationText = string.Empty;

            switch ((FeedbackType)feedback.FeedbackType.FeedbackTypeId)
            {
            case FeedbackType.Weekly:
            {
                notificationType = NotificationType.WeeklyFeedbackNotification;
                notificationText = "New Weekly Feedback";
                break;
            }

            case FeedbackType.Comment:
            {
                notificationType = NotificationType.CommentFeedbackNotification;
                notificationText = "New Comment";
                break;
            }

            case FeedbackType.Skill:
            {
                notificationType = NotificationType.SkillFeedbackNotification;
                notificationText = "New Skill";
                break;
            }

            case FeedbackType.Assignment:
            {
                notificationType = NotificationType.AssignmentFeedbackNotification;
                notificationText = "New Assignment Feedback";
                break;
            }

            case FeedbackType.CodeReview:
            {
                notificationType = NotificationType.CodeReviewFeedbackNotification;
                notificationText = "New CR Feedback";
                break;
            }

            case FeedbackType.Course:
            {
                notificationType = NotificationType.CourseFeedbackNotification;
                notificationText = "New Course Feedback";
                break;
            }

            case FeedbackType.RandomReview:
            {
                notificationType = NotificationType.RandomReviewFeedbackNotification;
                notificationText = "New Random Review";
                break;
            }

            default:
            {
                return(false);
            }
            }

            var user = UserDataAccesor.GetUserById(feedback.AddedFor.UserId);

            var notification = new Notification
            {
                Description        = user.FirstName + " " + user.LastName,
                Link               = string.Format(FeedbackLink, feedback.AddedFor.UserId, feedback.FeedbackId),
                TypeOfNotification = notificationType,
                AddedBy            = feedback.AddedBy.UserId,
                Title              = notificationText,
                AddedOn            = DateTime.Now,
            };

            new MailerBl().AddNewFeedbackMail(notification, user, feedback.FeedbackId);
            return(AddNotification(notification, UserDataAccesor.GetUserId(notification, feedback.AddedFor.UserId)));
        }