示例#1
0
 public TqRegistrationProfile SeedRegistrationData(long uln)
 {
     var profile = new TqRegistrationProfileBuilder().BuildList().FirstOrDefault(p => p.UniqueLearnerNumber == uln);
     var tqRegistrationProfile = RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile);
     DbContext.SaveChanges();
     return tqRegistrationProfile;
 }
        public TqRegistrationProfile SeedRegistrationData(long uln, TqProvider tqProvider = null, RegistrationPathwayStatus status = RegistrationPathwayStatus.Active, bool isBulkUpload = true)
        {
            var profile = new TqRegistrationProfileBuilder().BuildList().FirstOrDefault(p => p.UniqueLearnerNumber == uln);
            var tqRegistrationProfile = RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile);
            var tqRegistrationPathway = RegistrationsDataProvider.CreateTqRegistrationPathway(DbContext, tqRegistrationProfile, tqProvider ?? TqProviders.First());

            tqRegistrationPathway.IsBulkUpload = isBulkUpload;

            foreach (var specialism in TlSpecialisms)
            {
                var tqSpecialism = RegistrationsDataProvider.CreateTqRegistrationSpecialism(DbContext, tqRegistrationPathway, specialism);
                tqSpecialism.IsBulkUpload = isBulkUpload;
                tqRegistrationPathway.TqRegistrationSpecialisms.Add(tqSpecialism);
            }

            if (status == RegistrationPathwayStatus.Withdrawn)
            {
                tqRegistrationPathway.Status  = status;
                tqRegistrationPathway.EndDate = DateTime.UtcNow.AddDays(-1);

                foreach (var tqRegistrationSpecialism in tqRegistrationPathway.TqRegistrationSpecialisms)
                {
                    tqRegistrationSpecialism.IsOptedin = true;
                    tqRegistrationSpecialism.EndDate   = DateTime.UtcNow.AddDays(-1);
                }
            }

            DbContext.SaveChanges();

            return(profile);
        }
        private TqRegistrationProfile SeedRegistrationData(long uln, bool seedIndustryPlacement = false)
        {
            var profile = new TqRegistrationProfileBuilder().BuildList().FirstOrDefault(p => p.UniqueLearnerNumber == uln);
            var tqRegistrationProfile = RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile);
            var tqRegistrationPathway = RegistrationsDataProvider.CreateTqRegistrationPathway(DbContext, tqRegistrationProfile, TqProviders.First());

            tqRegistrationPathway.IsBulkUpload = false;

            if (seedIndustryPlacement)
            {
                var industryPlacement = IndustryPlacementProvider.CreateIndustryPlacement(DbContext, new IndustryPlacement {
                    Status = IndustryPlacementStatus.Completed, CreatedBy = "Test User"
                });
                tqRegistrationPathway.IndustryPlacements.Add(industryPlacement);
            }

            foreach (var specialism in Specialisms)
            {
                var specialismToAdd = RegistrationsDataProvider.CreateTqRegistrationSpecialism(DbContext, tqRegistrationPathway, specialism);
                specialismToAdd.IsBulkUpload = false;
                tqRegistrationPathway.TqRegistrationSpecialisms.Add(specialismToAdd);
            }

            DbContext.SaveChangesAsync();
            return(profile);
        }
示例#4
0
        private void SeedRegistrationData(long uln)
        {
            var profile = new TqRegistrationProfileBuilder().BuildList().FirstOrDefault(p => p.UniqueLearnerNumber == uln);
            var tqRegistrationProfile = RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile);
            var tqRegistrationPathway = RegistrationsDataProvider.CreateTqRegistrationPathway(DbContext, tqRegistrationProfile, TqProviders.First());

            DbContext.SaveChangesAsync();
        }
        public TqRegistrationProfile SeedRegistrationData(long uln, TqProvider tqProvider = null)
        {
            var profile = new TqRegistrationProfileBuilder().BuildList().FirstOrDefault(p => p.UniqueLearnerNumber == uln);
            var tqRegistrationProfile    = RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile);
            var tqRegistrationPathway    = RegistrationsDataProvider.CreateTqRegistrationPathway(DbContext, tqRegistrationProfile, tqProvider ?? TqProviders.First());
            var tqRegistrationSpecialism = RegistrationsDataProvider.CreateTqRegistrationSpecialism(DbContext, tqRegistrationPathway, TlSpecialisms.First());

            DbContext.SaveChanges();
            return(profile);
        }
