/// <summary> /// Construct a new cohort, add it to the list and return a reference to it. /// </summary> /// <returns>A new initialised cohort object</returns> public Cohort NewCohort() { if (Cohorts == null) { Cohorts = new List <Cohort>(); } Cohort a = new Cohort(this); a.Count = 0; a.ChronoAge = 0; a.PhysiologicalAge = 0; Cohorts.Add(a); return(a); }
public GetApprovedProvidersQueryHandlerFixture AddApprovedCohortAndProviderForAccount() { var provider = new Provider(GetNextProviderId(), "Foo", DateTime.UtcNow, DateTime.UtcNow); Provider.Add(provider); Cohorts.Add(new Cohort { EmployerAccountId = AccountId, Id = GetNextCohortId(), EditStatus = 0, TransferSenderId = null, ProviderId = provider.UkPrn }); return(this); }
public GetApprovedProvidersQueryHandlerFixture AddNotApprovedCohortAndProviderForAccount() { Provider.Add( new Provider(GetNextProviderId(), "Foo", DateTime.UtcNow, DateTime.UtcNow) ); Cohorts.Add(new Cohort { EmployerAccountId = AccountId, Id = GetNextCohortId(), EditStatus = Types.EditStatus.EmployerOnly, TransferSenderId = null, ProviderId = 1 }); return(this); }
public GetApprovedProvidersQueryHandlerFixture AddCohortAndProvider_WithTransfserSenderNotApproved() { var provider = new Provider(GetNextProviderId(), "Foo", DateTime.UtcNow, DateTime.UtcNow); Provider.Add(provider); Cohorts.Add(new Cohort { EmployerAccountId = AccountId, Id = GetNextCohortId(), EditStatus = 0, TransferSenderId = 1, ProviderId = provider.UkPrn, TransferApprovalStatus = Types.TransferApprovalStatus.Pending }); return(this); }
public void Init(Cohorts cohorts) { DataTable tpsTable; List <DataTable> tpsTables = new List <DataTable>(); foreach (var chType in chTypes) { stringBuilder.Clear(); stringBuilder.Append(agent).Append('_').Append(chType).Append("_TPS"); tpsTable = dataService.GetTable(stringBuilder.ToString()); if (tpsTable != null) { tpsTables.Add(tpsTable); } else { throw new Exception($"Cannot find the TPS table in the database for the {agent} - {chType} pair."); } foreach (DataRow row in tpsTable.Rows) { stringBuilder.Clear(); stringBuilder .Append(agent).Append('_').Append(chType).Append('_').Append(row.Field <string>("InjuryProfileLabel")); cohorts.Add(stringBuilder.ToString(), 0); } } if (chTypes.Count > 1) { foreach (DataRow row0 in tpsTables[0].Rows) { foreach (DataRow row1 in tpsTables[1].Rows) { stringBuilder.Clear(); stringBuilder .Append(agent).Append('_').Append(chTypes[0]).Append('_').Append(row0.Field <string>("InjuryProfileLabel")) .Append(":") .Append(agent).Append('_').Append(chTypes[1]).Append('_').Append(row1.Field <string>("InjuryProfileLabel")); cohorts.Add(stringBuilder.ToString(), 0); } } } if (chTypes.Count == 3) { foreach (DataRow row0 in tpsTables[0].Rows) { foreach (DataRow row1 in tpsTables[1].Rows) { foreach (DataRow row2 in tpsTables[2].Rows) { stringBuilder.Clear(); stringBuilder .Append(agent).Append('_').Append(chTypes[0]).Append('_').Append(row0.Field <string>("InjuryProfileLabel")) .Append(":") .Append(agent).Append('_').Append(chTypes[1]).Append('_').Append(row1.Field <string>("InjuryProfileLabel")) .Append(":") .Append(agent).Append('_').Append(chTypes[2]).Append('_').Append(row2.Field <string>("InjuryProfileLabel")); cohorts.Add(stringBuilder.ToString(), 0); } } } } }