示例#1
0
 private void CheckPasswordB_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         BE.Trainee trinne = MyBL.GetAllTrainees().Find(x => x.Id == traineeIdTB.Text);
         if (trinne == null)
         {
             throw new Exception("Trinne NOT FOUND!!!");
         }
         if (trinne.Password == YourPasswordBox.Password)
         {
             SingUpWindow.Visibility      = Visibility.Hidden;
             Singup.Visibility            = Visibility.Visible;
             Singup.Content               = trinne.Name + " " + trinne.FamilyName;
             testDateDatePicker.IsEnabled = true;
             CityTextBox.IsEnabled        = true;
             StreetNameTextBox.IsEnabled  = true;
             HouseNumberTextBox.IsEnabled = true;
             HourCB.IsEnabled             = true;
             YourPasswordBox.Visibility   = Visibility.Hidden;
             CheckPasswordB.Visibility    = Visibility.Hidden;
             PasswordLB.Visibility        = Visibility.Hidden;
         }
         else
         {
             throw new Exception("Wrong password");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 /// <summary>
 /// AppealRequest ctor
 /// </summary>
 public AppealRequest()
 {
     InitializeComponent();
     this.DataContext = test;
     test.AppealTest  = new BE.AppealTest();
     this.AppealTextBox.SelectionChanged += AppealTextBox_SelectionChanged;
     BE.Trainee trainee = bl.GetAllTrainees(t => t.ID == test.TraineeID).First();
     this.WelcomeTextBlock.Text = "שלום לך " + trainee.FirstName + ' ' + trainee.LastName + "! "
                                  + "להלן פרטי הטסט. תוכל לכתוב כאן את טענותיך כדי לערער על התוצאות.\n" + test + '\n'
                                  + "בטיחות - " + test.Indices["בטיחות"]
                                  + ", שליטה בהגה - " + test.Indices["שליטה בהגה"]
                                  + ", שליטה בהילוכים - " + test.Indices["שליטה בהילוכים"]
                                  + ", הסתכלות במראות - " + test.Indices["הסתכלות במראות"]
                                  + ", מתן זכות קדימה - " + test.Indices["מתן זכות קדימה"]
                                  + ", מהירות - " + test.Indices["מהירות"]
                                  + ", איתות - " + test.Indices["איתות"]
                                  + ", האצה והאטה בבטחה - " + test.Indices["האצה והאטה בבטחה"]
                                  + ", ציות לתמרורים - " + test.Indices["ציות לתמרורים"] + '\n'
                                  + ", שמירה רווח - " + test.Indices["שמירה רווח"]
                                  + ", בטיחות הולכי רגל - " + test.Indices["בטיחות הולכי רגל"]
                                  + ", עקיפות - " + test.Indices["עקיפות"]
                                  + ", חנייה - " + test.Indices["חנייה"]
                                  + ", פניות - " + test.Indices["פניות"]
                                  + ", השתלבות בתנועה - " + test.Indices["השתלבות בתנועה"]
                                  + ", אביזרי בטיחות - " + test.Indices["אביזרי בטיחות"]
                                  + ", נסיעה לאחור - " + test.Indices["נסיעה לאחור"]
                                  + ", שמירה על הימין - " + test.Indices["שמירה על הימין"] + '.';
 }
示例#3
0
        public StudentWindow(BE.Trainee trainee)
        {
            InitializeComponent();

            Trainee = trainee;
            thisWindow.DataContext       = Trainee;
            city1.DataContext            = Trainee.Address;
            building_number1.DataContext = Trainee.Address;
            street1.DataContext          = Trainee.Address;
            All_changes_saved            = true;

            if (iBL_Imp.GetTheoryStatus(Trainee) == BE.Thery_status.Passed)
            {
                sub_title.Text = "במסך זה באפשרותך להוסיף טסטים, למחוק טסטים עתידיים, לעדכן את פרטיך ועוד";

                theory_tab.Visibility  = Visibility.Collapsed;
                center_tab.Visibility  = Visibility.Visible;
                right_tab.Visibility   = Visibility.Visible;
                theory_test.Visibility = Visibility.Collapsed;


                // Restart the test display
                Right_tab_MouseDown(null, null);
            }
            else
            {
                TheoryTestUserControl UC = new TheoryTestUserControl(Trainee, sub_title, left_tab, center_tab, right_tab, theory_tab, center_tab_rec, new_test_view, theory_test, exit_button);
                UC.FlowDirection     = FlowDirection.LeftToRight;
                UC.VerticalAlignment = VerticalAlignment.Top;
                theory_test_view.Children.Add(UC);
            }
        }
示例#4
0
        public optionsToTrainee()
        {
            InitializeComponent();

            bl               = BL.factoryBL.getBL();
            currentTrainee   = new BE.Trainee();
            this.DataContext = currentTrainee;
        }
        private void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            IBl _bl = FactorySingletonBl.GetBl();

            BE.Trainee trainee = _bl.FindTraineeByID(IDCBox.SelectedItem as string);
            this.Close();
            new AddTrainee(trainee).Show();//send to add window
        }