示例#6
0
        public IList<TqRegistrationProfile> SeedRegistrationProfilesData(bool withLrsData = true)
        {
            var profiles = withLrsData ? new TqRegistrationProfileBuilder().BuildLrsVerificationLearningEventsList() : new TqRegistrationProfileBuilder().BuildListWithoutLrsData();

            foreach (var profile in profiles)
            {
                RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile);
            }
            DbContext.SaveChanges();
            return profiles;
        }
        private void SeedRegistrationData(long uln)
        {
            var profile = new TqRegistrationProfileBuilder().BuildList().FirstOrDefault(p => p.UniqueLearnerNumber == uln);
            var tqRegistrationProfile = RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile);
            var tqRegistrationPathway = RegistrationsDataProvider.CreateTqRegistrationPathway(DbContext, tqRegistrationProfile, TqProvider);

            foreach (var specialism in Specialisms)
            {
                tqRegistrationPathway.TqRegistrationSpecialisms.Add(RegistrationsDataProvider.CreateTqRegistrationSpecialism(DbContext, tqRegistrationPathway, specialism));
            }
            DbContext.SaveChangesAsync();
        }
示例#8
0
        private void SeedRegistrationData(long uln, RegistrationPathwayStatus status = RegistrationPathwayStatus.Active)
        {
            var profile = new TqRegistrationProfileBuilder().BuildList().FirstOrDefault(p => p.UniqueLearnerNumber == uln);
            var tqRegistrationProfile = RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile);
            var tqRegistrationPathway = RegistrationsDataProvider.CreateTqRegistrationPathway(DbContext, tqRegistrationProfile, TqProviders.First());

            if (status == RegistrationPathwayStatus.Withdrawn)
            {
                tqRegistrationPathway.Status  = status;
                tqRegistrationPathway.EndDate = DateTime.UtcNow.AddDays(-1);
            }

            DbContext.SaveChangesAsync();
        }
