Exemple #1
0
 public IEnumerable <InterestDto> GetAllInterestByUserId(string userId)
 {
     try
     {
         //Validate user
         if (_userRepository.IsAuthenticated(userId))
         {
             //GetUserProfile
             var interests = _interestRepository.GetAllInterestByUserId(userId);
             if (interests != null)
             {
                 //Success
                 return(interests);
             }
             _loggingService.Info("Not profile for the user found: " + userId);
         }
         _loggingService.Info("UserId Authenticated Failed: " + userId);
     }
     catch (Exception ex)
     {
         //Error
         _loggingService.Error("An error has occurred", ex);
     }
     //Fail
     return(null);
 }
Exemple #2
0
        public CvTemplateDto GetCvTemplate(string cvId)
        {
            var cvConfig = _curriculumVitaeRepository.GetCurriculumVitaeById(cvId);
            var userId   = cvConfig.UserId;
            var template = new CvTemplateDto();

            //Profile
            if (_profileRepository.GetUserProfileByUserId(userId) != null)
            {
                template.Profile = _profileRepository.GetUserProfileByUserId(userId);
            }

            //Experience
            if (_experienceRepository.GetAllExperienceByUserId(userId) != null)
            {
                template.Experiences = _experienceRepository.GetAllExperienceByUserId(userId)
                                       .Where(x => x.Id.ToString() == cvConfig.Experience1 ||
                                              x.Id.ToString() == cvConfig.Experience2);
            }

            //Course
            if (_courseRepository.GetAllCourseByUserId(userId) != null)
            {
                template.Courses = _courseRepository.GetAllCourseByUserId(userId)
                                   .Where(x => x.Id.ToString() == cvConfig.Course1 ||
                                          x.Id.ToString() == cvConfig.Course2);
            }

            //Skill
            if (_skillRepository.GetAllSkillByUserId(userId) != null)
            {
                template.Skills = _skillRepository.GetAllSkillByUserId(userId).Take(10);
            }


            //Award
            if (_awardRepository.GetAllAwardByUserId(userId) != null)
            {
                template.Awards = _awardRepository.GetAllAwardByUserId(userId).Take(5);
            }

            //Interest
            if (_interestRepository.GetAllInterestByUserId(userId) != null)
            {
                template.Interests = _interestRepository.GetAllInterestByUserId(userId).Take(5);
            }

            //Project
            if (_projectRepository.GetAllProjectByUserId(userId) != null)
            {
                template.Projects = _projectRepository.GetAllProjectByUserId(userId).Take(5);
            }


            //Portfolio

            //if (_portfolioRepository.GetAllProjectByUserId(userId) != null)
            //{
            //    template.Projects = _projectRepository.GetAllProjectByUserId(userId).Take(5);
            //}

            //overview.PortfolioCount = 0;


            return(template);
        }
