public void AddTester(Tester tester) { IfNonLetters(tester.Id, "Tester ID"); IfNonLetters(tester.PhoneNumber, "Tester Phone number"); ValidAddress(tester.MyAddress); dal.AddTester(tester); }
public void AddTester(Tester tester) { try { if (!checkID(tester.ID)) { throw new Exception("Exception: tester id error"); } DateTime now = new DateTime(); now = DateTime.Now; now = now.AddYears(-Configuration.MinAgeTester); int result = DateTime.Compare(tester.BDate, now); if (result > 0) { throw new Exception("Exception: The tester is under the age of 40"); } else { dal.AddTester(tester); } } catch (System.Exception e) { throw e; } }
public void AddTester(Tester tester) { //calculte tester age -throw if tester age less then 40. DateTime tmp = tester.Birthdate; if (tmp.AddYears(40) > DateTime.Now) { throw new Exception("Tester age is less then 40"); } try { dal.AddTester(tester); } catch (Exception e) { throw e; } }
public void AddTester(Tester T) { try { bool[] checkAll = { CheckId(T.TesterId), CheckAge(T.DateOfBirth, "Tester"), TesterNotInSystem(T.TesterId), CheckEmail(T.Email) }; bool clear = checkAll.All(x => x); if (!clear) { throw new Exception("Tester Not Added"); } dal.AddTester(T); } catch (Exception exception) { MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void AddTester(Tester T) { dal.AddTester(T); }