Beispiel #1
0
 public InternalMetadataRepository(IEssContextFactory essContextFactory, IMapper mapper)
 {
     this.mapper     = mapper;
     this.essContext = essContextFactory.CreateReadOnly();
 }
 public SupplierRepository(IEssContextFactory essContextFactory, IMapper mapper)
 {
     this.essContextFactory = essContextFactory;
     this.mapper            = mapper;
 }
Beispiel #3
0
 public CacheUpdater(ILogger <CacheUpdater> logger, ICache cache, IEssContextFactory essContextFactory, IMapper mapper)
 {
     this.logger             = logger;
     this.cache              = cache;
     this.metadataRepository = new InternalMetadataRepository(essContextFactory, mapper);
 }
 public EvacuationRepository(IEssContextFactory essContextFactory, IMapper mapper)
 {
     this.essContext        = essContextFactory.Create();
     this.essContextFactory = essContextFactory;
     this.mapper            = mapper;
 }
Beispiel #5
0
 public DynamicSchemasVersionInformationProvider(IEssContextFactory essContextFactory)
 {
     this.essContextFactory = essContextFactory;
 }
Beispiel #6
0
 public SearchEngine(IEssContextFactory essContextFactory)
 {
     this.essContextFactory = essContextFactory;
 }
Beispiel #7
0
 public ReportRepository(IEssContextFactory essContextFactory, IMapper mapper)
 {
     this.readCtx = essContextFactory.CreateReadOnly();
     this.mapper  = mapper;
 }
Beispiel #8
0
 public SearchEngine(IEssContextFactory essContextFactory)
 {
     this.essContext = essContextFactory.CreateReadOnly();
 }