示例#6
0
 public void receiveTrainee(BE.Trainee traineeFromNewTrainee)
 {
     traineeToUpdate         = new BE.Trainee(traineeFromNewTrainee);
     this.textBoxStreet.Text = traineeToUpdate._adressOfTrainee.street;
     this.textBoxApart.Text  = Convert.ToString(traineeToUpdate._adressOfTrainee.houseNumber);
     this.textBoxCity.Text   = traineeToUpdate._adressOfTrainee.city;
     this.DataContext        = traineeToUpdate;
 }
 public void Update_traniee(BE.Trainee trainee)
 {
     if ((DateTime.Today - trainee.Birth_date) < new TimeSpan(BE.Configuration.Minimum_Trainee_age * 365, 0, 0, 0))
     {
         throw new Exception("שגיאה בעדכון תלמיד: התלמיד לא בגיל הנצרך");
     }
     Dal.Update_traniee(trainee);
 }
 public void Remove_traniee(BE.Trainee trainee)
 {
     if (groupByTraineePass(trainee)[2].Count != 0)
     {
         throw new Exception("בעיה במחיקת משתמש: יש לך מבחנים עתידיים במערכת");;
     }
     Dal.Remove_traniee(trainee);
 }
示例#9
0
        public SetTestResult()
        {
            InitializeComponent();
            test    = new BE.Test();
            trainee = new BE.Trainee();

            this.result.DataContext = test;
            bl = BL.FactoryBL.GetBL();
        }
示例#10
0
        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();
            }
        }
示例#11
0
 public AddTrainee()
 {
     InitializeComponent();
     trainee = new BE.Trainee();
     this.gridAddTrainee.DataContext = trainee;
     bl = BL.FactoryBL.getBL();
     this.comboBox1.ItemsSource = Enum.GetValues(typeof(BE.gender));
     this.comboBox2.ItemsSource = Enum.GetValues(typeof(BE.vehicle));
 }
 /// <summary>
 /// Add Trainee ctor
 /// </summary>
 public AddTrainee()
 {
     InitializeComponent();
     bl = BL.Factory.GetInstance();
     this.gearBoxTypeComboBox.ItemsSource = Enum.GetValues(typeof(BE.GearBoxType));
     this.genderComboBox.ItemsSource      = Enum.GetValues(typeof(BE.Gender));
     this.vehicleComboBox.ItemsSource     = Enum.GetValues(typeof(BE.Vehicle));
     trainee          = new BE.Trainee();
     this.DataContext = trainee;
 }
示例#13
0
 public DeleteTrainee()
 {
     InitializeComponent();
     InitializeComponent();
     bl               = BL.FactoryBL.getBL();
     trainee          = new BE.Trainee();
     this.DataContext = trainee;
     TraineeNameComboBox.ItemsSource = from item in bl.getAllTester()
                                       select item.id;
 }
示例#14
0
        public NewTrainee()
        {
            InitializeComponent();

            trainee          = new BE.Trainee();
            this.DataContext = trainee;

            bl = BL.factoryBL.getBL();

            this.traineeGenderComboBox.ItemsSource = Enum.GetValues(typeof(BE.myEnums.genderType));
        }
