Beispiel #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));
            }
        }
Beispiel #2
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);
     }
 }
Beispiel #3
0
 public DtoTest[] FindTests(DtoTest dtoTest)
 {
     Test[]    tests    = TestMethods.Instance.GetTests(dtoTest.Code, dtoTest.Name);
     DtoTest[] dtoTests = tests.Select(test => new DtoTest()
     {
         Id              = test.Id,
         Code            = test.Code,
         Name            = test.Name,
         Cost            = test.Cost,
         DefaultSpecimen = new DtoSpecimen()
         {
             Code = test.DefaultSpecimen.Code,
             Name = test.DefaultSpecimen.Name
         }
     }).ToArray();
     return(dtoTests);
 }
Beispiel #4
0
 public DtoTest[] FindTests(DtoTest dtoTest)
 {
     Test[] tests = TestMethods.Instance.GetTests(dtoTest.Code, dtoTest.Name);
     DtoTest[] dtoTests = tests.Select(test => new DtoTest()
                                             {
                                                 Id = test.Id,
                                                 Code = test.Code,
                                                 Name = test.Name,
                                                 Cost = test.Cost,
                                                 DefaultSpecimen = new DtoSpecimen()
                                                 {
                                                     Code = test.DefaultSpecimen.Code,
                                                     Name = test.DefaultSpecimen.Name
                                                 }
                                             }).ToArray();
     return dtoTests;
 }
Beispiel #5
0
        public DtoTest GetTestByCode(string code)
        {
            Test test    = TestMethods.Instance.GetTestByCode(code);
            var  dtoTest = new DtoTest()
            {
                Id              = test.Id,
                Code            = test.Code,
                DefaultSpecimen = new DtoSpecimen()
                {
                    Id          = test.DefaultSpecimen.Id,
                    Code        = test.DefaultSpecimen.Code,
                    DefaultTube = new DtoTube()
                    {
                        Id   = test.DefaultSpecimen.DefaultTube.Id,
                        Code = test.DefaultSpecimen.DefaultTube.Code
                    }
                }
            };

            return(dtoTest);
        }
Beispiel #6
0
 public DtoTest GetTestByCode(string code)
 {
     Test test = TestMethods.Instance.GetTestByCode(code);
     var dtoTest = new DtoTest()
     {
         Id = test.Id,
         Code = test.Code,
         DefaultSpecimen = new DtoSpecimen()
         {
             Id = test.DefaultSpecimen.Id,
             Code = test.DefaultSpecimen.Code,
             DefaultTube = new DtoTube()
             {
                 Id = test.DefaultSpecimen.DefaultTube.Id,
                 Code = test.DefaultSpecimen.DefaultTube.Code
             }
         }
     };
     return dtoTest;
 }