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; }
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); }