private static async Task newVersionRepo()
        {
            Microsoft.Extensions.Configuration.IConfiguration configuration = new ConfigurationBuilder()
                                                                              .SetBasePath(Directory.GetCurrentDirectory())
                                                                              .AddJsonFile("appsettings.json").Build();
            var cfg = new MapperConfigurationExpression();

            cfg.AddProfile <SimsDbMappingProfile>();
            var mapperConfig = new MapperConfiguration(cfg);
            var mapper       = new Mapper(mapperConfig);

            var connection       = configuration.GetConnectionString("migrateSims");
            var dbContextBuilder = new DbContextOptionsBuilder <SimsDbContext>()
                                   .UseSqlServer(connection);

            using (var ctx = new SimsDbContext(dbContextBuilder.Options))
            {
                var host = SimsDbHost.CreateHost(ctx, mapper, "Paul Lawrence");

                var incidentLinks = new IncidentLinkedRecords(ctx, mapper);
                //var signalLinks = new SignalsLinkedRecords(ctx, mapper);
                var signalLinks = host.Signals.Links;
                var Iitems      = await incidentLinks.Add(5, new int[] { 8, 10 }, "Money");

                var items = await signalLinks.Add(1, new int[] { 2 }, "");
            }
        }
Beispiel #2
0
 public IncidentNotesRepository(SimsDbContext ctx, IMapper mapper, SimsDbHost simsHost)
 {
     this.ctx = ctx;
     this.mapper = mapper;
     this.simsHost = simsHost;
     this.incidentNotes = new NotesRepository<IncidentNoteDb>(ctx, mapper);
 }
Beispiel #3
0
 public ProductRepository(SimsDbContext ctx, IMapper mapper)
 {
     this.ctx        = ctx;
     this.DbSet      = ctx.Set <T>();
     this.DbSetDates = ctx.Set <Date>();
     this.mapper     = mapper;
 }
Beispiel #4
0
 public SimsManangement(SimsDbContext ctx, IMapper mapper, ISIMSAttachmentHost attachments, string userId, ILoggerFactory logging)
 {
     // unsure about this tbh....
     this.SimsDbHost  = FSA.SIMSManagerDb.Repositories.SimsDbHost.CreateHost(ctx, mapper, userId);
     this.attachments = attachments;
     this.logging     = logging;
 }
Beispiel #5
0
        private async Task CreateIncidents(ISimsDbHost sims, SimsDbContext ctx, SeedingConfigData seeder)
        {
            var iManager = sims.Incidents;
            List <Task <BaseIncident> > TaskList = new List <Task <BaseIncident> >();
            await iManager.Add(seeder.GetNewIncidents());

            var coreIncident = seeder.GetNewIncidents().ElementAt(0);
            var newBatch     = new List <BaseIncident>();

            for (var x = 0; x < 9000 / 20; ++x)
            {
                foreach (var title in this.titleList)
                {
                    var newIncident = coreIncident.WithTitle($"{title}-{x}")
                                      .WithStatus((int)SimsIncidentStatusTypes.Unassigned)
                                      .WithLeadOfficer("");
                    newBatch.Add(newIncident);
                }
            }

            var numbersTest = coreIncident.WithTitle("Number Searching Test Incident 1234 1234.5678 RIM2021.123 RIM2021-123 (1234)")
                              .WithStatus((int)SimsIncidentStatusTypes.Unassigned)
                              .WithLeadOfficer("");

            newBatch.Add(numbersTest);
            await iManager.Add(newBatch);
        }
Beispiel #6
0
 public LinkedRecordsRepository(SimsDbContext ctx, IMapper mapper, Func <int, string> publicIdGenerator)
 {
     this.ctx               = ctx;
     this.LinkSet           = ctx.Set <LinkDb>();
     this.NoteSet           = ctx.Set <NoteDb>();
     this.mapper            = mapper;
     this.publicIdGenerator = publicIdGenerator;
 }
