public async Task <IDictionary <int, string> > GetComponentTypesAsync(LarsContext context)
 {
     return(await context.LarsApprenticeshipComponentTypeLookups
            .ToDictionaryAsync(
                ct => ct.ApprenticeshipComponentType,
                ct => ct.ApprenticeshipComponentTypeDesc));
 }
 public async Task <IDictionary <string, string> > GetIssuingAuthoritiesAsync(LarsContext context)
 {
     return(await context.LarsIssuingAuthorityLookups
            .ToDictionaryAsync(
                ia => ia.IssuingAuthority.ToString(), // field is different type between tables...
                ia => ia.IssuingAuthorityDesc,
                StringComparer.OrdinalIgnoreCase));
 }
示例#3
0
 public async Task <IDictionary <string, string> > GetAwardingOrgNamesAsync(LarsContext context)
 {
     return(await context.LarsAwardOrgCodeLookups
            .ToDictionaryAsync(
                ab => ab.AwardOrgCode,
                ab => ab.AwardOrgName,
                StringComparer.OrdinalIgnoreCase));
 }
        private IQueryable <LarsFrameworkAim> GetQuerable(LarsContext context, bool units)
        {
            var frameworkQuerable = context.LarsFrameworkAims.AsQueryable();

            if (units)
            {
                return(frameworkQuerable.Where(fa => fa.LearnAimRefNavigation.LearnAimRefType == UnitLearnAimRefType));
            }

            return(frameworkQuerable = frameworkQuerable.Where(fa => fa.LearnAimRefNavigation.LearnAimRefType != UnitLearnAimRefType));
        }
        public async Task <ILookup <string, CommonComponentModel> > GetStandardCommonComponents(LarsContext context)
        {
            var results = await context.LarsStandardCommonComponents.Select(c => new
            {
                Id = c.StandardCode.ToString(),
                c.CommonComponent,
                c.EffectiveFrom,
                c.EffectiveTo,
                c.MinLevel
            }).ToListAsync();

            return(results.ToLookup(c => c.Id, c => new CommonComponentModel
            {
                CommonComponent = c.CommonComponent,
                EffectiveFrom = c.EffectiveFrom,
                EffectiveTo = c.EffectiveTo,
                MinLevel = c.MinLevel
            }));
        }
        public async Task <ILookup <string, CommonComponentModel> > GetFrameworkCommonComponents(LarsContext context)
        {
            var results = await context.LarsFrameworkCmnComps.Select(c => new
            {
                // Please note this must match the FrameworkID generated on initial population
                Id = string.Concat(c.FworkCode, "-", c.ProgType, "-", c.PwayCode),
                c.CommonComponent,
                c.EffectiveFrom,
                c.EffectiveTo,
                c.MinLevel
            }).ToListAsync();

            return(results.ToLookup(c => c.Id, c => new CommonComponentModel
            {
                CommonComponent = c.CommonComponent,
                EffectiveFrom = c.EffectiveFrom,
                EffectiveTo = c.EffectiveTo,
                MinLevel = c.MinLevel
            }));
        }
        public async Task <ILookup <string, RelatedLearningAimModel> > GetFrameworkRelatedLearningAims(LarsContext context)
        {
            var results = await context.LarsFrameworkAims
                          .Where(fa => fa.LearnAimRefNavigation.LearnAimRefType != UnitLearnAimRefType)
                          .Select(fa => new
            {
                // Please note this must match the FrameworkID generated on initial population
                Id = string.Concat(fa.FworkCode, "-", fa.ProgType, "-", fa.PwayCode),
                fa.LearnAimRef,
                fa.LearnAimRefNavigation.LearnAimRefTitle,
                fa.LearnAimRefNavigation.AwardOrgCode,
                fa.LearnAimRefNavigation.NotionalNvqlevelv2,
                fa.EffectiveFrom,
                fa.EffectiveTo,
                ComponentType = fa.FrameworkComponentType,
            }).ToListAsync();

            return(results.ToLookup(sa => sa.Id, sa => new RelatedLearningAimModel
            {
                LearnAimRef = sa.LearnAimRef,
                LearningAimTitle = sa.LearnAimRefTitle,
                AwardingBodyCode = sa.AwardOrgCode,
                Level = sa.NotionalNvqlevelv2,
                EffectiveFrom = sa.EffectiveFrom,
                EffectiveTo = sa.EffectiveTo,
                ComponentType = sa.ComponentType
            }));
        }
        public async Task <ILookup <string, RelatedLearningAimModel> > GetStandardRelatedLearningAims(LarsContext context)
        {
            var results = await context.LarsStandardAims.Select(sa => new
            {
                sa.StandardCode,
                sa.LearnAimRef,
                sa.LearnAimRefNavigation.LearnAimRefTitle,
                sa.LearnAimRefNavigation.AwardOrgCode,
                sa.LearnAimRefNavigation.NotionalNvqlevelv2,
                sa.EffectiveFrom,
                sa.EffectiveTo,
                sa.StandardComponentType
            }).ToListAsync();

            return(results.ToLookup(sa => sa.StandardCode.ToString(), sa => new RelatedLearningAimModel
            {
                LearnAimRef = sa.LearnAimRef,
                LearningAimTitle = sa.LearnAimRefTitle,
                AwardingBodyCode = sa.AwardOrgCode,
                Level = sa.NotionalNvqlevelv2,
                EffectiveFrom = sa.EffectiveFrom,
                EffectiveTo = sa.EffectiveTo,
                ComponentType = sa.StandardComponentType
            }));
        }
        public async Task <IDictionary <string, List <EntitlementCategoryModel> > > GetEntitlementCategoriesAsync(LarsContext context)
        {
            var categories = await context.LarsAnnualValues
                             .Select(av => new EntitlementCategoryModel
            {
                LearnAimRef          = av.LearnAimRef,
                EffectiveFrom        = av.EffectiveFrom,
                EffectiveTo          = av.EffectiveTo,
                Category2Description =
                    av.FullLevel2EntitlementCategoryNavigation.FullLevel2EntitlementCategoryDesc,
                Category3Description =
                    av.FullLevel3EntitlementCategoryNavigation.FullLevel3EntitlementCategoryDesc
            })
                             .ToListAsync();

            return(categories
                   .GroupBy(gb => gb.LearnAimRef, StringComparer.OrdinalIgnoreCase)
                   .ToDictionary(av => av.Key, em => em.ToList(), StringComparer.OrdinalIgnoreCase));
        }
