private void traineeListToUpdateSelectionChangedButton_Click(object sender, RoutedEventArgs e) { BE.CarType c = new BE.CarType(); BE.Gender g = new BE.Gender(); if (Convert.ToString(BE.CarType.HeavyTruck) == carTypeSpcializesComboBoxToUpdate.Text) { c = BE.CarType.HeavyTruck; } if (Convert.ToString(BE.CarType.MediumTruck) == carTypeSpcializesComboBoxToUpdate.Text) { c = BE.CarType.MediumTruck; } if (Convert.ToString(BE.CarType.PrivateVehicle) == carTypeSpcializesComboBoxToUpdate.Text) { c = BE.CarType.PrivateVehicle; } if (Convert.ToString(BE.CarType.TwoWheeledVehicle) == carTypeSpcializesComboBoxToUpdate.Text) { c = BE.CarType.TwoWheeledVehicle; } if (Convert.ToString(BE.Gender.Female) == genderTesterComboBoxToUpdate.Text) { g = BE.Gender.Female; } if (Convert.ToString(BE.Gender.Male) == genderTesterComboBoxToUpdate.Text) { g = BE.Gender.Male; } BE.Address a = new BE.Address(); a.street = streetToUpdate.Text; a.buildingNumber = Convert.ToInt32(buildingNumberToUpdate.Text); a.city = cityToUpdate.Text; BE.Tester toAdd = new BE.Tester(Convert.ToString(idBoxToUpdate.Text), lastNameBoxToUpdate.Text, firstNameBoxToUpdate.Text, Convert.ToDateTime(dateOfBirthTesterToUpdate.Text), g, Convert.ToInt32(phoneNumberBoxToUpdate.Text), a, Convert.ToInt32(yearsOfExperienceBoxToUpdate.Text), Convert.ToInt32(maxWeeklyTestsBoxToUpdate.Text), c, new bool[6][], Convert.ToInt32(maxDistanceExamBoxToUpdate.Text)); bl.updateExistTester(toAdd); }
private void testerListToUpdateSelectionChangedButton_Click(object sender, SelectionChangedEventArgs e) { //testerListToUpdate.IsDropDownOpen = false; BE.Tester w = testerListToUpdate.SelectedItem as BE.Tester; idBoxToUpdate.Text = Convert.ToString(w.Id); lastNameBoxToUpdate.Text = w.LastName; firstNameBoxToUpdate.Text = w.FirstName; dateOfBirthTesterToUpdate.Text = Convert.ToString(w.DateOfBirth); genderTesterComboBoxToUpdate.Text = (Convert.ToString(w.Gender)); phoneNumberBoxToUpdate.Text = Convert.ToString(w.PhoneNumber); streetToUpdate.Text = Convert.ToString(w.Addresss.street); buildingNumberToUpdate.Text = Convert.ToString(w.Addresss.buildingNumber); cityToUpdate.Text = Convert.ToString(w.Addresss.city); yearsOfExperienceBoxToUpdate.Text = Convert.ToString(w.YearsOfExperience); maxWeeklyTestsBoxToUpdate.Text = Convert.ToString(w.MaximumNumberOfWeeklytestsPossible); carTypeSpcializesComboBoxToUpdate.Text = Convert.ToString(w.SpecializesInCarOfType); maxDistanceExamBoxToUpdate.Text = Convert.ToString(w.MaximumDistanceForExam); c01.IsChecked = w.WorkingDaysAndHours[0][0]; c11.IsChecked = w.WorkingDaysAndHours[1][0]; c21.IsChecked = w.WorkingDaysAndHours[2][0]; c31.IsChecked = w.WorkingDaysAndHours[3][0]; c41.IsChecked = w.WorkingDaysAndHours[4][0]; c51.IsChecked = w.WorkingDaysAndHours[5][0]; c61.IsChecked = w.WorkingDaysAndHours[6][0]; c02.IsChecked = w.WorkingDaysAndHours[0][1]; c12.IsChecked = w.WorkingDaysAndHours[1][1]; c22.IsChecked = w.WorkingDaysAndHours[2][1]; c32.IsChecked = w.WorkingDaysAndHours[3][1]; c42.IsChecked = w.WorkingDaysAndHours[4][1]; c52.IsChecked = w.WorkingDaysAndHours[5][1]; c62.IsChecked = w.WorkingDaysAndHours[6][1]; c03.IsChecked = w.WorkingDaysAndHours[0][2]; c13.IsChecked = w.WorkingDaysAndHours[1][2]; c23.IsChecked = w.WorkingDaysAndHours[2][2]; c33.IsChecked = w.WorkingDaysAndHours[3][2]; c43.IsChecked = w.WorkingDaysAndHours[4][2]; c53.IsChecked = w.WorkingDaysAndHours[5][2]; c63.IsChecked = w.WorkingDaysAndHours[6][2]; c04.IsChecked = w.WorkingDaysAndHours[0][3]; c14.IsChecked = w.WorkingDaysAndHours[1][3]; c24.IsChecked = w.WorkingDaysAndHours[2][3]; c34.IsChecked = w.WorkingDaysAndHours[3][3]; c44.IsChecked = w.WorkingDaysAndHours[4][3]; c54.IsChecked = w.WorkingDaysAndHours[5][3]; c64.IsChecked = w.WorkingDaysAndHours[6][3]; c05.IsChecked = w.WorkingDaysAndHours[0][4]; c15.IsChecked = w.WorkingDaysAndHours[1][4]; c25.IsChecked = w.WorkingDaysAndHours[2][4]; c35.IsChecked = w.WorkingDaysAndHours[3][4]; c45.IsChecked = w.WorkingDaysAndHours[4][4]; c55.IsChecked = w.WorkingDaysAndHours[5][4]; c65.IsChecked = w.WorkingDaysAndHours[6][4]; }
//BE.Address testerAddress; public addTesterWindow() { InitializeComponent(); tester = new BE.Tester(); this.DataContext = tester; // loadList(); //testerAddress = new BE.Address(); // this.addressStreet = testerAddress.street; && bl = BL.FactoryBL.GetBL(); myGearBox = new ObservableCollection <BE.GearBox>(); this.gearBoxListBox.ItemsSource = Enum.GetValues(typeof(BE.GearBox)); this.vehicleTypeListView.ItemsSource = Enum.GetValues(typeof(BE.VehicleType)); this.genderComboBox.ItemsSource = Enum.GetValues(typeof(BE.Gender)); }
private void UpdateButton_Click(object sender, RoutedEventArgs e) { IBl _bl = FactorySingletonBl.GetBl(); BE.Tester tester = _bl.FindTesterByID(IDCBox.SelectedItem as string); this.Close(); new AddTester(tester).Show();//send to add window }
public void Remove_tester(BE.Tester tester) { if (groupByTesterFilled(tester)[1].Count != 0) { throw new Exception("בעיה במחיקת משתמש: יש לך מבחנים שלא מילאת או שלא עשית במערכת"); } Dal.Remove_tester(tester); }
public EditTester() { InitializeComponent(); tester = new BE.Tester(); this.gridAddTester.DataContext = tester; bl = BL.FactoryBL.getBL(); }
public void receiveTester(BE.Tester testerFromNewTester) { testerToUpdate = new BE.Tester(testerFromNewTester); this.textBoxStreet.Text = testerToUpdate._adressOfTester.street; this.textBoxApart.Text = Convert.ToString(testerToUpdate._adressOfTester.houseNumber); this.textBoxCity.Text = testerToUpdate._adressOfTester.city; this.DataContext = testerToUpdate; }
public optionsToTester() { InitializeComponent(); bl = BL.factoryBL.getBL(); currentTester = new BE.Tester(); this.DataContext = currentTester; }
public void Update_tester(BE.Tester tester) { if ((DateTime.Today - tester.Birth_date) < new TimeSpan(BE.Configuration.Minimum_tester_age * 365, 0, 0, 0)) { throw new Exception("שגיאה בעדכון בוחן: הבוחן לא בגיל המתאים"); } Dal.Update_tester(tester); }
private void Button_Click(object sender, RoutedEventArgs e) { // we save the ID user inputed in a local class named DATA , for re using later Data.UserID = IdTextBox.Text; // checking there are any char. in the textbox if (Data.UserID.Length == 0) { MessageBox.Show("אנא הכנס מספר!", "", MessageBoxButton.OK, MessageBoxImage.Asterisk, MessageBoxResult.Yes, MessageBoxOptions.RtlReading); return; } if (Data.UserID == "204412712" || Data.UserID == "029985090") { MessageBox.Show("שלום מנהל, אנא הזן סיסמה", "", MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK, MessageBoxOptions.RtlReading); Label1.Content = "הזנת סיסמת מנהל"; IdTextBox.Visibility = Visibility.Collapsed; button1.Visibility = Visibility.Collapsed; ManagerPasswordBox.Visibility = Visibility.Visible; button2.Visibility = Visibility.Visible; return; } // trying to get a trainee or a tester that has the ID user inputed // by sending this id to search in the BL unction that sends it into the DAL BE.Tester TesterFound = bl.FindTester(Data.UserID); BE.Trainee TraineeFound = bl.FindTrainee(Data.UserID); // if not found - go to matching function if (TesterFound == null && TraineeFound == null) { IdNotFound(); return; } if (TesterFound != null) // if user ID is found as a tester object { MessageBox.Show("שלום " + TesterFound.FullName, "", MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK, MessageBoxOptions.RtlReading); Data.UserType = Data.Usertype.בוחן; // marking user as a tester Data.logged = true; Data.MainUserControl = new HomePanel(); // sending to home panel } if (TraineeFound != null) // if it's a trainee - making the match { MessageBox.Show("שלום " + TraineeFound.FullName, "", MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK, MessageBoxOptions.RtlReading); Data.UserType = Data.Usertype.תלמיד; Data.logged = true; Data.MainUserControl = new HomePanel(); } }
public UpdateTester() { InitializeComponent(); tester = new BE.Tester(); this.gridUpdateTester.DataContext = tester; bl = BL.FactoryBL.getBL(); TesterID.ItemsSource = from item in bl.GetAllTester() select item.ID; }
public UpdateTester() { InitializeComponent(); this.comboBoxCarType.ItemsSource = Enum.GetValues(typeof(BE.myEnums.carType)); bl = BL.factoryBL.getBL(); testerToUpdate = new BE.Tester(); this.DataContext = testerToUpdate; }
public DeleteTester() { InitializeComponent(); InitializeComponent(); bl = BL.FactoryBL.getBL(); tester = new BE.Tester(); this.DataContext = tester; TesterNameComboBox.ItemsSource = from item in bl.getAllTester() select item.id; }
public void receiveTester(BE.Tester testerFromOptionsToTester) { thisTester = new BE.Tester(testerFromOptionsToTester); ourListOfTests = this.passedTestsWithoutExamination(thisTester._ID); this.ComboBoxTestsToUpdate.ItemsSource = ourListOfTests; currentTest = new BE.Test(); this.DataContext = currentTest; }
public NewTester() { InitializeComponent(); tester = new BE.Tester(); this.DataContext = tester; bl = BL.factoryBL.getBL(); this.testerGenderComboBox.ItemsSource = Enum.GetValues(typeof(BE.myEnums.genderType)); }
public TesterWindow(BE.Tester tester) { InitializeComponent(); Tester = tester; Date = DateTime.Now; this.DataContext = Tester; Fill_Schedule(); Fill_Tests_List(); }
private void Maximum_percent_passing_Click(object sender, RoutedEventArgs e) { try { BE.Tester maxTester = bl.maxPrecentOfPassedTestTrainees(); MessageBox.Show($"the tester with the maximum percents of passing: \n{maxTester}", "maximum percent", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "list of tests is empty", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void Update_tester(BE.Tester tester) { try { Remove_tester(tester); Add_tester(tester); } catch { throw new Exception("שגיאה בעדכון בוחן: קרתה תקלה בגישה אל קובץ הנתונים, אנא נסה שוב"); } }
// Tester functions: /// <summary> /// Add tester to the DS. If the tester alredy exist throw exeption /// </summary> /// <param name="tester">The tester to add</param> public void Add_tester(BE.Tester tester) { foreach (BE.Tester item in DS.DataSource.Testers_list) { if (item.ID == tester.ID) { throw new Exception("שגיאה בהכנסת בוחן: קיים כבר בוחן בעל מספר זהות זהה"); } } // If the ID dosent exist, add the tester DS.DataSource.Testers_list.Add(tester); }
public void DisplayResult(Object sender, EventArgs e) { BL.IBL bl = BL.FactoryBL.GetBL(); var bc = new BrushConverter(); string id = this.checkId.Text; int newid = int.Parse(id); BE.Tester isExistTester = bl.getTesterBL(newid); if (isExistTester != null) { BE.Test testOfnumber = bl.getTestByNumber((checkTestNumber.Text)); if (testOfnumber != null) { if (isExistTester.Id == testOfnumber.TesterId) { details.Foreground = (Brush)bc.ConvertFrom("#019EAA"); if (testOfnumber.PassedTheTest == true) { details.Text = ".הנבחן עבר את הטסט בהצלחה\n\n\n"; } else { details.Text = ".הנבחן נכשל בטסט\n\n\n"; } string help = ":ההערה שלך\n"; help += testOfnumber.TesterComment; details.Text += help; string help1 = "\n\n:פירוט תוצאות המבחן\n"; help1 += testOfnumber.TestReport(); details.Text += help1; } else { details.Foreground = (Brush)bc.ConvertFrom("Red"); details.Text = "הת.ז. לא מתאים למספר מבחן שהוזן "; } } else { details.Foreground = (Brush)bc.ConvertFrom("Red"); details.Text = "המספר מבחן שהוזן לא נמצא במערכת"; } } else { details.Foreground = (Brush)bc.ConvertFrom("Red"); details.Text = "הת.ז. שהוזן לא נמצא במערכת "; } }
private void Add_Click(object sender, RoutedEventArgs e) { try { bl.AddTester(tester); MessageBox.Show("the tester \"" + tester.FirstName + "\" was added", ""); tester = new BE.Tester(); this.gridAddTester.DataContext = tester; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Tester functions /// </summary> public void Add_tester(BE.Tester tester) { try { TesterRoot = XElement.Load(TesterPath); if ((from item in TesterRoot.Elements() where item.Element("ID").Value == tester.ID select item).ToList().Count != 0) { throw new Exception("שגיאה בהכנסת בוחן: קיים כבר בוחן בעל מספר זהות זהה"); } XElement ID = new XElement("ID", tester.ID); XElement Last_name = new XElement("Last_name", tester.Last_name); XElement First_name = new XElement("First_name", tester.First_name); XElement Day = new XElement("Day", tester.Birth_date.Day); XElement Month = new XElement("Month", tester.Birth_date.Month); XElement Year = new XElement("Year", tester.Birth_date.Year); XElement Birth_date = new XElement("Birth_date", Day, Month, Year); XElement Gender = new XElement("Gender", (int)tester.Gender); XElement Phone = new XElement("Phone", tester.Phone); XElement City = new XElement("City", tester.Address.City); XElement Building_number = new XElement("Building_number", tester.Address.Building_number); XElement Street = new XElement("Street", tester.Address.Street); XElement Address = new XElement("Address", City, Building_number, Street); XElement Years_of_experience = new XElement("Years_of_experience", tester.Years_of_experience); XElement Specialization = new XElement("Specialization", (int)tester.Specialization); XElement Schedule = ScheduleToString(tester.Schedule); XElement Maximum_tests = new XElement("Maximum_tests", tester.Maximum_tests); XElement Maximum_distance = new XElement("Maximum_distance", tester.Maximum_distance); XElement Password = new XElement("Password", tester.Password); TesterRoot.Add(new XElement("Tester", ID, Last_name, First_name, Birth_date, Gender, Phone, Address, Years_of_experience, Specialization, Schedule, Maximum_distance, Maximum_tests, Password)); TesterRoot.Save(TesterPath); } catch (Exception ex) { if (ex.Message == "שגיאה בהכנסת בוחן: קיים כבר בוחן בעל מספר זהות זהה") { throw new Exception(ex.Message); } throw new Exception("שגיאה בשמירת בוחן: קרתה תקלה בגישה אל קובץ הנתונים, אנא נסה שוב"); } }
private void button_Click(object sender, RoutedEventArgs e) { try { bl.updateTester(tester); tester = new BE.Tester(); MessageBox.Show("the branch " + tester.id + " update ", ""); this.DataContext = tester; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void Idal.delleteTester(BE.Tester t) { foreach (BE.Tester item in DS.DataSource.testerList) { if (t.Id == item.Id) { exist = true; } } if (!exist) { throw new Exception("can not remove tester that not exist"); } DS.DataSource.testerList.Remove(t); }
public void updateTester(BE.Tester tester) { BE.Tester t = new BE.Tester(); foreach (BE.Tester item in DS.DataSource.testersList) { if (item.id == tester.id) { t = item; break; } } DS.DataSource.testersList.Remove(t); DS.DataSource.testersList.Add(tester); }
public SetTester() { InitializeComponent(); tester = new BE.Tester(); this.grid1.DataContext = tester; bl = BL.FactoryBL.GetBL(); this.TesterGenderComboBox.ItemsSource = Enum.GetValues(typeof(BE.Gender)); this.TesterTypeOfVehicle.ItemsSource = Enum.GetValues(typeof(BE.TypeOfVehicle)); this.TesterTypeOfGearControl.ItemsSource = Enum.GetValues(typeof(BE.TypeOfGearControl)); this.town1.Text = tester.TesterAddress.town; this.buildingNumber1.Text = tester.TesterAddress.ToString(); this.street1.Text = tester.TesterAddress.street; }
/// <summary> /// Log in as one of the tester in the list /// </summary> private void Tester_list_view_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { BE.Tester tester = Testers_list_view.SelectedItem as BE.Tester; MessageBoxResult result = MessageBox.Show("האם ברצונך להתחבר למערכת בתור " + tester.First_name + " " + tester.Last_name + "?", "התחברות כבוחן", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { TesterWindow testerWindow = new TesterWindow(tester); this.Close(); testerWindow.ShowDialog(); } } catch (Exception) { } }
public void Remove_tester(BE.Tester tester) { try { TesterRoot = XElement.Load(TesterPath); XElement TesterElement = (from item in TesterRoot.Elements() where item.Element("ID").Value == tester.ID select item).FirstOrDefault(); TesterElement.Remove(); TesterRoot.Save(TesterPath); } catch { throw new Exception("שגיאה במחיקת בוחן: לא ניתן למצוא את הבוחן"); } }
private void deleteButton_Click(object sender, RoutedEventArgs e) { try { bl.deleteTester(tester); BE.Tester or = new BE.Tester(); MessageBox.Show(tester.id + "'s \n" + "is Deleted"); TesterNameComboBox.ItemsSource = from item in bl.getAllTester() select item.id; this.DataContext = tester; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void IBL.delleteTester(BE.Tester t) { exist = false; foreach (BE.Tester item in dal.getTestersList()) { if (t.Id == item.Id) { exist = true; } } if (!exist) { throw new Exception("Error: Can not remove tester that is not exist"); } dal.delleteTester(t); }