public int GetMatching(ISkillSetModel <T> skillSet) { double result = 1; if (_pattern.Skills.Count() != 0) { result = (double)_pattern.Skills .Intersect(skillSet.Skills) .Count() / _pattern.Skills.Count(); } result *= PERCENT_DIVIDER; result = Math.Round(result, MidpointRounding.AwayFromZero); return((int)result); }
/// <summary> /// Deletes the skill set view. /// </summary> /// <param name="skillSetInfo">The skill set information.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">skillSetInfo</exception> public ISkillSetModelView DeleteSkillSetView(ISkillSetModel skillSetInfo, string URL) { if (skillSetInfo == null) { throw new ArgumentNullException(nameof(skillSetInfo)); } var skillSetView = new SkillSetModelView { SkillId = skillSetInfo.SkillId, SkillName = skillSetInfo.SkillName, SkillDescription = skillSetInfo.SkillDescription, EmployeeId = skillSetInfo.EmployeeId, IsActive = skillSetInfo.IsActive, DateCreated = skillSetInfo.DateCreated, URL = URL }; return(skillSetView); }
/// <summary> /// Edits the skill set view. /// </summary> /// <param name="skillSetInfo">The skill set information.</param> /// <param name="experienceCollection"></param> /// <returns></returns> /// <exception cref="ArgumentNullException">skillSetInfo</exception> public ISkillSetModelView EditSkillSetView(ISkillSetModel skillSetInfo, string URL, IList <IExperience> experienceCollection) { if (skillSetInfo == null) { throw new ArgumentNullException(nameof(skillSetInfo)); } var experienceDDL = GetDropDownList.ExperienceListItem(experienceCollection, skillSetInfo.Experience ?? -1); var skillSetView = new SkillSetModelView { SkillId = skillSetInfo.SkillId, SkillName = skillSetInfo.SkillName, SkillDescription = skillSetInfo.SkillDescription, EmployeeId = skillSetInfo.EmployeeId, IsActive = skillSetInfo.IsActive, DateCreated = skillSetInfo.DateCreated, Experience = skillSetInfo.Experience, ExperienceDropDown = experienceDDL, URL = URL, }; return(skillSetView); }
public IEnumerable <ISkillSetWithRatingModel <T> > GetMatchingModels( ISkillSetModel <T> pattern, IEnumerable <ISkillSetModel <T> > matchingItems, int threshold, int take) { if (pattern == null) { throw new ArgumentNullException(nameof(pattern)); } IMatchingGetter <T> matchingGetter = new MatchingGetter <T>(pattern); return(matchingItems .AsParallel() .Select(s => new SkillSetWithRatingModel <T>() { Id = s.Id, Skills = s.Skills, Rating = matchingGetter.GetMatching(s) }) .Where(s => s.Rating >= threshold) .Take(take) .OrderByDescending(m => m.Rating)); }
public MatchingGetter(ISkillSetModel <T> pattern) { _pattern = pattern; }