コード例 #1
0
 public Trainee(string id, string firstName, string lastName, DateTime birthDay, string schoolName, string teacherName, int numberOfLesson, string phoneNumber, Address address, Gender gender = Gender.MALE, CarType carType = CarType.PrivetCar, GearBox gearBox = GearBox.Manual)
 {
     Id                = id;
     FirstName         = firstName;
     LastName          = lastName;
     BirthDate         = birthDay;
     Gender            = gender;
     PhoneNumber       = phoneNumber;
     Address           = address;
     CarType           = carType;
     GearBox           = gearBox;
     SchoolName        = schoolName;
     TeacherName       = teacherName;
     NumberOfLesson    = numberOfLesson;
     Registration_date = DateTime.Now;
 }
コード例 #2
0
        }                    //CTOR without arguments- required for the xmlSerializer

        public Trainee(string id, string name, int age, Address address, string schoolName = "", string teacherName = "", int numberOfLesson = 0, string phoneNumber = "00000", Gender gender = Gender.MALE, CarType carType = CarType.PrivetCar, GearBox gearBox = GearBox.Manual)
        {
            this.id = id;
            //make from one string first and last name, if there are only one word enter " " to the last name
            string[] seperator = { " " };
            string[] names     = name.Split(seperator, 2, StringSplitOptions.RemoveEmptyEntries);
            FirstName      = names[0];
            LastName       = names[1] != null ? names[1] : " ";
            Age            = age;
            Gender         = gender;
            PhoneNumber    = phoneNumber;
            Address        = address;
            CarType        = carType;
            GearBox        = gearBox;
            SchoolName     = schoolName;
            TeacherName    = teacherName;
            NumberOfLesson = numberOfLesson;
            //       AmountOfTests = 0;
        }