Beispiel #7
0
 internal SimsDbHost(SimsDbContext ctx, IMapper mapper)
 {
     this.ctx         = ctx;
     this.mapper      = mapper;
     this.Incidents   = new IncidentsRepository(ctx, mapper);
     this.Signals     = new SignalsRepository(ctx, mapper);
     this.Audit       = new UserAuditLoggerRepository(ctx);
     this.Addresses   = new AddressRepository(ctx, mapper);
     this.Lookups     = new LookupHost(ctx, mapper);
     this.OnlineForms = new OnlineFormRepository(ctx, mapper);
 }
 public SignalsRepository(SimsDbContext ctx, IMapper mapper)
 {
     this.ctx    = ctx;
     this.mapper = mapper;
 }
Beispiel #9
0
 public AttachmentsRepository(SimsDbContext ctx, IMapper mapper)
 {
     this.DbSet  = ctx.Set <AttachmentDb>();
     this.ctx    = ctx;
     this.mapper = mapper;
 }
Beispiel #10
0
 public OnlineFormRepository(SimsDbContext ctx, IMapper mapper)
 {
     this.ctx    = ctx;
     this.mapper = mapper;
 }
Beispiel #11
0
 public SignalNotesRepository(SimsDbContext ctx, IMapper mapper)
 {
     this.ctx         = ctx;
     this.SignalNotes = new NotesRepository <SignalNoteDb>(ctx, mapper);
 }
Beispiel #12
0
 internal ReferenceDataRepo(SimsDbContext ctx, Func <SimsDbContext, List <Db> > customFetch, Func <Db, T> toClient) : this(ctx, toClient)
 {
     this._customFetch = customFetch;
 }
Beispiel #13
0
 internal ReferenceDataRepo(SimsDbContext ctx, Func <Db, T> toClient)
 {
     this.ctx      = ctx;
     this.toClient = toClient;
 }
Beispiel #14
0
 internal ReferenceDataRepo(SimsDbContext ctx, Func <SimsDbContext, Task <List <Db> > > customAsyncFetch, Mapper mapper) : this(ctx, mapper)
 {
     this._customAsyncFetch = customAsyncFetch;
 }
Beispiel #15
0
 internal ReferenceDataRepo(SimsDbContext ctx, IMapper mapper)
 {
     this.ctx      = ctx;
     this.toClient = (itm) => mapper.Map <Db, T>(itm);
 }
Beispiel #16
0
 public StakeholdersRepository(SimsDbContext ctx, IMapper mapper)
 {
     this.ctx    = ctx;
     this.DbSet  = ctx.Set <T>();
     this.mapper = mapper;
 }
Beispiel #17
0
 public static ISimsDbHost CreateHost(SimsDbContext ctx, IMapper mapper, string userId)
 {
     ctx.SetEditor(userId);
     return(new SimsDbHost(ctx, mapper));
 }
Beispiel #18
0
 public NotesRepository(SimsDbContext ctx, IMapper mapper)
 {
     this.ctx     = ctx;
     this.NoteSet = ctx.Set <NoteDb>();
     this.mapper  = mapper;
 }
 public AddressRepository(SimsDbContext ctx, IMapper mapper)
 {
     this.ctx    = ctx;
     this.mapper = mapper;
 }
 public ProductFboRepository(SimsDbContext ctx, IMapper mapper)
 {
     this.ctx    = ctx;
     this.DbSet  = ctx.Set <ProductFBO>();
     this.mapper = mapper;
 }
 public IncidentsRepository(SimsDbContext ctx, IMapper mapper)
 {
     this.ctx    = ctx;
     this.mapper = mapper;
 }
 public UserAuditLoggerRepository(SimsDbContext ctx)
 {
     this.ctx = ctx;
 }
 public LookupHost(SimsDbContext ctx, IMapper mapper)
 {
     this.ctx    = ctx;
     this.mapper = mapper;
 }