Ejemplo n.º 1
0
 public AddTrainee()
 {
     InitializeComponent();
     trainee = new BE.Trainee();
     _bl     = FactorySingletonBl.GetBl();
     init();
 }
Ejemplo n.º 2
0
 public Schedule()
 {
     InitializeComponent();
     _bl = FactorySingletonBl.GetBl();
     this.idTesters.ItemsSource = from t in _bl.GetTesters()
                                  select t.ID;
 }
Ejemplo n.º 3
0
        private void RemoveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (IDCBox.SelectedItem != null)
                {
                    IBl _bl = FactorySingletonBl.GetBl();

                    //get all tests of thid tester
                    var testersInTest = from t in _bl.GetTests()
                                        where t.TesterID == IDCBox.SelectedItem.ToString()
                                        select t;
                    if (testersInTest.Any())//need to remove the test first
                    {
                        throw new Exception("tester can not be remove. need to remove all tests that he was the tester");
                    }
                    MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure?", "Delete Tester", System.Windows.MessageBoxButton.YesNo);
                    if (messageBoxResult == MessageBoxResult.Yes)
                    {
                        string IDToRemove = IDCBox.SelectedItem as string;
                        if (_bl.RemoveTester(IDToRemove))
                        {
                            testers.Remove(IDToRemove);
                            MessageBox.Show(IDToRemove + " removed successfully");
                            this.Close();
                        }
                    }
                }
            }
            catch (Exception m)
            {
                MessageBox.Show(m.Message);
            }
        }
Ejemplo n.º 4
0
        private void AddTraineeButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (AddTraineeButton.Content.ToString() != "Update")//add for the first time
                {
                    IBl _bl = FactorySingletonBl.GetBl();
                    if (_bl.AddTrainee(trainee))
                    {
                        MessageBox.Show(trainee.ToString() + "added successfully");
                    }
                }
                else//update
                {
                    IBl _bl = FactorySingletonBl.GetBl();

                    if (_bl.UpdateTrainee(trainee))
                    {
                        MessageBox.Show(trainee.ToString() + "updated successfully");
                    }
                }
                this.Close();
            }
            catch (Exception m)
            {
                MessageBox.Show(m.Message);
            }
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            //init();
            Test test = new Test
            {
                Vehicle = Vehicle.car,
                Gear    = Gear.auto
            };

            Console.WriteLine("trainee id");
            test.TraineeID = Console.ReadLine();
            DateTime datetime = new DateTime(2020, 5, 5, 10, 0, 0);

            test.TestDay = datetime;
            Console.WriteLine("exit point");

            BL.IBl mofa = FactorySingletonBl.GetBl();


            List <Tester> testers = mofa.FindTesterToTest(test);

            if (testers.Count == 0)
            {
                Console.WriteLine("damn");
                Console.ReadKey();
                return;
            }
            test.TesterID = testers.First().ID;
            Console.WriteLine(test.ToString());

            Console.ReadKey();
        }
Ejemplo n.º 6
0
 private void RemoveButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (IDCBox.SelectedItem != null)
         {
             MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure?", "Delete Tester", System.Windows.MessageBoxButton.YesNo);
             if (messageBoxResult == MessageBoxResult.Yes)
             {
                 IBl _bl          = FactorySingletonBl.GetBl();
                 int TestToRemove = int.Parse(IDCBox.SelectedItem.ToString());
                 if (_bl.RemovedrivingTest(TestToRemove))
                 {
                     tests.Remove(TestToRemove);
                     MessageBox.Show(TestToRemove + " removed successfully");
                     this.Close();
                 }
             }
         }
     }
     catch (Exception m)
     {
         MessageBox.Show(m.Message);
     }
 }
        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
        }
Ejemplo n.º 8
0
 public AddTrainee(BE.Trainee traineeToUp)//update send an existing trainee
 {
     InitializeComponent();
     trainee = traineeToUp;
     this.IDTBox.IsReadOnly = true;
     _bl = FactorySingletonBl.GetBl();
     init();
     this.AddTraineeButton.Content = "Update";
 }
Ejemplo n.º 9
0
        public TesterView()
        {
            _bl = FactorySingletonBl.GetBl();
            InitializeComponent();
            this.LVUsers.ItemsSource = _bl.GetTesters();//shows all testers in the system

            this.cityCB.ItemsSource    = Enum.GetValues(typeof(Cities));
            this.VehicleCB.ItemsSource = Enum.GetValues(typeof(Vehicle));
        }
 public UpdateTestWin()
 {
     InitializeComponent();
     this.ResultGrid.Visibility = Visibility.Hidden;
     _bl = FactorySingletonBl.GetBl();
     //combo box with all serial numbers
     foreach (var item in _bl.GetTests())
     {
         tests.Add(item.SerialNumber);
     }
     SNCBox.ItemsSource = tests;
 }