示例#10
0
        public async Task <IDictionary <string, List <FundingModel> > > GetFundingsAsync(LarsContext context)
        {
            var fundingList = await context.LarsFundings
                              .Select(lf => new FundingModel
            {
                LearnAimRef                = lf.LearnAimRef,
                EffectiveFrom              = lf.EffectiveFrom,
                EffectiveTo                = lf.EffectiveTo,
                FundingCategory            = lf.FundingCategory,
                FundingCategoryDescription = lf.FundingCategoryNavigation.FundingCategoryDesc2,
                RateWeighted               = lf.RateWeighted.ToString(),
                RateUnWeighted             = lf.RateUnWeighted.ToString(),
                WeightingFactor            = lf.WeightingFactor
            })
                              .ToListAsync();

            return(fundingList
                   .GroupBy(l => l.LearnAimRef, StringComparer.OrdinalIgnoreCase)
                   .ToDictionary(k => k.Key, v => v.ToList(), StringComparer.OrdinalIgnoreCase));
        }
        public async Task <IDictionary <string, List <LearningAimFrameworkModel> > > GetLearningAimFrameworkAimsAsync(LarsContext context, bool units)
        {
            var frameworkQuerable = GetQuerable(context, units);

            var frameworks = await frameworkQuerable.Select(fa => new LearningAimFrameworkModel
            {
                LearnAimRef      = fa.LearnAimRef,
                LearningAimTitle = fa.LearnAimRefNavigation.LearnAimRefTitle,
                FrameworkTitle   = fa.LarsFramework.IssuingAuthorityTitle,
                FrameworkCode    = fa.FworkCode,
                PathwayCode      = fa.PwayCode,
                ProgramType      = fa.ProgType,
                EffectiveFrom    = fa.LarsFramework.EffectiveFrom,
                EffectiveTo      = fa.LarsFramework.EffectiveTo,
                PathwayName      = fa.LarsFramework.PathwayName,
                ProgramTypeDesc  = fa.LarsFramework.ProgTypeNavigation.ProgTypeDesc,
                IssuingAuthority = fa.LarsFramework.IssuingAuthority,
                ComponentType    = fa.FrameworkComponentType
            })
                             .ToListAsync();

            return(frameworks
                   .GroupBy(gb => gb.LearnAimRef, StringComparer.OrdinalIgnoreCase)
                   .ToDictionary(av => av.Key, g => g.ToList(), StringComparer.OrdinalIgnoreCase));
        }
