public TestResult GetAwvGlucoseTestResultDomain(KynHealthAssessmentEditModel model, AwvGlucoseTestResult inpersistence, long uploadedby, bool isNewResultFlow)
        {
            if (!IsLipidReadingProvided(model) && inpersistence == null)
            {
                return(inpersistence);
            }

            if (inpersistence == null)
            {
                inpersistence = new AwvGlucoseTestResult
                {
                    ResultStatus = new TestResultState
                    {
                        StateNumber = isNewResultFlow ? (int)NewTestResultStateNumber.ResultEntryPartial : (int)TestResultStateNumber.ManualEntry
                    }
                };
            }

            inpersistence.Glucose = GetGlucoseReading(model.Glucose);

            inpersistence.DataRecorderMetaData = SetDataRecorderMetaData(inpersistence.DataRecorderMetaData, uploadedby);
            inpersistence.ResultStatus.DataRecorderMetaData = SetDataRecorderMetaData(inpersistence.ResultStatus.DataRecorderMetaData, uploadedby);

            return(inpersistence);
        }
        public override TestResult CreateActualTestResult(CustomerEventScreeningTestsEntity customerEventScreeningTestsEntity)
        {
            var customerEventReadingEntities = customerEventScreeningTestsEntity.CustomerEventReading.ToList();

            var testResult = new AwvGlucoseTestResult(customerEventScreeningTestsEntity.CustomerEventScreeningTestId);

            var standardFindingTestReadingEntities = customerEventScreeningTestsEntity.StandardFindingTestReadingCollectionViaCustomerEventReading.ToList();


            var glucoseData = customerEventReadingEntities.SingleOrDefault(customerEventReading => customerEventReading.TestReading.ReadingId == (int)ReadingLabels.Glucose);

            if (glucoseData != null)
            {
                testResult.Glucose = CreateTestReadingforaIntValue(glucoseData, (int)ReadingLabels.Glucose, standardFindingTestReadingEntities,
                                                                   (string.IsNullOrEmpty(glucoseData.Value) ? null : (int?)Convert.ToInt32(glucoseData.Value)));
            }

            return(testResult);
        }
        public void LoadAwvGlucoseResult(HtmlDocument doc, AwvGlucoseTestResult testResult, List <OrderedPair <long, string> > technicianIdNamePairs)
        {
            LoadAwvGlucoseFinding(doc, testResult);

            if (testResult != null)
            {
                var selectedNode = doc.DocumentNode.SelectSingleNode("//div[@id='AwvGlucose-rpp-section']");
                if (selectedNode != null && (testResult.UnableScreenReason == null || testResult.UnableScreenReason.Count == 0) && (testResult.TestNotPerformed == null || testResult.TestNotPerformed.TestNotPerformedReasonId <= 0))
                {
                    selectedNode.SetAttributeValue("style", "display:block;");
                }

                _resultPdfHelper.SetInputBox(doc, "AwvGlucoseInputText", testResult.Glucose);

                _resultPdfHelper.SetTechnician(doc, testResult, "techAwvGlucose", "technotesAwvGlucose", technicianIdNamePairs);
                _resultPdfHelper.SetPhysicianRemarks(doc, testResult, "followUpAwvGlucose", "criticalAwvGlucose", "physicianRemarksAwvGlucose");
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.AwvGlucose, "AwvGlucoseUnableToScreen", testResult.UnableScreenReason);
            }
            else
            {
                _resultPdfHelper.SetUnableToScreenReasons(doc, TestType.AwvGlucose, "AwvGlucoseUnableToScreen", null);
            }
        }
        private void LoadAwvGlucoseFinding(HtmlDocument doc, AwvGlucoseTestResult testResult)
        {
            var glucoseFinding = _standardFindingRepository.GetAllStandardFindings <int?>((int)TestType.AwvGlucose, (int)ReadingLabels.Glucose);

            _resultPdfHelper.SetFindingsVertical(doc, testResult != null && testResult.Glucose != null ? testResult.Glucose.Finding : null, glucoseFinding, "AwvGlucoseFinding");
        }