示例#15
0
        public UpdateTrainee()
        {
            InitializeComponent();

            this.comboBoxCarType.ItemsSource     = Enum.GetValues(typeof(BE.myEnums.carType));
            this.comboBoxGearboxType.ItemsSource = Enum.GetValues(typeof(BE.myEnums.gearboxType));

            bl = BL.factoryBL.getBL();
            traineeToUpdate  = new BE.Trainee();
            this.DataContext = traineeToUpdate;
        }
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Traniee functions
        /// </summary>
        public void Add_traniee(BE.Trainee trainee)
        {
            try
            {
                TraineeRoot = XElement.Load(TraineePath);

                if ((from item in TraineeRoot.Elements()
                     where item.Element("ID").Value == trainee.ID
                     select item).ToList().Count != 0)
                {
                    throw new Exception("שגיאה בהכנסת תלמיד: קיים כבר תלמיד בעל מספר זהות זהה");
                }

                XElement ID         = new XElement("ID", trainee.ID);
                XElement Last_name  = new XElement("Last_name", trainee.Last_name);
                XElement First_name = new XElement("First_name", trainee.First_name);

                XElement Day        = new XElement("Day", trainee.Birth_date.Day);
                XElement Month      = new XElement("Month", trainee.Birth_date.Month);
                XElement Year       = new XElement("Year", trainee.Birth_date.Year);
                XElement Birth_date = new XElement("Birth_date", Day, Month, Year);

                XElement Gender = new XElement("Gender", (int)trainee.Gender);
                XElement Phone  = new XElement("Phone", trainee.Phone);

                XElement City            = new XElement("City", trainee.Address.City);
                XElement Building_number = new XElement("Building_number", trainee.Address.Building_number);
                XElement Street          = new XElement("Street", trainee.Address.Street);
                XElement Address         = new XElement("Address", City, Building_number, Street);

                XElement Pass_theory = new XElement("Pass_theory", trainee.Pass_theory.ToString());
                XElement Last_theory = new XElement("Last_theory", trainee.Last_theory.ToString("s"));

                XElement Gear_used      = new XElement("Gear_used", (int)trainee.Gear_used);
                XElement Learned        = new XElement("Learned", (int)trainee.Learned);
                XElement Driving_school = new XElement("Driving_school", trainee.Driving_school);
                XElement Teachers_name  = new XElement("Teachers_name", trainee.Teachers_name);
                XElement Num_of_classes = new XElement("Num_of_classes", trainee.Num_of_classes);
                XElement Password       = new XElement("Password", trainee.Password);
                XElement Email          = new XElement("Email", trainee.Email);

                TraineeRoot.Add(new XElement("Traniee", ID, Last_name, First_name, Birth_date, Gender, Phone, Address, Pass_theory, Last_theory, Gear_used, Learned, Driving_school, Teachers_name, Num_of_classes, Password, Email));
                TraineeRoot.Save(TraineePath);
            }
            catch (Exception ex)
            {
                if (ex.Message == "שגיאה בהכנסת תלמיד: קיים כבר תלמיד בעל מספר זהות זהה")
                {
                    throw new Exception(ex.Message);
                }

                throw new Exception("שגיאה בשמירת תלמיד: קרתה תקלה בגישה אל קובץ הנתונים, אנא נסה שוב");
            }
        }
