public Trainee(string id, string name, string familyName, DateTime birthD, MyEnum.gender g, string phoneNum, Address address, MyEnum.carType type, MyEnum.gear my_gear, string school, string teacher_name, int numLessons, string password)
 {
     Id              = id;
     Name            = name;
     FamilyName      = familyName;
     BrithDate       = birthD;
     MyGender        = g;
     PhoneNumber     = phoneNum;
     MyAddress       = address;
     Car             = type;
     MyGear          = my_gear;
     School          = school;
     TeacherName     = teacher_name;
     NumberOfLessons = numLessons;
     Password        = password;
 }
 public Tester(string id, string name, string familyName, DateTime birthD, MyEnum.gender g, string phoneNum, Address address, int yearsE, int maxTest, MyEnum.carType type, int max_distance, bool[,] mat, string password)
 {
     Id                = id;
     Name              = name;
     FamilyName        = familyName;
     BirthDate         = birthD;
     MyGender          = g;
     PhoneNumber       = phoneNum;
     MyAddress         = address;
     YearsOfExperience = yearsE;
     MaxTestsPerWeek   = maxTest;
     ExpiranceCar      = type;
     MaxDistance       = max_distance;
     //Deep copy for work hours matrix
     WorkHours = new bool[5, 7];
     for (int i = 0; i < 5; i++)
     {
         for (int j = 0; j < 6; j++)
         {
             WorkHours[i, j] = mat[i, j];
         }
         Password = password;
     }
 }
Example #3
0
        void IBL.AddTrainee(string id, string name, string familyName, DateTime birthD, MyEnum.gender g, string phoneNum, Address address, MyEnum.carType type, MyEnum.gear my_gear, string school, string teacher_name, int numLessons, string password)
        {
            Trainee temp;

            if (id.Length < 9 || id.Length > 9)
            {
                // ID must contain 9 dighits only
                throw new Exception("ID must contain only 9 digits");
            }

            if (birthD.Year > DateTime.Now.Year - Configuration.Trainee_MIN_AGE)
            {
                throw new Exception("Trainee cant't be younger then " + Configuration.Trainee_MIN_AGE);
            }
            ValidAddress(address);
            if (numLessons <= 0)
            {
                throw new Exception("Number of lessons must br bigger then 0 ");
            }

            temp = new Trainee(id, name, familyName, birthD, g, phoneNum, address, type, my_gear, school, teacher_name, numLessons, password);

            dal.AddTrainee(temp);
        }
Example #4
0
        void IBL.AddTester(string id, string name, string family_name, DateTime birth_date, MyEnum.gender my_gender, string phone, Address t_adress, int years_of_exprience, int number_of_tests, MyEnum.carType exp, bool[,] work_hours, int max_distance, string passWord)
        {
            Tester temp;

            if (id.Length != 9)
            {
                // ID must contain 9 dighits only
                throw new Exception("ID must contain only 9 digits");
            }
            IfNonLetters(id, "ID");


            if (DateTime.Now.Year - birth_date.Year < Configuration.Tester_MIN_AGE)
            {
                //Tester age can't be younger then min age!!!
                throw new Exception("Tester cant't be younger then " + Configuration.Tester_MIN_AGE);
            }
            //valid birth date

            ValidAddress(t_adress);
            if (years_of_exprience > (DateTime.Now.Year - birth_date.Year) - 18)
            {
                throw new Exception("A tester can not be experienced more then " + ((DateTime.Now.Year - birth_date.Year) - 18) + " years");
            }
            if (number_of_tests > 30 || number_of_tests < 1)
            {
                //Number of tets per week can be bigger then 30 or less then 1
                throw new Exception(" Maximum tests per week must be between 1 to 30");
            }
            if (max_distance < 0)
            {
                throw new Exception("Maximum distance can't be negative");
            }
            int numberTestrHours = 0;

            foreach (bool b in work_hours)
            {
                if (b == true)
                {
                    numberTestrHours++;
                }
            }
            if (numberTestrHours > number_of_tests)
            {
                /* Tester can't work more the maximum tests per week*/
                throw new Exception("Tester can't work more then " + number_of_tests + "per week!!");
            }
            temp = new Tester(id, name, family_name, birth_date, my_gender, phone, t_adress, years_of_exprience, number_of_tests, exp, max_distance, work_hours, passWord);
            dal.AddTester(temp);
        }