/// <summary> /// deletes a test /// </summary> public DeleteTestWindow() { InitializeComponent(); BL = Bl_imp.GetBl(); currentTest = new Test { Datetime = new DateTime() }; //creates a new test for current test with deafult values DataContext = currentTest; //sets the current test in DataContext }
/// <summary> /// Interaction logic to DeleteTrainee.Bl_imp /// </summary> public DeleteTrainee() { InitializeComponent(); this.traineeGenderComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.Gender)); this.traineeGearComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.GearBox)); this.traineeVehicleComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.TypeOfCar)); BL = Bl_imp.GetBl(); currentTrainee = new Trainee(); //creates a new trainee for current trainee DataContext = currentTrainee; //sets the current trainee in DataContext }
/// <summary> /// This function updates a new tester /// </summary> public UpdateTestWindow() { InitializeComponent(); BL = Bl_imp.GetBl(); currentTest = new Test { Datetime = new DateTime() }; //creates a new test for current test with deafult values DataContext = currentTest; //sets the current test in DataContext this.tOfCarComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.TypeOfCar)); }
/// <summary> /// Interaction logic to DeleteTester.Bl_imp /// </summary> public DeleteTester() { InitializeComponent(); BL = Bl_imp.GetBl(); currentTester = new Tester { TesterBirthDate = new DateTime() }; //creates a new tester for current tester with deafult values DataContext = currentTester; //sets the current tester in DataContext this.testerGenderComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.Gender)); this.testerProfessionComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.TypeOfCar)); }
/// <summary> /// This function adds a new tester /// </summary> public AddTester() { InitializeComponent(); bool?[,] mat = new bool?[, ] { { true, true, true, true, true, true }, { true, true, true, true, true, true }, { true, true, true, true, true, true }, { true, true, true, true, true, true }, { true, true, true, true, true, true }, }; BL = Bl_imp.GetBl(); currentTester = new Tester { TesterBirthDate = new DateTime(), TesterWorkHours = mat, TesterAddress = new Address("", 0, "") }; //creates a new tester for current tester with deafult values DataContext = currentTester; //sets the current tester in DataContext this.testerGenderComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.Gender)); this.testerProfessionComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.TypeOfCar)); //sets the values of the matrix of the current tester in the user's matrix TesterHours.aa.IsChecked = currentTester.TesterWorkHours[0, 0]; TesterHours.ab.IsChecked = currentTester.TesterWorkHours[0, 1]; TesterHours.ac.IsChecked = currentTester.TesterWorkHours[0, 2]; TesterHours.ad.IsChecked = currentTester.TesterWorkHours[0, 3]; TesterHours.ae.IsChecked = currentTester.TesterWorkHours[0, 4]; TesterHours.af.IsChecked = currentTester.TesterWorkHours[0, 5]; TesterHours.ba.IsChecked = currentTester.TesterWorkHours[1, 0]; TesterHours.bb.IsChecked = currentTester.TesterWorkHours[1, 1]; TesterHours.bc.IsChecked = currentTester.TesterWorkHours[1, 2]; TesterHours.bd.IsChecked = currentTester.TesterWorkHours[1, 3]; TesterHours.be.IsChecked = currentTester.TesterWorkHours[1, 4]; TesterHours.bf.IsChecked = currentTester.TesterWorkHours[1, 5]; TesterHours.ca.IsChecked = currentTester.TesterWorkHours[2, 0]; TesterHours.cb.IsChecked = currentTester.TesterWorkHours[2, 1]; TesterHours.cc.IsChecked = currentTester.TesterWorkHours[2, 2]; TesterHours.cd.IsChecked = currentTester.TesterWorkHours[2, 3]; TesterHours.ce.IsChecked = currentTester.TesterWorkHours[2, 4]; TesterHours.cf.IsChecked = currentTester.TesterWorkHours[2, 5]; TesterHours.da.IsChecked = currentTester.TesterWorkHours[3, 0]; TesterHours.db.IsChecked = currentTester.TesterWorkHours[3, 1]; TesterHours.dc.IsChecked = currentTester.TesterWorkHours[3, 2]; TesterHours.dd.IsChecked = currentTester.TesterWorkHours[3, 3]; TesterHours.de.IsChecked = currentTester.TesterWorkHours[3, 4]; TesterHours.df.IsChecked = currentTester.TesterWorkHours[3, 5]; TesterHours.ea.IsChecked = currentTester.TesterWorkHours[4, 0]; TesterHours.eb.IsChecked = currentTester.TesterWorkHours[4, 1]; TesterHours.ec.IsChecked = currentTester.TesterWorkHours[4, 2]; TesterHours.ed.IsChecked = currentTester.TesterWorkHours[4, 3]; TesterHours.ee.IsChecked = currentTester.TesterWorkHours[4, 4]; TesterHours.ef.IsChecked = currentTester.TesterWorkHours[4, 5]; }
//string streetTrainee, cityTrainee; //int num; /// <summary> /// Interaction logic to AddTrainee.Bl_imp /// </summary> public AddTrainee() { InitializeComponent(); BL = Bl_imp.GetBl(); currentTrainee = new Trainee { TraineeBirthDate = new DateTime() }; //creates a new trainee for current trainee with deafult values DataContext = currentTrainee; //sets the current trainee in DataContext this.traineeGenderComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.Gender)); this.traineeGearComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.GearBox)); this.traineeVehicleComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.TypeOfCar)); }
/// <summary> /// This function opens the window of "Tester" /// </summary> public TesterWindow()//constractor { InitializeComponent(); BL = Bl_imp.GetBl(); }
/// <summary> /// This function opens the window of "Search Trainee" /// </summary> public SearchTraineeWindow()//constractor { InitializeComponent(); BL = Bl_imp.GetBl(); }
/// <summary> /// This function open the window of "Trainee" /// </summary> public TraineeWindow() { InitializeComponent(); BL = Bl_imp.GetBl(); }
/// <summary> /// This function opens the window of "Trainee number of tests" /// </summary> public TraineeNumOfTestsWindow()//constractor { InitializeComponent(); BL = Bl_imp.GetBl(); }
public DeserveDriversLicenceWindow()//constractor { InitializeComponent(); BL = Bl_imp.GetBl(); }
static void Main(string[] args) { BL.IBL bl = Bl_imp.GetBl(); //string id = "123456"; int choice; //int typeOfCar = 10; //for a exception bool?[,] mat = new bool?[5, 7] { { true, true, true, true, true, true, true }, //sunday { true, true, true, true, true, true, true }, //monday { true, true, true, true, true, true, true }, //etc. { true, true, true, true, true, false, null }, { true, true, true, true, true, false, null } }; try { do { Console.WriteLine("out=0,new tester=1 ,new trainee=2 ,new test=3 ,delete tester=4, delete trainee=5,all the tests by date=6 ,testers by profession=7 ,update tester(from case 3)=8 ,update trainee=9 ,update test=10 ,TraineesBySchool=11 ,trainee by teacher=12, TraineesByNumOfTests=13 , AvaliableTesters=14 , DeserveDriversLicence=15 , TraineeNumOfTests=16 , TestsByCondition=17"); choice = int.Parse(Console.ReadLine()); switch (choice) { case 1: bl.AddTester(new Tester("318627264", "levi", "roni", new DateTime(1970, 2, 2), MyEnum.Gender.male, "0557287705", new Address("kishon", 10, "nazareth"), 20, 6, MyEnum.TypeOfCar.privateCar, 200, mat)); Console.WriteLine("Enter a new tester:"); foreach (var item in bl.GetTesters()) { Console.WriteLine(item); } // bl.AddTester(new Tester(id)); //throws exception break; case 2: Console.WriteLine("Enter a new trainee:"); bl.AddTrainee(new Trainee("258691734", "white", "snow", new DateTime(1999, 03, 24), 0, "0585807116", new Address("grifindor", 6, "hogworts"), (MyEnum.TypeOfCar) 3, (MyEnum.GearBox) 1, "Hogworts", "Mcgonagel", 30, 3)); foreach (var item in bl.GetTrainees()) { Console.WriteLine(item); } // bl.AddTrainee(new Trainee(id));//throws exception break; case 3: Console.WriteLine("Enter a new test:"); bl.AddTester(new Tester("666258974", "levi", "eli", new DateTime(1970, 2, 2), MyEnum.Gender.male, "0557287605", new Address("kishon", 10, "nazareth"), 20, 6, (MyEnum.TypeOfCar) 3, 120, mat)); bl.AddTest(new Test("666258974", "098765432", new DateTime(2019, 1, 3), 10, new Address("kishon", 10, "nazareth"), (MyEnum.TypeOfCar) 3, false, "")); foreach (var item in bl.GetTests()) { Console.WriteLine(item); } /*bl.AddTest(new Test("318627264", "321654987", DateTime.Now.AddHours(10), 10, new Address("kishon", 10, "nazareth"), (MyEnum.TypeOfCar)typeOfCar, false, " "));*/ //throws exception break; case 4: Console.WriteLine("Enter a tester to delete:"); bl.DeleteTester(new Tester("318627264", "levi", "roni", new DateTime(1970, 2, 2), MyEnum.Gender.male, "0557287705", new Address("kishon", 10, "nazareth"), 20, 6, MyEnum.TypeOfCar.privateCar, 200, mat)); foreach (var item in bl.GetTesters()) { Console.WriteLine(item); } //bl.DeleteTester(new Tester(id)); //throws exception break; case 5: Console.WriteLine("Enter a trainee to delete:"); bl.DeleteTrainee(new Trainee("258691734", "white", "snow", new DateTime(1999, 03, 24), 0, "0585807116", new Address("grifindor", 6, "hogworts"), (MyEnum.TypeOfCar) 3, (MyEnum.GearBox) 1, "Hogworts", "Mcgonagel", 30, 3)); foreach (var item in bl.GetTrainees()) { Console.WriteLine(item); } // bl.DeleteTrainee(new Trainee("123456999"));//throws exception break; case 6: List <Test> tests = bl.AllTestsInThisDate(DateTime.Now); foreach (var item in tests) { Console.WriteLine(item); } break; case 7: IEnumerable <IGrouping <MyEnum.TypeOfCar, Tester> > t = bl.TestersByProfession(true); foreach (var group in t) { Console.WriteLine(group.Key + ":"); foreach (Tester tester in group) { Console.WriteLine(tester); } } break; case 8: bl.UpdateTester(new Tester("666258974", "levi", "eli", new DateTime(1970, 2, 2), MyEnum.Gender.male, "0557287605", new Address("komemiut", 3, "nazareth"), 20, 6, (MyEnum.TypeOfCar) 3, 120, mat)); foreach (Tester tester in bl.GetTesters()) { Console.WriteLine(tester); } break; case 9: bl.UpdateTrainee(new Trainee("258691734", "white", "snow", new DateTime(1999, 03, 24), 0, "0585807116", new Address("grifindor", 6, "hogworts"), (MyEnum.TypeOfCar) 3, (MyEnum.GearBox) 1, "Hogworts", "Snape", 30, 3)); foreach (Trainee trainee in bl.GetTrainees()) { Console.WriteLine(trainee); } break; case 10: bl.UpdateTest(new Test("666258974", "098765432", new DateTime(2019, 1, 3), 10, new Address("kishon", 10, "nazareth"), (MyEnum.TypeOfCar) 3, true, "finally you have passed ")); foreach (Test test in bl.GetTests()) { Console.WriteLine(test); } break; case 11: IEnumerable <IGrouping <string, Trainee> > schools = bl.TraineesBySchool(true); foreach (var group in schools) { Console.WriteLine(group.Key + ":"); foreach (Trainee trainee in group) { Console.WriteLine(trainee); } } break; case 12: IEnumerable <IGrouping <string, Trainee> > teachers = bl.TraineesByTeacher(true); foreach (var group in teachers) { Console.WriteLine(group.Key + ":"); foreach (Trainee trainee in group) { Console.WriteLine(trainee); } } break; case 13: IEnumerable <IGrouping <int, Trainee> > numberOfTests = bl.TraineesByNumOfTests(true); foreach (var group in numberOfTests) { Console.WriteLine(group.Key + ":"); foreach (Trainee trainee in group) { Console.WriteLine(trainee); } } break; case 14: List <Tester> testers = bl.AvaliableTesters(new DateTime(2019, 1, 3), 10); foreach (Tester item in testers) { Console.WriteLine(item); } break; case 15: bool flag = false; foreach (Trainee item in bl.GetTrainees()) { if (bl.DeserveDriversLicence(item)) { flag = true; Console.WriteLine(item); } } if (!flag) { Console.WriteLine("no one deserve a driver's licence"); } break; case 16: foreach (Trainee item in bl.GetTrainees()) { Console.WriteLine(item + (bl.TraineeNumOfTests(item)).ToString()); } break; case 17: List <Test> testsByCondition = bl.TestsByCondition(r => r.TesterId == "318627247"); foreach (Test test in testsByCondition) { Console.WriteLine(test); } break; default: break; } } while (choice != 0); } catch (Exception c) { Console.WriteLine(c.Message); } }
public AllTestsInThisDateWindow() { InitializeComponent(); BL = Bl_imp.GetBl(); }
/// <summary> /// This function updates a new tester /// </summary> public UpdateTester() { InitializeComponent(); BL = Bl_imp.GetBl(); bool?[,] mat = new bool?[, ] { { true, true, true, true, true, true }, { true, true, true, true, true, true }, { true, true, true, true, true, true }, { true, true, true, true, true, true }, { true, true, true, true, true, true }, }; //creates a new tester for current tester with deafult values currentTester = new Tester { TesterBirthDate = new DateTime(), TesterWorkHours = mat }; DataContext = currentTester;//sets the current tester in DataContext this.testerGenderComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.Gender)); this.testerProfessionComboBox.ItemsSource = Enum.GetValues(typeof(BE.MyEnum.TypeOfCar)); try { //in all the lines where there is null, we do not allow clicking the button because it is not part of the tester's working hours TesterHours.aa.IsChecked = currentTester.TesterWorkHours[0, 0]; if (currentTester.TesterWorkHours[0, 0] == null) { TesterHours.aa.IsEnabled = false; } TesterHours.ab.IsChecked = currentTester.TesterWorkHours[0, 1]; if (currentTester.TesterWorkHours[0, 1] == null) { TesterHours.ab.IsEnabled = false; } TesterHours.ac.IsChecked = currentTester.TesterWorkHours[0, 2]; if (currentTester.TesterWorkHours[0, 2] == null) { TesterHours.ac.IsEnabled = false; } TesterHours.ad.IsChecked = currentTester.TesterWorkHours[0, 3]; if (currentTester.TesterWorkHours[0, 3] == null) { TesterHours.ad.IsEnabled = false; } TesterHours.ae.IsChecked = currentTester.TesterWorkHours[0, 4]; if (currentTester.TesterWorkHours[0, 4] == null) { TesterHours.ae.IsEnabled = false; } TesterHours.af.IsChecked = currentTester.TesterWorkHours[0, 5]; if (currentTester.TesterWorkHours[0, 5] == null) { TesterHours.af.IsEnabled = false; } TesterHours.ba.IsChecked = currentTester.TesterWorkHours[1, 0]; if (currentTester.TesterWorkHours[1, 0] == null) { TesterHours.ba.IsEnabled = false; } TesterHours.bb.IsChecked = currentTester.TesterWorkHours[1, 1]; if (currentTester.TesterWorkHours[1, 1] == null) { TesterHours.bb.IsEnabled = false; } TesterHours.bc.IsChecked = currentTester.TesterWorkHours[1, 2]; if (currentTester.TesterWorkHours[1, 2] == null) { TesterHours.bc.IsEnabled = false; } TesterHours.bd.IsChecked = currentTester.TesterWorkHours[1, 3]; if (currentTester.TesterWorkHours[1, 3] == null) { TesterHours.bd.IsEnabled = false; } TesterHours.be.IsChecked = currentTester.TesterWorkHours[1, 4]; if (currentTester.TesterWorkHours[1, 4] == null) { TesterHours.be.IsEnabled = false; } TesterHours.bf.IsChecked = currentTester.TesterWorkHours[1, 5]; if (currentTester.TesterWorkHours[1, 5] == null) { TesterHours.bf.IsEnabled = false; } TesterHours.ca.IsChecked = currentTester.TesterWorkHours[2, 0]; if (currentTester.TesterWorkHours[2, 0] == null) { TesterHours.ca.IsEnabled = false; } TesterHours.cb.IsChecked = currentTester.TesterWorkHours[2, 1]; if (currentTester.TesterWorkHours[2, 1] == null) { TesterHours.cb.IsEnabled = false; } TesterHours.cc.IsChecked = currentTester.TesterWorkHours[2, 2]; if (currentTester.TesterWorkHours[2, 2] == null) { TesterHours.cc.IsEnabled = false; } TesterHours.cd.IsChecked = currentTester.TesterWorkHours[2, 3]; if (currentTester.TesterWorkHours[2, 3] == null) { TesterHours.cd.IsEnabled = false; } TesterHours.ce.IsChecked = currentTester.TesterWorkHours[2, 4]; if (currentTester.TesterWorkHours[2, 4] == null) { TesterHours.ce.IsEnabled = false; } TesterHours.cf.IsChecked = currentTester.TesterWorkHours[2, 5]; if (currentTester.TesterWorkHours[2, 5] == null) { TesterHours.cf.IsEnabled = false; } TesterHours.da.IsChecked = currentTester.TesterWorkHours[3, 0]; if (currentTester.TesterWorkHours[3, 0] == null) { TesterHours.da.IsEnabled = false; } TesterHours.db.IsChecked = currentTester.TesterWorkHours[3, 1]; if (currentTester.TesterWorkHours[3, 1] == null) { TesterHours.db.IsEnabled = false; } TesterHours.dc.IsChecked = currentTester.TesterWorkHours[3, 2]; if (currentTester.TesterWorkHours[3, 2] == null) { TesterHours.dc.IsEnabled = false; } TesterHours.dd.IsChecked = currentTester.TesterWorkHours[3, 3]; if (currentTester.TesterWorkHours[3, 3] == null) { TesterHours.dd.IsEnabled = false; } TesterHours.de.IsChecked = currentTester.TesterWorkHours[3, 4]; if (currentTester.TesterWorkHours[3, 4] == null) { TesterHours.de.IsEnabled = false; } TesterHours.df.IsChecked = currentTester.TesterWorkHours[3, 5]; if (currentTester.TesterWorkHours[3, 5] == null) { TesterHours.df.IsEnabled = false; } TesterHours.ea.IsChecked = currentTester.TesterWorkHours[4, 0]; if (currentTester.TesterWorkHours[4, 0] == null) { TesterHours.ea.IsEnabled = false; } TesterHours.eb.IsChecked = currentTester.TesterWorkHours[4, 1]; if (currentTester.TesterWorkHours[4, 1] == null) { TesterHours.eb.IsEnabled = false; } TesterHours.ec.IsChecked = currentTester.TesterWorkHours[4, 2]; if (currentTester.TesterWorkHours[4, 2] == null) { TesterHours.ec.IsEnabled = false; } TesterHours.ed.IsChecked = currentTester.TesterWorkHours[4, 3]; if (currentTester.TesterWorkHours[4, 3] == null) { TesterHours.ed.IsEnabled = false; } TesterHours.ee.IsChecked = currentTester.TesterWorkHours[4, 4]; if (currentTester.TesterWorkHours[4, 4] == null) { TesterHours.ee.IsEnabled = false; } TesterHours.ef.IsChecked = currentTester.TesterWorkHours[4, 5]; if (currentTester.TesterWorkHours[4, 5] == null) { TesterHours.ef.IsEnabled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, "cannot add false to the matrix!", MessageBoxButton.OK, MessageBoxImage.Error); } }
public GroupingWindow()//constractor { InitializeComponent(); BL = Bl_imp.GetBl(); }
public TestsByConditionWindow() { InitializeComponent(); BL = Bl_imp.GetBl(); }