/// <summary> /// Gets a query of the people completing the program. /// </summary> /// <returns></returns> public IQueryable <PersonStepProgramViewModel> GetPersonCompletingProgramQuery(int stepProgramId) { var stepProgram = StepProgramCache.Get(stepProgramId); if (stepProgram == null) { return(null); } var rockContext = Context as RockContext; var stepProgramCompletionService = new StepProgramCompletionService(rockContext); // Start with all the completed steps to try to narrow the set var completedStepQuery = stepProgramCompletionService.Queryable() .AsNoTracking() .Where(s => s.StepProgramId == stepProgram.Id); var personQuery = completedStepQuery .Select(g => new PersonStepProgramViewModel { PersonId = g.PersonAlias.PersonId, StartedDateTime = g.StartDateTime, CompletedDateTime = g.EndDateTime }); return(personQuery); }
/// <summary> /// Gets the step program cache. /// </summary> /// <param name="achievementTypeCache">The achievement type cache.</param> /// <returns></returns> private StepProgramCache GetStepProgramCache(AchievementTypeCache achievementTypeCache) { var guid = GetStepProgramGuid(achievementTypeCache); return(guid.HasValue ? StepProgramCache.Get(guid.Value) : null); }
/// <summary> /// Updates any Cache Objects that are associated with this entity /// </summary> /// <param name="entityState">State of the entity.</param> /// <param name="dbContext">The database context.</param> public void UpdateCache(EntityState entityState, Rock.Data.DbContext dbContext) { StepProgramCache.UpdateCachedEntity(Id, entityState); }
/// <summary> /// Gets the cache object associated with this Entity /// </summary> /// <returns></returns> public IEntityCache GetCacheObject() { return(StepProgramCache.Get(Id)); }