public async Task <TeamQueryResponse> QueryTeams(TeamQuery query) { var context = essContextFactory.CreateReadOnly(); var teams = (await QueryTeams(context, query)).Concat(await QueryTeamAreas(context, query)).ToArray(); foreach (var team in teams) { context.AttachTo(nameof(EssContext.era_essteams), team); await context.LoadPropertyAsync(team, nameof(era_essteam.era_ESSTeam_ESSTeamArea_ESSTeamID)); await context.LoadPropertyAsync(team, nameof(era_essteam.era_essteamuser_ESSTeamId)); } context.DetachAll(); return(new TeamQueryResponse { Items = mapper.Map <IEnumerable <Team> >(teams) }); }
private async Task <CasSystemConfiguration> GetFromDynamics(CancellationToken ct) { var ctx = essContextFactory.CreateReadOnly(); var configValues = (await((DataServiceQuery <era_systemconfig>)ctx.era_systemconfigs.Where(sc => sc.era_group == "eTransfer")).GetAllPagesAsync(ct)).ToArray(); return(new CasSystemConfiguration { CurrencyCode = configValues.SingleOrDefault(cv => cv.era_key.Equals("Currency Code", StringComparison.OrdinalIgnoreCase))?.era_value ?? "CAD", DefaultDistributionAccount = configValues.SingleOrDefault(cv => cv.era_key.Equals("Default Distribution Account", StringComparison.OrdinalIgnoreCase))?.era_securevalue, InvoiceType = configValues.SingleOrDefault(cv => cv.era_key.Equals("Invoice Type", StringComparison.OrdinalIgnoreCase))?.era_value ?? "Standard", InvoiceLineCode = configValues.SingleOrDefault(cv => cv.era_key.Equals("Line Code", StringComparison.OrdinalIgnoreCase))?.era_value ?? "DR", InvoiceTerms = configValues.SingleOrDefault(cv => cv.era_key.Equals("Terms", StringComparison.OrdinalIgnoreCase))?.era_value ?? "IMMEDIATE", InvoiceLineType = configValues.SingleOrDefault(cv => cv.era_key.Equals("Type", StringComparison.OrdinalIgnoreCase))?.era_value ?? "Item", PayGroup = configValues.SingleOrDefault(cv => cv.era_key.Equals("Pay Group", StringComparison.OrdinalIgnoreCase))?.era_value ?? "EMB IN", InvoiceRemittanceCode = configValues.SingleOrDefault(cv => cv.era_key.Equals("Remittance Code", StringComparison.OrdinalIgnoreCase))?.era_value ?? "01", InvoiceSpecialHandling = configValues.SingleOrDefault(cv => cv.era_key.Equals("Special Handling", StringComparison.OrdinalIgnoreCase))?.era_value ?? "N", ProviderId = configValues.SingleOrDefault(cv => cv.era_key.Equals("Provider ID", StringComparison.OrdinalIgnoreCase))?.era_value ?? "CAS_SU_AT_ESS" }); }
public async Task <IEnumerable <VersionInformation> > Get() { await Task.CompletedTask; string?version = null; try { var ctx = essContextFactory.CreateReadOnly(); version = ctx.solutions.Where(s => s.isvisible == true && s.uniquename == "ERAEntitySolution").FirstOrDefault()?.version; } catch (Exception) { } return(new[] { new VersionInformation { Name = "Dynamics:ERAEntitySolution", Version = version == null ? null : Version.Parse(version) } }); }
public async Task <IEnumerable <EvacuationFile> > Read(EvacuationFilesQuery query) { var readCtx = essContextFactory.CreateReadOnly(); //get all matching files var files = (await QueryHouseholdMemberFiles(readCtx, query)) .Concat(await QueryEvacuationFiles(readCtx, query)) .Concat(await QueryNeedsAssessments(readCtx, query)); //secondary filter after loading the files if (!string.IsNullOrEmpty(query.FileId)) { files = files.Where(f => f.era_name == query.FileId); } if (query.RegistraionDateFrom.HasValue) { files = files.Where(f => f.createdon.Value.UtcDateTime >= query.RegistraionDateFrom.Value); } if (query.RegistraionDateTo.HasValue) { files = files.Where(f => f.createdon.Value.UtcDateTime <= query.RegistraionDateTo.Value); } if (query.IncludeFilesInStatuses.Any()) { files = files.Where(f => query.IncludeFilesInStatuses.Any(s => (int)s == f.era_essfilestatus)); } if (query.Limit.HasValue) { files = files.OrderByDescending(f => f.era_name).Take(query.Limit.Value); } //ensure files will be loaded only once and have a needs assessment files = files .Where(f => f.statecode == (int)EntityState.Active && f._era_currentneedsassessmentid_value.HasValue) .Distinct(new LambdaComparer <era_evacuationfile>((f1, f2) => f1.era_evacuationfileid == f2.era_evacuationfileid, f => f.era_evacuationfileid.GetHashCode())); return((await ParallelLoadEvacuationFilesAsync(readCtx, files)).Select(f => MapEvacuationFile(f, query.MaskSecurityPhrase)).ToArray()); }
public InternalMetadataRepository(IEssContextFactory essContextFactory, IMapper mapper) { this.mapper = mapper; this.essContext = essContextFactory.CreateReadOnly(); }
public ReportRepository(IEssContextFactory essContextFactory, IMapper mapper) { this.readCtx = essContextFactory.CreateReadOnly(); this.mapper = mapper; }
public SearchEngine(IEssContextFactory essContextFactory) { this.essContext = essContextFactory.CreateReadOnly(); }
public TaskRepository(IEssContextFactory essContextFactory, IMapper mapper, ICache cache) { this.essContext = essContextFactory.CreateReadOnly(); this.mapper = mapper; this.cache = cache; }