示例#9
0
        private void SeedRegistrationData(long uln)
        {
            _initialRegisteredTqProvider = TqProviders.First();
            var profile = new TqRegistrationProfileBuilder().BuildList().FirstOrDefault(p => p.UniqueLearnerNumber == uln);
            var tqRegistrationProfile = RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile);
            var tqRegistrationPathway = RegistrationsDataProvider.CreateTqRegistrationPathway(DbContext, tqRegistrationProfile, _initialRegisteredTqProvider);

            var specialisms = new TlSpecialismBuilder().BuildList(EnumAwardingOrganisation.Pearson, _initialRegisteredTqProvider.TqAwardingOrganisation.TlPathway);

            foreach (var specialism in specialisms)
            {
                tqRegistrationPathway.TqRegistrationSpecialisms.Add(RegistrationsDataProvider.CreateTqRegistrationSpecialism(DbContext, tqRegistrationPathway, specialism));
            }

            DbContext.SaveChangesAsync();
        }
        public TqRegistrationProfile SeedRegistrationData(long uln, RegistrationPathwayStatus status = RegistrationPathwayStatus.Active, TqProvider tqProvider = null)
        {
            var profile = new TqRegistrationProfileBuilder().BuildListWithoutLrsData().FirstOrDefault(p => p.UniqueLearnerNumber == uln);
            var tqRegistrationProfile    = RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile);
            var tqRegistrationPathway    = RegistrationsDataProvider.CreateTqRegistrationPathway(DbContext, tqRegistrationProfile, tqProvider ?? TqProviders.First());
            var tqRegistrationSpecialism = RegistrationsDataProvider.CreateTqRegistrationSpecialism(DbContext, tqRegistrationPathway, Specialism);

            if (status == RegistrationPathwayStatus.Withdrawn || status == RegistrationPathwayStatus.Transferred)
            {
                tqRegistrationPathway.Status       = status;
                tqRegistrationPathway.EndDate      = DateTime.UtcNow.AddDays(-1);
                tqRegistrationSpecialism.IsOptedin = true;
                tqRegistrationSpecialism.EndDate   = DateTime.UtcNow.AddDays(-1);
            }

            DbContext.SaveChanges();
            return(profile);
        }
        private TqRegistrationProfile SeedRegistrationData(long uln)
        {
            var profile = new TqRegistrationProfileBuilder().BuildList().FirstOrDefault(p => p.UniqueLearnerNumber == uln);
            var tqRegistrationProfile = RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile);
            var tqRegistrationPathway = RegistrationsDataProvider.CreateTqRegistrationPathway(DbContext, tqRegistrationProfile, TqProviders.First());

            tqRegistrationPathway.IsBulkUpload = false;

            foreach (var specialism in Specialisms)
            {
                var specialismToAdd = RegistrationsDataProvider.CreateTqRegistrationSpecialism(DbContext, tqRegistrationPathway, specialism);
                specialismToAdd.IsBulkUpload = false;
                tqRegistrationPathway.TqRegistrationSpecialisms.Add(specialismToAdd);
            }

            DbContext.SaveChangesAsync();
            return(profile);
        }
示例#12
0
        private List <TqRegistrationProfile> GetRegistrationsDataToProcess(List <long> ulns)
        {
            var tqRegistrationProfiles = new List <TqRegistrationProfile>();

            foreach (var(uln, index) in ulns.Select((value, i) => (value, i)))
            {
                var tqProvider            = TqProviders[index];
                var profile               = new TqRegistrationProfileBuilder().BuildList().FirstOrDefault(p => p.UniqueLearnerNumber == uln);
                var tqRegistrationProfile = RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile);
                var tqRegistrationPathway = RegistrationsDataProvider.CreateTqRegistrationPathway(DbContext, tqRegistrationProfile, tqProvider);

                tqRegistrationProfile.TqRegistrationPathways = new List <TqRegistrationPathway> {
                    tqRegistrationPathway
                };
                tqRegistrationProfiles.Add(tqRegistrationProfile);
            }
            return(tqRegistrationProfiles);
        }
        public List <TqRegistrationProfile> GetRegistrationsDataToProcess(List <long> ulns, TqProvider tqProvider = null)
        {
            var tqRegistrationProfiles = new List <TqRegistrationProfile>();

            foreach (var(uln, index) in ulns.Select((value, i) => (value, i)))
            {
                tqProvider ??= TqProviders[index];
                var profile = new TqRegistrationProfileBuilder().BuildList().FirstOrDefault(p => p.UniqueLearnerNumber == uln);
                var tqRegistrationProfile = RegistrationsDataProvider.CreateTqRegistrationProfile(DbContext, profile, false);
                var tqRegistrationPathway = RegistrationsDataProvider.CreateTqRegistrationPathway(DbContext, tqRegistrationProfile, tqProvider, false);

                foreach (var specialism in TlSpecialisms)
                {
                    tqRegistrationPathway.TqRegistrationSpecialisms.Add(RegistrationsDataProvider.CreateTqRegistrationSpecialism(DbContext, tqRegistrationPathway, specialism, addToDbContext: false));
                }

                tqRegistrationProfile.TqRegistrationPathways = new List <TqRegistrationPathway> {
                    tqRegistrationPathway
                };
                tqRegistrationProfiles.Add(tqRegistrationProfile);
            }
            return(tqRegistrationProfiles);
        }