Пример #1
0
        void addtest(Test x)
        {
            if (temp.Get_Trainee(x.Traineeid) == null)
                throw new Exception("this trianee doesnt exist...");


            if (temp.Get_Trainee(x.Traineeid).numclass < 20)
                throw new Exception("you need 20 classes to do the test...");

            if (temp.Get_Trainee(x.Traineeid).mylasttest.testdate.Year == DateTime.Today.Year) // if the last test it's the same year as today...
            {
                int date = temp.Get_Trainee(x.Traineeid).mylasttest.testdate.DayOfYear;   // the day of the year in the last test
                int today = DateTime.Today.DayOfYear; //the day of the year today
                if ( (today - date )<7)
                    throw new Exception("sorry , but you need to wait 7 days to do the test another time...");
            }   

    }