예제 #1
0
 public string EditTest(DtoTest dtoTest)
 {
     var uniqueTest = TestMethods.Instance.GetTestByCode(dtoTest.Code);
     if (!dtoTest.IsEdit)
     {
         Test test = new Test()
         {
             Code = dtoTest.Code,
             Name = dtoTest.Name,
             DefaultSpecimen = new Specimen()
             {
                 Code = dtoTest.DefaultSpecimen.Code
             },
             Cost = dtoTest.Cost
         };
         return TestMethods.Instance.InsertTest(test);
     }
     else
     {
         var test = new Test()
         {
             Id = uniqueTest.Id,
             Code = dtoTest.Code,
             Name = dtoTest.Name,
             DefaultSpecimen = new Specimen()
             {
                 Code = dtoTest.DefaultSpecimen.Code
             }
         };
         return TestMethods.Instance.UpdateTest(test);
     }
 }
예제 #2
0
 public DtoTest[] GetTestsByVisit(string billingNumber)
 {
     string sexCode = VisitMethods.Instance.GetVisitByBillingNumber(billingNumber).Patient.Sex.Code;
     TestSexAllowed[] testSexAlloweds = TestSexAllowedMethods.Instance.GetTestSexAllowedBySex(sexCode);
     var testInstance = new Test()
     {
         Code = string.Empty,
         Name = string.Empty
     };
     Test[] tests = TestMethods.Instance.GetTests(testInstance.Code, testInstance.Name);
     var query = from testSexAllowed in testSexAlloweds
                 join test in tests
                 on testSexAllowed.Test.Id equals test.Id
                 select new DtoTest()
                 {
                     Id = test.Id,
                     Code = test.Code,
                     Name = test.Name,
                     Cost = test.Cost,
                     DefaultSpecimen = new DtoSpecimen()
                     {
                         Id= test.DefaultSpecimen.Id,
                         Code = test.DefaultSpecimen.Code
                     }
                 };
     var testsBySex = new BindingList<DtoTest>();
     foreach (var testBySex in query)
     {
         testsBySex.Add(testBySex);
     }
     return testsBySex.ToArray<DtoTest>();
 }