void Initialize() { bool[,] aa = new bool[6, 5]; aa[0, 0] = true; aa[0, 1] = true; List <DateTime> d = new List <DateTime>(); // d.Add(new DateTime(2019, 01, 06, 9, 0, 0)); Tester t = new Tester("123456789", "M", "n", "*****@*****.**", new DateTime(1970, 10, 12), Gender.Male, "0541123215", new Address("dfg", "545", "dfg"), 2, 20, CarType.Motorcycle, GearType.Auto, aa, 30, d); t.Appointments.Add(new DateTime(2019, 1, 13, 9, 0, 0)); myBL.Add_tester(t); Trainee tr = new Trainee("987654321", "Cohen", "Yoel", "*****@*****.**", Gender.Male, "0548875540", new Address("King George", "21", "Jerusalem"), new DateTime(1990, 10, 12), CarType.Motorcycle, GearType.Auto, "SmartDrive", "Benny Goren", 20); myBL.Add_trainee(tr); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { bool ERROR = false; if (First_nameTextBox.Text.Length == 0) { ERROR = true; First_nameTextBox.BorderBrush = Brushes.Red; First_nameERROR.Visibility = Visibility.Visible; } if (Last_nameTextBox.Text.Length == 0) { ERROR = true; Last_nameTextBox.BorderBrush = Brushes.Red; Last_nameERROR.Visibility = Visibility.Visible; } if (IDTextBox.Text.Length < 9 || IDTextBox.Text.Contains(" ")) { ERROR = true; IDTextBox.BorderBrush = Brushes.Red; IDERROR.Visibility = Visibility.Visible; } if (Date_of_birthDatePicker.SelectedDate == null) { ERROR = true; Date_of_birthDatePicker.BorderBrush = Brushes.DarkRed; DateERROR.Visibility = Visibility.Visible; } if (!Tools.IsValidAddress(AddressTextBox.Text)) { ERROR = true; AddressTextBox.BorderBrush = Brushes.Red; AddressERROR.Visibility = Visibility.Visible; } if (!Tools.IsValidPhoneNumber(PhoneNumberTextBox.Text)) { ERROR = true; PhoneNumberTextBox.BorderBrush = Brushes.Red; PhoneERROR.Visibility = Visibility.Visible; } if (!Tools.IsValidEmail(EmailTextBox.Text)) { ERROR = true; EmailTextBox.BorderBrush = Brushes.Red; EmailERROR.Visibility = Visibility.Visible; } if (SchoolTextBox.Text.Length == 0) { ERROR = true; SchoolTextBox.BorderBrush = Brushes.Red; SchoolERROR.Visibility = Visibility.Visible; } if (TeacherTextBox.Text.Length == 0) { ERROR = true; TeacherTextBox.BorderBrush = Brushes.Red; TeacherERROR.Visibility = Visibility.Visible; } if (!ERROR) { try { t.Address = AddressTextBox.Text.ToAddress(); t.Date_of_birth = Date_of_birthDatePicker.SelectedDate.Value; myBL.Add_trainee(t); MessageBox.Show("Trainee was added to the system", "", MessageBoxButton.OK, MessageBoxImage.Information); MainWindow.myWindow.Close(); } catch (Exception E) { MessageBox.Show(E.Message); } } }