Exemple #3
0
        public PortalOverviewDto GetPortalOverview(string userId)
        {
            var overview = new PortalOverviewDto();

            //Profile
            if (_profileRepository.GetUserProfileByUserId(userId) != null)
            {
                overview.Profile      = _profileRepository.GetUserProfileByUserId(userId);
                overview.ProfileCount = 1;
            }
            else
            {
                overview.ProfileCount = 0;
            }

            //Experience
            if (_experienceRepository.GetAllExperienceByUserId(userId) != null)
            {
                var query = _experienceRepository.GetAllExperienceByUserId(userId).ToList();
                overview.ExperienceCount  = query.Count();
                overview.LatestExperience = query.OrderByDescending(m => m.CreateDate).FirstOrDefault();
            }
            else
            {
                overview.ExperienceCount = 0;
            }


            //Course
            if (_courseRepository.GetAllCourseByUserId(userId) != null)
            {
                var query = _courseRepository.GetAllCourseByUserId(userId).ToList();
                overview.CourseCount  = query.Count();
                overview.LatestCourse = query.OrderByDescending(m => m.CreateDate).FirstOrDefault();
            }
            else
            {
                overview.CourseCount = 0;
            }

            //Skill
            if (_skillRepository.GetAllSkillByUserId(userId) != null)
            {
                var query = _skillRepository.GetAllSkillByUserId(userId).ToList();
                overview.SkillCount  = query.Count();
                overview.LatestSkill = query.OrderByDescending(m => m.CreateDate).FirstOrDefault();
            }
            else
            {
                overview.SkillCount = 0;
            }

            //Award
            if (_awardRepository.GetAllAwardByUserId(userId) != null)
            {
                var query = _awardRepository.GetAllAwardByUserId(userId).ToList();
                overview.AwardCount  = query.Count();
                overview.LatestAward = query.OrderByDescending(m => m.CreateDate).FirstOrDefault();
            }
            else
            {
                overview.AwardCount = 0;
            }


            //Interest
            if (_interestRepository.GetAllInterestByUserId(userId) != null)
            {
                var query = _interestRepository.GetAllInterestByUserId(userId).ToList();
                overview.InterestCount  = query.Count();
                overview.LatestInterest = query.OrderByDescending(m => m.CreateDate).FirstOrDefault();
            }
            else
            {
                overview.InterestCount = 0;
            }


            //Project
            if (_projectRepository.GetAllProjectByUserId(userId) != null)
            {
                var query = _projectRepository.GetAllProjectByUserId(userId).ToList();
                overview.ProjectCount  = query.Count();
                overview.LatestProject = query.OrderByDescending(m => m.CreateDate).FirstOrDefault();
            }
            else
            {
                overview.ProjectCount = 0;
            }

            //CV
            if (_curriculumVitaeService.GetAllCurriculumVitaeByUserId(userId) != null)
            {
                var query = _curriculumVitaeService.GetAllCurriculumVitaeByUserId(userId).ToList();
                overview.CvCount  = query.Count();
                overview.LatestCv = query.OrderByDescending(m => m.CreateDate).FirstOrDefault();
            }
            else
            {
                overview.CvCount = 0;
            }

            //PortFolio
            if (_portfolioService.GetPortfolioByUserId(userId) != null)
            {
                overview.PortfolioCount  = 1;
                overview.LatestPortfolio = _portfolioService.GetPortfolioByUserId(userId);
            }
            else
            {
                overview.PortfolioCount = 0;
            }


            return(overview);
        }
        public GradFolioDto GetPortfolioByRefNum(long refId)
        {
            try
            {
                var portfolio = _portfolioRepository.GetPortfolioByRefNum(refId);
                var userId    = portfolio.UserId;


                var template = new GradFolioDto();


                //Profile
                if (_profileRepository.GetUserProfileByUserId(userId) != null)
                {
                    template.Profile = _profileRepository.GetUserProfileByUserId(userId);
                }

                //Experience
                if (_experienceRepository.GetAllExperienceByUserId(userId) != null)
                {
                    template.Experiences = _experienceRepository.GetAllExperienceByUserId(userId);
                }

                //Course
                if (_courseRepository.GetAllCourseByUserId(userId) != null)
                {
                    template.Courses = _courseRepository.GetAllCourseByUserId(userId);
                }

                //Skill
                if (_skillRepository.GetAllSkillByUserId(userId) != null)
                {
                    template.Skills = _skillRepository.GetAllSkillByUserId(userId);
                }


                //Award
                if (_awardRepository.GetAllAwardByUserId(userId) != null)
                {
                    template.Awards = _awardRepository.GetAllAwardByUserId(userId);
                }

                //Interest
                if (_interestRepository.GetAllInterestByUserId(userId) != null)
                {
                    template.Interests = _interestRepository.GetAllInterestByUserId(userId);
                }

                //Project
                if (_projectRepository.GetAllProjectByUserId(userId) != null)
                {
                    template.Projects = _projectRepository.GetAllProjectByUserId(userId);
                }

                //CV
                if (_curriculumVitaeRepository.GetAllCurriculumVitaeByUserId(userId) != null)
                {
                    template.CurriculumVitae = _curriculumVitaeRepository.GetAllCurriculumVitaeByUserId(userId).First();
                }

                return(template);
            }
            catch (Exception ex)
            {
                //Error
                _loggingService.Error("An error has occurred", ex);
            }
            //Fail
            return(null);
        }