Ejemplo n.º 1
0
 private void LoadTest()
 {
     if (null != TestResult)
     {
         Id             = TestResult.Id;
         SelectedKit    = Kits.FirstOrDefault(x => x.ItemId == TestResult.Kit);
         KitOther       = TestResult.KitOther;
         LotNumber      = TestResult.LotNumber;
         Expiry         = TestResult.Expiry;
         SelectedResult = Results.FirstOrDefault(x => x.ItemId == TestResult.Result);
     }
 }
Ejemplo n.º 2
0
        private void LoadTests()
        {
            if (null != Encounter)
            {
                var tests = Encounter.ObsTestResults.Where(x => x.TestName == FirstTestEpisodeViewModel.TestName)
                            .ToList();
                foreach (var obsTestResult in tests)
                {
                    try
                    {
                        obsTestResult.ResultDisplay =
                            FirstTestResults.FirstOrDefault(x => x.ItemId == obsTestResult.Result).Display;

                        obsTestResult.KitDisplay = Kits.FirstOrDefault(x => x.ItemId == obsTestResult.Kit).Display;
                    }
                    catch (Exception e)
                    {
                    }
                }
                FirstTestEpisodeViewModel.Tests = tests;

                var tests2 = Encounter.ObsTestResults.Where(x => x.TestName == SecondTestEpisodeViewModel.TestName)
                             .ToList();
                foreach (var obsTestResult in tests2)
                {
                    try
                    {
                        obsTestResult.ResultDisplay = SecondTestResults
                                                      .FirstOrDefault(x => x.ItemId == obsTestResult.Result).Item.Display;

                        obsTestResult.KitDisplay = Kits.FirstOrDefault(x => x.ItemId == obsTestResult.Kit).Display;
                    }
                    catch (Exception e)
                    {
                    }
                }
                SecondTestEpisodeViewModel.Tests = tests2;

                var finalResult = ObsFinalTestResult = Encounter.ObsFinalTestResults.ToList().FirstOrDefault();

                if (null != finalResult)
                {
                    //  Test 1
                    var result1 = FirstTestResults.FirstOrDefault(x => x.ItemId == finalResult.FirstTestResult);

                    if (null != result1)
                    {
                        SelectedFirstTestResult = result1;
                    }
                    else
                    {
                        SelectedFirstTestResult = FinalTestResults.OrderBy(x => x.Rank).FirstOrDefault();
                    }
                    //  Test 2

                    var result2 = SecondTestResults.FirstOrDefault(x => x.ItemId == finalResult.SecondTestResult);

                    if (null != result2)
                    {
                        SelectedSecondTestResult = result2;
                    }
                    else
                    {
                        SelectedSecondTestResult = SecondTestResults.OrderBy(x => x.Rank).FirstOrDefault();
                    }
                    //  Final
                    var result3 = FinalTestResults.FirstOrDefault(x => x.ItemId == finalResult.FinalResult);

                    if (null != result3)
                    {
                        SelectedFinalTestResult = result3;
                    }
                    else
                    {
                        SelectedFinalTestResult = FinalTestResults.OrderBy(x => x.Rank).FirstOrDefault();
                    }

                    //  Result given

                    var resultg = ResultGivenOptions.FirstOrDefault(x => x.ItemId == finalResult.ResultGiven);
                    if (null != resultg)
                    {
                        SelectedResultGiven = resultg;
                    }
                    else
                    {
                        SelectedResultGiven = ResultGivenOptions.OrderBy(x => x.Rank).FirstOrDefault();
                    }

                    //  couple discodant

                    var resultcd = CoupleDiscordantOptions.FirstOrDefault(x => x.ItemId == finalResult.CoupleDiscordant);
                    if (null != resultcd)
                    {
                        SelectedCoupleDiscordant = resultcd;
                    }
                    else
                    {
                        SelectedCoupleDiscordant = CoupleDiscordantOptions.OrderBy(x => x.Rank).FirstOrDefault();
                    }
                    var isIndividial = _settings.GetValue("client.disco", false);
                    EnableCoupleDiscordant = !isIndividial;

                    //  Self test
                    var resultst = SelfTestOptions.FirstOrDefault(x => x.ItemId == finalResult.SelfTestOption);
                    if (null != resultst)
                    {
                        SelectedSelfTest = resultst;
                    }
                    else
                    {
                        SelectedSelfTest = SelfTestOptions.OrderBy(x => x.Rank).FirstOrDefault();
                    }

                    //  PnsDeclined
                    var resultpst = PnsDeclineds.FirstOrDefault(x => x.ItemId == finalResult.PnsDeclined);
                    if (null != resultpst)
                    {
                        SelectedPnsDeclined = resultpst;
                    }
                    else
                    {
                        SelectedPnsDeclined = PnsDeclineds.OrderBy(x => x.Rank).FirstOrDefault();
                    }


                    //  Remarks
                    Remarks = finalResult.Remarks;
                }
            }
        }