Example #1
0
        /// <summary>
        /// Get the related Diagnostic record
        /// </summary>
        /// <param name="specimenAccessionId"></param>
        /// <returns></returns>
        private Diagnostic GetRealtedDiagnostic(int specimenAccessionId)
        {
            // TODO: what if accession is realted to multiple diagnostics ???
            IEnumerable <RelatedRecord> diagnosticRelatedRecords = GetDiagnosticRelatedRecords(specimenAccessionId);
            IEnumerable <Diagnostic>    relatedDiagnostics       = RelatedRecordController.GetRelatedBizObjects <Diagnostic>(diagnosticRelatedRecords, RelatedRecord.DestTableName, RelatedRecord.DestPrimaryKey);
            Diagnostic diagnostic = relatedDiagnostics.FirstOrDefault();

            // validation: patient
            if (diagnostic != null && !diagnostic.IsEmpty)
            {
                int patientId = int.Parse(BaseDecryptedPatientId);
                if ((int)diagnostic[Diagnostic.PatientId] == patientId)
                {
                    return(diagnostic);
                }
            }
            return(null);
        }