Ejemplo n.º 11
0
        public TraineeView()
        {
            _bl = FactorySingletonBl.GetBl();
            InitializeComponent();

            this.LVUsers.ItemsSource = _bl.GetTrainees();//show all
            this.cityCB.ItemsSource  = Enum.GetValues(typeof(Cities));
            for (int i = 0; i < 30; i++)
            {
                TestsCB.Items.Add(i);
            }
        }
        public UpdateTraineeWind()
        {
            InitializeComponent();

            IBl _bl = FactorySingletonBl.GetBl();

            //combo box with all trainees ID
            foreach (var item in _bl.GetTrainees())
            {
                trainees.Add(item.ID);
            }
            IDCBox.ItemsSource = trainees;
        }
        public UpdateTesterWin()
        {
            InitializeComponent();

            IBl _bl = FactorySingletonBl.GetBl();

            //combo box with all testers ID
            foreach (var item in _bl.GetTesters())
            {
                testers.Add(item.ID);
            }
            IDCBox.ItemsSource = testers;
        }
 public RemoveTraineeWin()
 {
     InitializeComponent();
     try
     {
         IBl _bl = FactorySingletonBl.GetBl();
         //combo box with trainee ID's
         foreach (var item in _bl.GetTrainees())
         {
             trainees.Add(item.ID);
         }
         IDCBox.ItemsSource = trainees;
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Ejemplo n.º 15
0
 public RemoveTester()
 {
     InitializeComponent();
     try
     {
         IBl _bl = FactorySingletonBl.GetBl();
         //combo box show all testers id
         foreach (var item in _bl.GetTesters())
         {
             testers.Add(item.ID);
         }
         IDCBox.ItemsSource = testers;
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Ejemplo n.º 16
0
 public RemoveTestWin()
 {
     InitializeComponent();
     try
     {
         IBl _bl = FactorySingletonBl.GetBl();
         //combo box with all tests serial number
         foreach (var item in _bl.GetTests())
         {
             tests.Add(item.SerialNumber);
         }
         IDCBox.ItemsSource = tests;
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Ejemplo n.º 17
0
        public CreateTestWin()
        {
            InitializeComponent();
            _bl              = FactorySingletonBl.GetBl();
            test             = new BE.Test();
            this.DataContext = test;


            this.exitPointCityComboBox.ItemsSource = Enum.GetValues(typeof(Cities));

            this.traineeIDComboBox.ItemsSource       = _bl.GetTrainees();
            this.traineeIDComboBox.DisplayMemberPath = "ID";
            //test hour
            for (int i = 9; i < 15; i++)
            {
                string str = i + ":00";
                this.testHourComboBox.Items.Add(str);
            }



            findTesterButton.Visibility     = Visibility.Visible;
            availabilityDataGrid.Visibility = Visibility.Hidden;
            testerDetailsLabel.Visibility   = Visibility.Hidden;
            this.AddTestButton.Visibility   = Visibility.Hidden;


            //set the time picker to next 1000 days; friday & saturday will be unavailable;
            testDayDatePicker.DisplayDateStart = DateTime.Now;
            testDayDatePicker.DisplayDateEnd   = DateTime.Now + TimeSpan.FromDays(1000);
            var minDate = testDayDatePicker.DisplayDateStart ?? DateTime.MinValue;
            var maxDate = testDayDatePicker.DisplayDateEnd ?? DateTime.MaxValue;

            for (var d = minDate; d <= maxDate && DateTime.MaxValue > d; d = d.AddDays(1))
            {
                if (d.DayOfWeek == DayOfWeek.Saturday || d.DayOfWeek == DayOfWeek.Friday)
                {
                    testDayDatePicker.BlackoutDates.Add(new CalendarDateRange(d));
                }
            }
        }
Ejemplo n.º 18
0
        private void EnterButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //get schedule
                foreach (var item in SchedGrid.Children.OfType <CheckBox>())
                {
                    int row    = Grid.GetRow(item);
                    int column = Grid.GetColumn(item);
                    tester.WeeklySchedule.weeklySchedule[column - 1][row - 1] = item.IsChecked == true?true:false;
                }



                //add for the first time
                if (EnterButton.Content.ToString() != "update")
                {
                    IBl _bl = FactorySingletonBl.GetBl();
                    if (_bl.AddTester(tester))
                    {
                        MessageBox.Show(tester.ToString() + "added successfully");
                        this.Close();
                    }
                }
                else//update
                {
                    IBl _bl = FactorySingletonBl.GetBl();

                    if (_bl.UpdateTester(tester))
                    {
                        MessageBox.Show(tester.ToString() + "updated successfully");
                        this.Close();
                    }
                }
            }
            catch (Exception m)
            {
                MessageBox.Show(m.Message);
            }
        }
Ejemplo n.º 19
0
 public TestView()
 {
     InitializeComponent();
     _bl = FactorySingletonBl.GetBl();
     this.LVUsers.ItemsSource = _bl.GetTests();//show all tests
 }