Beispiel #9
0
        public DynamicsTestData(IEssContextFactory essContextFactory)
        {
            var essContext = essContextFactory.Create();

            jurisdictions = essContext.era_jurisdictions.OrderBy(j => j.era_jurisdictionid).ToArray();
            canada        = essContext.era_countries.Where(c => c.era_countrycode == "CAN").Single();
            bc            = essContext.era_provinceterritorieses.Where(c => c.era_code == "BC").Single();
#if DEBUG
            this.testPrefix = $"autotest-dev";
#else
            this.testPrefix = $"autotest-{TestHelper.GenerateNewUniqueId(string.Empty)}";
#endif
            this.activeTaskId   = testPrefix + "-active-task";
            this.inactiveTaskId = testPrefix + "-inactive-task";

            var existingTeam = essContext.era_essteams.Where(t => t.era_name == testPrefix + "-team").SingleOrDefault();
            if (existingTeam != null)
            {
                essContext.LoadProperty(existingTeam, nameof(era_essteam.era_ESSTeam_ESSTeamArea_ESSTeamID));
                this.testTeam = existingTeam;

                this.CreateTeamMember(essContext, testTeam, Guid.NewGuid(), "-second");
                CreateTeamMember(essContext, testTeam, Guid.NewGuid(), "-third");
                CreateTeamMember(essContext, testTeam, Guid.NewGuid(), "-fourth");
            }
            else
            {
                this.testTeam = CreateTeam(essContext, Guid.NewGuid());
            }
            var otherTeam = essContext.era_essteams.Where(t => t.era_name == testPrefix + "-team-other").SingleOrDefault();
            if (otherTeam != null)
            {
                essContext.LoadProperty(otherTeam, nameof(era_essteam.era_ESSTeam_ESSTeamArea_ESSTeamID));
                this.otherTestTeam = otherTeam;
            }
            else
            {
                this.otherTestTeam = CreateTeam(essContext, Guid.NewGuid(), "-other");
            }

            this.activeTask = essContext.era_tasks.Where(t => t.era_name == activeTaskId).SingleOrDefault() ?? CreateTask(essContext, activeTaskId, DateTime.UtcNow);

            this.inactiveTask = essContext.era_tasks.Where(t => t.era_name == activeTaskId).SingleOrDefault() ?? CreateTask(essContext, inactiveTaskId, DateTime.UtcNow.AddDays(-7));

            this.tier4TeamMember = essContext.era_essteamusers.Where(tu => tu.era_firstname == this.testPrefix + "-first" && tu.era_lastname == this.testPrefix + "-last").SingleOrDefault()
                                   ?? CreateTeamMember(essContext, testTeam, Guid.NewGuid());

            this.otherTeamMember = essContext.era_essteamusers.Where(tu => tu.era_firstname == this.testPrefix + "-first-other" && tu.era_lastname == this.testPrefix + "-last-other").SingleOrDefault()
                                   ?? CreateTeamMember(essContext, this.otherTestTeam, Guid.NewGuid(), "-other", EMBC.ESS.Resources.Teams.TeamUserRoleOptionSet.Tier1);

            this.testContact = essContext.contacts.Where(c => c.firstname == this.testPrefix + "-first" && c.lastname == this.testPrefix + "-last").SingleOrDefault() ?? CreateContact(essContext);

            this.supplierA        = essContext.era_suppliers.Where(c => c.era_name == testPrefix + "-supplier-A").SingleOrDefault() ?? CreateSupplier(essContext, "A", this.testTeam);
            this.supplierB        = essContext.era_suppliers.Where(c => c.era_name == testPrefix + "-supplier-B").SingleOrDefault() ?? CreateSupplier(essContext, "B", this.testTeam);
            this.supplierC        = essContext.era_suppliers.Where(c => c.era_name == testPrefix + "-supplier-C").SingleOrDefault() ?? CreateSupplier(essContext, "C", this.otherTestTeam);
            this.inactiveSupplier = essContext.era_suppliers.Where(c => c.era_name == testPrefix + "-supplier-inactive").SingleOrDefault() ?? CreateSupplier(essContext, "inactive", null);

            var evacuationfile = essContext.era_evacuationfiles
                                 .Expand(f => f.era_CurrentNeedsAssessmentid)
                                 .Expand(f => f.era_Registrant)
                                 .Where(f => f.era_name == testPrefix + "-digital").SingleOrDefault();

            if (evacuationfile == null)
            {
                evacuationfile = CreateEvacuationFile(essContext, this.testContact, testPrefix + "-digital");
            }
            else
            {
                essContext.LoadProperty(evacuationfile, nameof(era_evacuationfile.era_era_evacuationfile_era_householdmember_EvacuationFileid));
                CreateEvacueeSupports(essContext, evacuationfile, this.testContact, this.tier4TeamMember, testPrefix);
            }

            var paperEvacuationfile = essContext.era_evacuationfiles
                                      .Expand(f => f.era_CurrentNeedsAssessmentid)
                                      .Expand(f => f.era_Registrant)
                                      .Where(f => f.era_name == testPrefix + "-paper").SingleOrDefault();

            if (paperEvacuationfile == null)
            {
                paperEvacuationfile = CreateEvacuationFile(essContext, this.testContact, testPrefix + "-paper", testPrefix + "-paper");
                CreateEvacueeSupports(essContext, paperEvacuationfile, this.testContact, this.tier4TeamMember, testPrefix);
            }
            else
            {
                essContext.LoadProperty(paperEvacuationfile, nameof(era_evacuationfile.era_era_evacuationfile_era_householdmember_EvacuationFileid));
            }

            essContext.SaveChanges();

            essContext.DeactivateObject(this.inactiveSupplier, 2);
            essContext.SaveChanges();
            essContext.DetachAll();

            this.testEvacuationfile = essContext.era_evacuationfiles
                                      .Expand(f => f.era_CurrentNeedsAssessmentid)
                                      .Expand(f => f.era_Registrant)
                                      .Where(f => f.era_evacuationfileid == evacuationfile.era_evacuationfileid).Single();

            essContext.LoadProperty(this.testEvacuationfile, nameof(era_evacuationfile.era_era_evacuationfile_era_evacueesupport_ESSFileId));
            essContext.LoadProperty(this.testEvacuationfile, nameof(era_evacuationfile.era_era_evacuationfile_era_householdmember_EvacuationFileid));

            this.testPaperEvacuationFile = essContext.era_evacuationfiles
                                           .Expand(f => f.era_CurrentNeedsAssessmentid)
                                           .Expand(f => f.era_Registrant)
                                           .Where(f => f.era_evacuationfileid == paperEvacuationfile.era_evacuationfileid).Single();

            essContext.LoadProperty(this.testPaperEvacuationFile, nameof(era_evacuationfile.era_era_evacuationfile_era_evacueesupport_ESSFileId));
            essContext.LoadProperty(this.testPaperEvacuationFile, nameof(era_evacuationfile.era_era_evacuationfile_era_householdmember_EvacuationFileid));

            essContext.DetachAll();
            this.essContextFactory = essContextFactory;
        }
Beispiel #10
0
 public TaskRepository(IEssContextFactory essContextFactory, IMapper mapper, ICache cache)
 {
     this.essContext = essContextFactory.CreateReadOnly();
     this.mapper     = mapper;
     this.cache      = cache;
 }
 public DuplicateSupportComplianceCheck(IEssContextFactory essContextFactory)
 {
     this.essContextFactory = essContextFactory;
 }
Beispiel #12
0
 public MetadataRepository(IEssContextFactory essContextFactory, IMapper mapper, ICache cache)
 {
     this.internalRepository = new InternalMetadataRepository(essContextFactory, mapper);
     this.cache = cache;
 }
 public CasSystemConfigurationProvider(IEssContextFactory essContextFactory, ICache cache)
 {
     this.essContextFactory = essContextFactory;
     this.cache             = cache;
 }
Beispiel #14
0
 public PaymentRepository(IMapper mapper, IEssContextFactory essContextFactory, ICasGateway casGateway)
 {
     this.mapper            = mapper;
     this.essContextFactory = essContextFactory;
     this.casGateway        = casGateway;
 }