public override void Render()
        {
            CysticFibrosisTestOrder panelSetOrderCF = (CysticFibrosisTestOrder)this.m_PanelSetOrder;

            if (panelSetOrderCF.TemplateId == 1)
            {
                this.m_TemplateName = @"\\CFileServer\Documents\ReportTemplates\XmlTemplates\CysticFibrosisCarrierScreening.1.xml";
            }
            else if (panelSetOrderCF.TemplateId == 2)
            {
                this.m_TemplateName = @"\\CFileServer\Documents\ReportTemplates\XmlTemplates\CysticFibrosisCarrierScreeningUnknownEthnicGroup.1.xml";
            }
            else
            {
                return;
            }

            base.OpenTemplate();

            base.SetDemographicsV2();

            YellowstonePathology.Business.Specimen.Model.SpecimenOrder specimenOrder = this.m_AccessionOrder.SpecimenOrderCollection.GetSpecimenOrderByOrderTarget(this.m_PanelSetOrder.OrderedOnId);
            this.SetXmlNodeData("specimen_description", specimenOrder.Description);

            string collectionDateTimeString = YellowstonePathology.Business.Helper.DateTimeExtensions.CombineDateAndTime(specimenOrder.CollectionDate, specimenOrder.CollectionTime);
            this.SetXmlNodeData("date_time_collected", collectionDateTimeString);

            this.SetReportDistribution();
            this.SetCaseHistory();

            base.ReplaceText("report_result", panelSetOrderCF.Result);
            base.ReplaceText("mutations_detected", panelSetOrderCF.MutationsDetected);
            base.ReplaceText("report_comment", panelSetOrderCF.Comment);

            YellowstonePathology.Business.Test.CysticFibrosis.CysticFibrosisEthnicGroupCollection cysticFibrosisEthnicGroupCollection = new CysticFibrosisEthnicGroupCollection();
            YellowstonePathology.Business.Test.CysticFibrosis.CysticFibrosisEthnicGroup cysticFibrosisEthnicGroup = cysticFibrosisEthnicGroupCollection.GetCysticFibrosisEthnicGroup(panelSetOrderCF.EthnicGroupId);

            base.ReplaceText("report_ethnic_group", cysticFibrosisEthnicGroup.EthnicGroupName);
            base.ReplaceText("report_interpretation", panelSetOrderCF.Interpretation);
            base.ReplaceText("mutations_tested", panelSetOrderCF.MutationsTested);
            base.ReplaceText("report_method", panelSetOrderCF.Method);
            base.ReplaceText("report_references", panelSetOrderCF.ReportReferences);

            this.ReplaceText("pathologist_signature", this.m_PanelSetOrder.Signature);

            YellowstonePathology.Business.Document.AmendmentSection amendment = new YellowstonePathology.Business.Document.AmendmentSection();
            amendment.SetAmendment(m_PanelSetOrder.AmendmentCollection, this.m_ReportXml, this.m_NameSpaceManager, true);

            this.SaveReport();
        }
        public YellowstonePathology.Business.Rules.MethodResult IsOkToSetResults()
        {
            YellowstonePathology.Business.Rules.MethodResult result = new YellowstonePathology.Business.Rules.MethodResult();
            YellowstonePathology.Business.Test.CysticFibrosis.CysticFibrosisResultCollection cysticFibrosisResultCollection = CysticFibrosisResultCollection.GetAllResults();
            YellowstonePathology.Business.Test.CysticFibrosis.CysticFibrosisResult cysticFibrosisResult = cysticFibrosisResultCollection.GetResult(this.m_ResultCode);

            YellowstonePathology.Business.Test.CysticFibrosis.CysticFibrosisEthnicGroupCollection cysticFibrosisEthnicGroupCollection = new CysticFibrosisEthnicGroupCollection();
            YellowstonePathology.Business.Test.CysticFibrosis.CysticFibrosisEthnicGroup cysticFibrosisEthnicGroup = cysticFibrosisEthnicGroupCollection.GetCysticFibrosisEthnicGroup(this.m_EthnicGroupId);

            if (this.Accepted == true)
            {
                result.Success = false;
                result.Message = "The results cannot be set because they have already been accepted";
            }
            else if (cysticFibrosisResult is YellowstonePathology.Business.Test.CysticFibrosis.CysticFibrosisNullResult)
            {
                result.Success = false;
                result.Message = "The results cannot be set because the result has not been selected.";
            }
            else if(cysticFibrosisEthnicGroup is YellowstonePathology.Business.Test.CysticFibrosis.CysticFibrosisEthnicGroupNull)
            {
                result.Success = false;
                result.Message = "The results cannot be set because the ethnic group has not been selected.";
            }
            else if (this.DoesResultReflectFindings() == false)
            {
                result.Success = false;
                result.Message = "The results cannot be accepted because the individual mutation results are not consistent with the selected result.";
            }

            return result;
        }
        public override void ToXml(XElement document)
        {
            CysticFibrosisTestOrder panelSetOrder = (CysticFibrosisTestOrder)this.m_AccessionOrder.PanelSetOrderCollection.GetPanelSetOrder(this.m_ReportNo);

            this.AddHeader(document, panelSetOrder, "Cystic Fibrosis Carrier Screening");

            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("Result:", document, "F");
            this.AddNextObxElement(panelSetOrder.Result, document, "F");

            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("Mutations Detected:", document, "F");
            this.HandleLongString(panelSetOrder.MutationsDetected, document, "F");

            if (string.IsNullOrEmpty(panelSetOrder.Comment) == false)
            {
                this.AddNextObxElement("", document, "F");
                this.AddNextObxElement("Comment:", document, "F");
                this.HandleLongString(panelSetOrder.Comment, document, "F");
            }

            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("Pathologist: " + panelSetOrder.Signature, document, "F");
            if (panelSetOrder.FinalTime.HasValue == true)
            {
                this.AddNextObxElement("E-signed " + panelSetOrder.FinalTime.Value.ToString("MM/dd/yyyy HH:mm"), document, "F");
            }

            this.AddNextObxElement("", document, "F");
            this.AddAmendments(document);

            this.AddNextObxElement("Specimen: Whole blood EDTA", document, "F");

            YellowstonePathology.Business.Test.CysticFibrosis.CysticFibrosisEthnicGroupCollection cysticFibrosisEthnicGroupCollection = new CysticFibrosisEthnicGroupCollection();
            YellowstonePathology.Business.Test.CysticFibrosis.CysticFibrosisEthnicGroup cysticFibrosisEthnicGroup = cysticFibrosisEthnicGroupCollection.GetCysticFibrosisEthnicGroup(panelSetOrder.EthnicGroupId);

            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("Ethnic Group: " + cysticFibrosisEthnicGroup.EthnicGroupName, document, "F");

            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("Interpretation:", document, "F");
            this.HandleLongString(panelSetOrder.Interpretation, document, "F");

            if (panelSetOrder.TemplateId == 2)
            {
                this.AddNextObxElement("", document, "F");
                string line = "The table below provides data to be used in the risk assessment of this individual.  Note that the detection rate and the CF carrier risk are not available for individuals from other ethnic populations.";
                this.AddNextObxElement("", document, "F");
                this.AddNextObxElement(line, document, "F");
                this.AddNextObxElement("Ethnic Group ", document, "F");
                this.AddNextObxElement("Ashkenazi Jewish", document, "F");
                this.AddNextObxElement("Detection Rate 94%", document, "F");
                this.AddNextObxElement("Before Test 1/24", document, "F");
                this.AddNextObxElement("After Negative Test 1/400", document, "F");
                this.AddNextObxElement("", document, "F");
                this.AddNextObxElement("European Caucasian", document, "F");
                this.AddNextObxElement("Detection Rate 88%", document, "F");
                this.AddNextObxElement("Before Test 1/25", document, "F");
                this.AddNextObxElement("After Negative Test 1/208", document, "F");
                this.AddNextObxElement("", document, "F");
                this.AddNextObxElement("African American", document, "F");
                this.AddNextObxElement("Detection Rate 65%", document, "F");
                this.AddNextObxElement("Before Test 1/65", document, "F");
                this.AddNextObxElement("After Negative Test 1/186", document, "F");
                this.AddNextObxElement("", document, "F");
                this.AddNextObxElement("Hispanic American", document, "F");
                this.AddNextObxElement("Detection Rate 72%", document, "F");
                this.AddNextObxElement("Before Test 1/46", document, "F");
                this.AddNextObxElement("After Negative Test 1/164", document, "F");
                this.AddNextObxElement("", document, "F");
                this.AddNextObxElement("Asian American ", document, "F");
                this.AddNextObxElement("Detection Rate 49%", document, "F");
                this.AddNextObxElement("Before Test 1/94", document, "F");
                this.AddNextObxElement("After Negative Test 1/184", document, "F");
            }

            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("Method:", document, "F");
            this.HandleLongString(panelSetOrder.Method, document, "F");

            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("Mutations Tested:", document, "F");
            this.HandleLongString(panelSetOrder.MutationsTested, document, "F");

            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement("References:", document, "F");
            this.HandleLongString(panelSetOrder.References, document, "F");

            string locationPerformed = panelSetOrder.GetLocationPerformedComment();
            this.AddNextObxElement("", document, "F");
            this.AddNextObxElement(locationPerformed, document, "F");
            this.AddNextObxElement(string.Empty, document, "F");
        }