Beispiel #1
0
        /// <summary>
        ///  Private to class method to generate course
        /// </summary>
        /// <param name="courseId">Course Id</param>
        /// <param name="userId">User Id</param>
        /// <returns>success flag for the event</returns>
        internal bool GenerateCourseFeedback(int courseId, int userId)
        {
            Course course = LearningPathDataAccessor.GetCourseWithAllData(courseId, userId);

            Feedback feedback = new Feedback
            {
                AddedBy = new User {
                    UserId = Constants.AppBotUserId
                },
                AddedFor = new User {
                    UserId = userId
                },
                FeedbackType = new Common.Entity.FeedbackType {
                    FeedbackTypeId = (int)FeedbackType.Course
                },
                FeedbackText = UtilityFunctions.GenerateHtmlForCourseFeedback(course),
                Title        = course.Name
            };

            return(AddFeedback(feedback));
        }
Beispiel #2
0
        public Course GetCourseWithAllData(int courseId, User currentUser, int userId = 0)
        {
            Course courseDetails;

            if (!currentUser.IsTrainee)
            {
                if (userId > 0)
                {
                    courseDetails = LearningPathDataAccessor.GetCourseWithAllData(courseId, userId);
                    courseDetails.TrackerDetails = LearningPathDataAccessor.GetAllCoursesForTrainee(userId).FirstOrDefault(x => x.Id == courseId);
                }
                else
                {
                    courseDetails = LearningPathDataAccessor.GetCourseWithAllData(courseId);
                }
            }
            else
            {
                courseDetails = LearningPathDataAccessor.GetCourseWithAllData(courseId, userId);
            }

            if (courseDetails != null)
            {
                User userData = UserDataAccesor.GetUserById(courseDetails.AddedBy);
                courseDetails.AuthorName   = userData.FirstName;
                courseDetails.AuthorMailId = userData.Email;

                if (currentUser.IsTrainee && !courseDetails.IsStarted)
                {
                    courseDetails.LoadAlert = true;
                    foreach (CourseSubtopic subtopic in courseDetails.CourseSubtopics)
                    {
                        subtopic.Assignments      = new Collection <Assignment>();
                        subtopic.SubtopicContents = new Collection <SubtopicContent>();
                    }
                }
            }
            return(courseDetails);
        }