示例#12
0
        public async Task <IDictionary <string, List <ValidityModel> > > GetValiditiesAsync(LarsContext context)
        {
            var validities = await context.LarsValidities
                             .Select(lv => new ValidityModel
            {
                LearnAimRef                 = lv.LearnAimRef,
                StartDate                   = lv.StartDate,
                EndDate                     = lv.EndDate,
                LastNewStartDate            = lv.LastNewStartDate,
                ValidityCategory            = lv.ValidityCategory.ToUpper(),
                ValidityCategoryDescription = lv.ValidityCategoryNavigation.ValidityCategoryDesc2
            })
                             .ToListAsync();

            return(validities
                   .GroupBy(l => l.LearnAimRef, StringComparer.OrdinalIgnoreCase)
                   .ToDictionary(k => k.Key, v => v.ToList(), StringComparer.OrdinalIgnoreCase));
        }
示例#13
0
        public async Task <IDictionary <string, List <CategoryModel> > > GetLearningDeliveryCategoriesAsync(LarsContext context)
        {
            var catergoryList = await context.LarsLearningDeliveryCategories.Select(cat => new CategoryModel
            {
                LearnAimRef       = cat.LearnAimRef,
                Reference         = cat.CategoryRef,
                EffectiveTo       = cat.EffectiveTo,
                EffectiveFrom     = cat.EffectiveFrom,
                Title             = cat.CategoryRefNavigation.CategoryName,
                Description       = cat.CategoryRefNavigation.CategoryName,
                ParentReference   = cat.CategoryRefNavigation.ParentCategoryRef,
                ParentDescription = context.LarsCategoryLookups
                                    .Where(l => l.CategoryRef == cat.CategoryRefNavigation.ParentCategoryRef)
                                    .Select(l => l.CategoryName)
                                    .FirstOrDefault()
            })
                                .ToListAsync();

            return(catergoryList
                   .GroupBy(l => l.LearnAimRef, StringComparer.OrdinalIgnoreCase)
                   .ToDictionary(k => k.Key, v => v.ToList(), StringComparer.OrdinalIgnoreCase));
        }
 public async Task <IDictionary <int, CommonComponentLookupModel> > GetCommonComponentLookupsAsync(LarsContext context)
 {
     return(await context.LarsCommonComponentLookups
            .ToDictionaryAsync(k => k.CommonComponent, v => new CommonComponentLookupModel
     {
         CommonComponent = v.CommonComponent,
         Description = v.CommonComponentDesc
     }));
 }
示例#15
0
 public async Task<IDictionary<string, string>> GetStandardSectorCodeDescriptionsAsync(LarsContext context)
 {
     return await context.LarsStandardSectorCodeLookups
         .ToDictionaryAsync(
             lookup => lookup.StandardSectorCode,
             ab => ab.StandardSectorCodeDesc2,
             StringComparer.OrdinalIgnoreCase);
 }