示例#17
0
 bool IBL.successfullyPassedDrivingTest(BE.Trainee t)
 {
     foreach (BE.Test item in dal.getTestsList())
     {
         if ((item.TraineeId.CompareTo(t.ID) == 0) && (t.TypeOfVehicleHeStudied == item.TestOnCarOfType) && (item.Score == true))
         {
             return(true);
         }
     }
     return(false);
 }
        public addNewTest()
        {
            InitializeComponent();

            bl            = BL.factoryBL.getBL();
            traineeToTest = new BE.Trainee();
            newTest       = new BE.Test();
            leavingAdress = new BE.StructTypes.Adress();

            this.DataContext = newTest;
            isRunnig         = false;
        }
 public void Update_traniee(BE.Trainee trainee)
 {
     try
     {
         Remove_traniee(trainee);
         Add_traniee(trainee);
     }
     catch
     {
         throw new Exception("שגיאה בעדכון פרטי התלמיד בקובץ הנתונים");
     }
 }
        /// <summary>
        /// checks if trainee ever passed a test
        /// </summary>
        /// <param name="trainee"></param>
        /// <returns></returns>
        public bool Ever_passed_a_test(BE.Trainee trainee)
        {
            List <BE.Test> tests = SearchTest(trainee.ID, false, true, false);

            foreach (BE.Test item in tests)
            {
                if (item.Grade)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#21
0
        // ------------------------------------------------------------------------------------------
        // Traniee functions:

        /// <summary>
        /// Add trainee to the DS. If the trinee alredy exist throw exeption
        /// </summary>
        /// <param name="trainee">The trianee to add</param>
        public void Add_traniee(BE.Trainee trainee)
        {
            foreach (BE.Trainee item in DS.DataSource.Trainees_list)
            {
                if (item.ID == trainee.ID)
                {
                    throw new Exception("שגיאה בהכנסת תלמיד: קיים כבר תלמיד בעל מספר זהות זהה");
                }
            }

            // If  the ID dosent exist, add the tester
            DS.DataSource.Trainees_list.Add(trainee);
        }
示例#22
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         bl.updateTrainee(trainee);
         trainee = new BE.Trainee();
         MessageBox.Show("the trainee's details " + trainee.id + " update ", "");
         this.gridUpdateTrainee.DataContext = trainee;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 public void updateTrainee(BE.Trainee trainee)
 {
     BE.Trainee t = new BE.Trainee();
     foreach (BE.Trainee item in DS.DataSource.traineesList)
     {
         if (item.id == trainee.id)
         {
             t = item;
             break;
         }
     }
     DS.DataSource.traineesList.Remove(t);
     DS.DataSource.traineesList.Add(trainee);
 }
示例#24
0
        public SetTrainee()
        {
            InitializeComponent();
            trainee = new BE.Trainee();
            this.grid2.DataContext = trainee;
            bl = BL.FactoryBL.GetBL();

            this.TraineeGenderComboBox.ItemsSource = Enum.GetValues(typeof(BE.Gender));
            this.TypeOfVehicle.ItemsSource         = Enum.GetValues(typeof(BE.TypeOfVehicle));
            this.TypeOfGearControl.ItemsSource     = Enum.GetValues(typeof(BE.TypeOfGearControl));
            this.town1.Text           = trainee.StudentAddress.town;
            this.buildingNumber1.Text = trainee.StudentAddress.ToString();
            this.street1.Text         = trainee.StudentAddress.street;
        }
        /// <summary>
        ///
        /// </summary>
        public BE.Thery_status GetTheoryStatus(BE.Trainee trainee)
        {
            if (trainee.Pass_theory)
            {
                return(BE.Thery_status.Passed);
            }

            if (trainee.Last_theory.AddDays(1) > DateTime.Now)
            {
                return(BE.Thery_status.Hold);
            }

            return(BE.Thery_status.NeedToDo);
        }
示例#26
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                bl.addTrainee(trainee);

                MessageBox.Show("the trainee \"" + trainee.id);
                trainee = new BE.Trainee();
                this.gridAddTrainee.DataContext = trainee;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#27
0
 private void traineeListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     //Show Trainee number of tests by clicking the selected trniee
     if (traineeListView.SelectedIndex != -1)
     {
         List <BE.Trainee> trainees = my_bl.GetAllTrainees();
         int Index = trainees.IndexOf(trainees.Find(X => X.ToString() == traineeListView.SelectedItem.ToString()));
         if (Index != -1)
         {
             BE.Trainee Selected_Trainee = my_bl.GetAllTrainees()[Index];
             MessageBox.Show("Name: " + Selected_Trainee.Name + " " + Selected_Trainee.FamilyName
                             + "\n" + "Number of Tests: " + my_bl.numberOfTests(Selected_Trainee));
         }
     }
 }
 void Idal.delleteTrainee(BE.Trainee t)
 {
     foreach (BE.Trainee item in DS.DataSource.traineeList)
     {
         if (t.ID == item.ID)
         {
             exist = true;
         }
     }
     if (!exist)
     {
         throw new Exception("can not remove trainee that not exist");
     }
     DS.DataSource.traineeList.Remove(t);
 }
 /// <summary>
 /// Log in as one of the trainee in the list
 /// </summary>
 private void Student_list_view_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         BE.Trainee       trainee = Student_list_view.SelectedItem as BE.Trainee;
         MessageBoxResult result  = MessageBox.Show("האם ברצונך להתחבר למערכת בתור " + trainee.First_name + " " + trainee.Last_name + "?", "התחברות כתלמיד", MessageBoxButton.YesNo);
         if (result == MessageBoxResult.Yes)
         {
             StudentWindow studentWindow = new StudentWindow(trainee);
             this.Close();
             studentWindow.ShowDialog();
         }
     }
     catch (Exception) { }
 }
示例#30
0
 private void deleteButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         bl.deleteTrainee(trainee);
         BE.Trainee or = new BE.Trainee();
         MessageBox.Show(trainee.id + "'s \n" + "is Deleted");
         TraineeNameComboBox.ItemsSource = from item in bl.getAllTester()
                                           select item.id;
         this.DataContext = trainee;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }