Example #1
0
        /// <summary>
        /// Fetches all feedback Threads
        /// </summary>
        /// <param name="feedbackId">feedbackId</param>
        /// <param name="currentUser">current user</param>
        public List <Threads> GetFeedbackThreads(int feedbackId, User currentUser)
        {
            int feedbackForUserId = FeedbackDataAccesor.GetTraineebyFeedbackId(feedbackId);

            if (!(currentUser.IsAdministrator || currentUser.IsManager || currentUser.IsTrainer || currentUser.UserId == feedbackForUserId))
            {
                return(null);
            }

            return(FeedbackDataAccesor.GetFeedbackThreads(feedbackId));
        }
Example #2
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)));
        }