示例#1
0
        public void AddTester(Tester tester)
        {
            IfNonLetters(tester.Id, "Tester ID");
            IfNonLetters(tester.PhoneNumber, "Tester Phone number");
            ValidAddress(tester.MyAddress);

            dal.AddTester(tester);
        }
示例#2
0
 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;
     }
 }
示例#3
0
        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);
            }
        }
示例#5
0
 public void AddTester(Tester T)
 {
     dal.AddTester(T);
 }