public void AddTester(Tester t) { int minAge, maxAge; try { minAge = (int)instance.GetConfig("Tester minimum age"); maxAge = (int)instance.GetConfig("Tester maximun age"); } catch (AccessViolationException e) { throw e; } catch (KeyNotFoundException e) { throw e; } int testerAge = (DateTime.Now.Year - t.DateOfBirth.Year); if (testerAge < minAge || testerAge > maxAge) { throw new ArgumentOutOfRangeException("Tester age is not on range of " + minAge + "-" + maxAge); } else { try { instance.AddTester(CreateDOFromBO.CreateDOTester(t)); } catch (KeyNotFoundException e) { throw e; } } }
public void UpdateTesterDetails(Tester t) { bool exist = GetTestersList().Exists(x => x.Id == t.Id); if (!exist) { throw new KeyNotFoundException("Can't update this tester becauze he is not on the system."); } else { try { instance.UpdateTesterDetails(CreateDOFromBO.CreateDOTester(t)); } catch (KeyNotFoundException e) { throw e; } } }