/// <inheritdoc /> public WhenRecordingNewConsent_ForAnExistingStudySubject_WithoutActiveConsent() { A.CallTo(() => Consents.FindActiveConsent(StudySubject)) .Returns(null); RecordConsent( Evidences.ServerMedwayDto(takenBy: "Peter Crowther"), 2.January(1837)); }
private void Clear() { BookingDate = Date = DateTime.Today; SelectedMode = Modes.OrderBy(x => x.Rank).FirstOrDefault(); SelectedOutcome = Outcomes.OrderBy(x => x.Rank).FirstOrDefault(); if (null != Consents) { SelectedConsent = Consents.OrderBy(x => x.Rank).FirstOrDefault(); } }
public object Clone() { return(new OAuthUser { Id = Id, Claims = Claims == null ? new Dictionary <string, string>() : Claims.ToDictionary(s => s.Key, s => s.Value), Consents = Consents == null ? new List <OAuthConsent>() : Consents.Select(c => (OAuthConsent)c.Clone()).ToList(), Credentials = Credentials == null ? new List <OAuthUserCredential>() : Credentials.Select(c => (OAuthUserCredential)c.Clone()).ToList(), CreateDateTime = CreateDateTime, UpdateDateTime = UpdateDateTime }); }
public WhenTryingToRecordConsent_ForAnExistingStudySubject_WithActiveConsent() { var dateGiven = 3.November(1472); var givenEvidence = Array.Empty <IIdentifierValueDto>(); existingConsentId = new ConsentIdentity(43); A.CallTo(() => Consents.FindActiveConsent(StudySubject)) .Returns(existingConsentId); RecordConsent(givenEvidence, dateGiven); }
private void InitialiseBindingData(long studyId, string subjectIdentifier) { StudySubject = subjects.GetStudySubject(new StudyIdentity(studyId), subjectIdentifier); if (StudySubject == null) { return; } Consents = consents.GetConsentsForSubject(new StudyIdentity(studyId), subjectIdentifier); CurrentConsent = Consents.FirstOrDefault(); ConsentIsActive = CurrentConsent != null && CurrentConsent.DateWithdrawn == null; Identifiers = identity.GetPersonIdentifiers(StudySubject.PersonId); }
private void LoadTest() { if (null != TestResult) { Id = TestResult.Id; Date = TestResult.Date; SelectedMode = Modes.FirstOrDefault(x => x.ItemId == TestResult.Mode); SelectedOutcome = Outcomes.FirstOrDefault(x => x.ItemId == TestResult.Outcome); SelectedConsent = Consents.FirstOrDefault(x => x.ItemId == TestResult.Consent); BookingDate = TestResult.BookingDate; } }
private void Clear() { BookingDate = Date = DateTime.Today; SelectedMode = Modes.OrderBy(x => x.Rank).FirstOrDefault(); SelectedOutcome = Outcomes.OrderBy(x => x.Rank).FirstOrDefault(); if (null != Consents) { SelectedConsent = Consents.OrderBy(x => x.Rank).FirstOrDefault(); } SelectedReasonNotContacted = ReasonsNotContacted.OrderBy(x => x.Rank).FirstOrDefault(); ReasonNotContactedOther = string.Empty; }
public object Clone() { return(new OAuthUser { Id = Id, Claims = Claims == null ? new List <Claim>() : Claims.Select(_ => new Claim(_.Type, _.Value, _.ValueType)).ToList(), AuthenticationTime = AuthenticationTime, Consents = Consents == null ? new List <OAuthConsent>() : Consents.Select(c => (OAuthConsent)c.Clone()).ToList(), Credentials = Credentials == null ? new List <OAuthUserCredential>() : Credentials.Select(c => (OAuthUserCredential)c.Clone()).ToList(), CreateDateTime = CreateDateTime, UpdateDateTime = UpdateDateTime }); }
private void SetOutcome() { // if (null != SelectedOutcome && !SelectedOutcome.ItemId.IsNullOrEmpty() && SelectedOutcome.ItemId == new Guid("b25f0a50-852f-11e7-bb31-be2e44b06b34")) //Contacted { EnableBooking = EnableConsent = true; } else { EnableBooking = EnableConsent = false; SelectedConsent = Consents.OrderBy(x => x.Rank).FirstOrDefault(); } }
public WhenTryingToRecordConsent_ForAnExistingStudySubject_WithActiveConsentForDifferentIdentifiers() { var givenEvidence = new [] { A.Dummy <Evidence>() }; var dateGiven = 3.November(1472); existingConsent = new Consent(StudySubject, dateGiven, Random.Long(), givenEvidence); A.CallTo( () => Consents.FindActiveConsent( StudySubject)) .Returns(null); RecordConsent(Array.Empty <IIdentifierValueDto>(), dateGiven); }
public ConsentIdentity FindActiveConsent(StudySubject studySubject) { var consents = Consents.Where( _ => _.StudySubject.Person.Id == studySubject.PersonId.Id && _.StudySubject.Study.Id == studySubject.StudyId.Id && _.StudySubject.SubjectIdentifier == studySubject.SubjectIdentifier && _.DateWithdrawn == null); var consentId = consents.Select(_ => (long?)_.Id).SingleOrDefault(); return(consentId == null ? null : new ConsentIdentity(consentId.Value)); }
private void HandleConsentAdded(object sender, NotificationEventArgs e) { Consents.Add(new ConsentPageViewModel { Title = e.Title, Description = e.Description, AuthReqId = e.AuthReqId, Permissions = new ObservableCollection <PermissionViewModel>(e.Permissions.Select(p => new PermissionViewModel { DisplayName = p.DisplayName, PermissionId = p.PermissionId, IsSelected = true })) }); }
private void LoadTest() { if (null != TestResult) { Id = TestResult.Id; Date = TestResult.Date; SelectedMode = Modes.FirstOrDefault(x => x.ItemId == TestResult.Mode); SelectedOutcome = Outcomes.FirstOrDefault(x => x.ItemId == TestResult.Outcome); SelectedConsent = Consents.FirstOrDefault(x => x.ItemId == TestResult.Consent); BookingDate = TestResult.BookingDate; SelectedReasonNotContacted = ReasonsNotContacted.FirstOrDefault(x => x.ItemId == TestResult.ReasonNotContacted); ReasonNotContactedOther = TestResult.ReasonNotContactedOther; } }
public object Clone() { return(new OAuthUser { Id = Id, Status = Status, Credentials = Credentials == null ? new List <OAuthUserCredential>() : Credentials.Select(_ => (OAuthUserCredential)_.Clone()).ToList(), OAuthUserClaims = Claims == null ? new List <OAuthUserClaim>() : OAuthUserClaims.Select(_ => (OAuthUserClaim)_.Clone()).ToList(), DeviceRegistrationToken = DeviceRegistrationToken, Consents = Consents == null ? new List <OAuthConsent>() : Consents.Select(c => (OAuthConsent)c.Clone()).ToList(), CreateDateTime = CreateDateTime, UpdateDateTime = UpdateDateTime, Sessions = Sessions.Select(s => (OAuthUserSession)s.Clone()).ToList(), OTPCounter = OTPCounter, OTPKey = OTPKey }); }
/// <inheritdoc /> public ConsentIdentity AddConsent(Common.Consent.Consent consent) { var subject = StudySubjects.FindStudySubjectForPerson(consent.StudySubject.StudyId, consent.StudySubject.PersonId).FirstOrDefault(); if (subject == null) { throw new NotImplementedException($"StudySubject#{consent.StudySubject} not found"); } PersonEntity givenBy = null; if (consent.GivenByPersonId != null) { givenBy = People.Get(consent.GivenByPersonId.Value); if (givenBy == null) { throw new NotImplementedException($"Person#{consent.GivenByPersonId} not found"); } } var saved = Consents.Add( new ConsentEntity { DateProvided = consent.DateGiven, GivenBy = givenBy, StudySubject = subject }); foreach (var evidence in consent.GivenEvidence) { Evidence.Add( new GivenEvidenceEntity { Value = EvidenceRegistry.MarshallToXml(evidence).ToString(SaveOptions.DisableFormatting), Type = evidence.Definition.SystemName, Consent = saved }); } return(new ConsentIdentity(saved.Id)); }
public void AddConsent(ConsentPageViewModel notification) { Consents.Add(notification); }
public void RemoveConsent(ConsentPageViewModel notification) { Consents.Remove(notification); }
private IQueryable <ConsentEntity> ConsentsFor(long studyId, string subjectIdentifier) { return(Consents.Where( c => c.StudySubject.SubjectIdentifier == subjectIdentifier && c.StudySubject.Study.Id == studyId)); }
public void RejectConsent(string consentId) { var consent = Consents.SingleOrDefault(c => c.Id == consentId); Consents.Remove(consent); }