Exemplo n.º 1
0
        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;
                }
            }
        }
Exemplo n.º 2
0
        public void AddTrainee(Trainee t)
        {
            int minAge;

            try
            {
                minAge = (int)GetConfig("Trainee minimum age");
            }
            catch (AccessViolationException e)
            {
                throw e;
            }
            catch (KeyNotFoundException e)
            {
                throw e;
            }
            int traineeAge = (DateTime.Now.Year - t.DateOfBirth.Year);

            if (traineeAge < minAge)
            {
                throw new ArgumentOutOfRangeException("Trainee age is not on above " + minAge + ".");
            }
            else
            {
                try
                {
                    instance.AddTrainee(CreateDOFromBO.CreateDoTrainee(t));
                }
                catch (KeyNotFoundException e)
                {
                    throw e;
                }
            }
        }
Exemplo n.º 3
0
        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;
                }
            }
        }
Exemplo n.º 4
0
        public void UpdateTraineeDetails(Trainee t)
        {
            bool exist = GetTraineeList().Exists(x => x.Id == t.Id);

            if (!exist)
            {
                throw new KeyNotFoundException("Can't update this trainee because he is not on the system.");
            }
            else
            {
                try
                {
                    instance.UpdateTraineeDetails(CreateDOFromBO.CreateDoTrainee(t));
                }
                catch (KeyNotFoundException e)
                {
                    throw e;
                }
            }
        }