private bool IsUserPassNumberOfTestCriteria(ClinicalTestQualificationCriteria selectedCriteria, bool medicationCriteriaPassed, IEnumerable <HealthAssessmentQuestion> questionsintheGroupForTemplate, IEnumerable <CustomerClinicalQuestionAnswer> answers) { bool isTestSelected = true; int yesCount = 0, noCount = 0; var criteriaNumberOfQuestion = selectedCriteria.NumberOfQuestion; if (medicationCriteriaPassed) { questionsintheGroupForTemplate = questionsintheGroupForTemplate.Where(x => x.Id != selectedCriteria.MedicationQuestionId.Value); } foreach (var healthAssessmentQuestion in questionsintheGroupForTemplate) { var answerForTheQuestion = answers.Single(q => q.ClinicalHealthQuestionId == healthAssessmentQuestion.Id); if (answerForTheQuestion.HealthQuestionAnswer == "Yes") { yesCount = yesCount + 1; } else { noCount = noCount + 1; } } // if (selectedCriteria.Answer == "Yes") { isTestSelected = criteriaNumberOfQuestion <= yesCount; } else { isTestSelected = criteriaNumberOfQuestion <= noCount; } return(isTestSelected); }
private ClinicalTestQualificationCriteria CreateDomain(ClinicalTestQualificationCriteria inpersistence, ClinicalTestQualificationCriteria domain, bool isPublised, long orgRoleUserId) { domain.DataRecorderMetaData = inpersistence.DataRecorderMetaData; domain.IsPublished = isPublised; domain.DataRecorderMetaData.DateModified = DateTime.Now; domain.DataRecorderMetaData.DataRecorderModifier = new OrganizationRoleUser(orgRoleUserId); return(domain); }