Пример #1
0
        private void BackButton_Click(object sender, RoutedEventArgs e)
        {
            Window testerWindow = new TesterWindow();

            testerWindow.Show();
            Close();
        }
Пример #2
0
        private void button_tester_Click(object sender, RoutedEventArgs e)
        {
            Window tester;

            if (GlobalSettings.User is Tester)
            {
                tester = new TesterView((Tester)GlobalSettings.User, null);
            }
            else
            {
                tester = new TesterWindow();
            }
            tester.Show();
            Close();
        }
Пример #3
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            tester.Address = new Address(city: City.Text, street: Street.Text, buildingNumber: Number.Text);
            tester.Name    = new Name(FirstName.Text, LastName.Text);
            Schedule sched = new Schedule();

            foreach (var item in sunCheckboxes)
            {
                sched[DayOfWeek.Sunday][sunCheckboxes.IndexOf(item) + 9] = (bool)item.IsChecked;
            }
            foreach (var item in monCheckboxes)
            {
                sched[DayOfWeek.Monday][monCheckboxes.IndexOf(item) + 9] = (bool)item.IsChecked;
            }
            foreach (var item in tueCheckboxes)
            {
                sched[DayOfWeek.Tuesday][tueCheckboxes.IndexOf(item) + 9] = (bool)item.IsChecked;
            }
            foreach (var item in wedCheckboxes)
            {
                sched[DayOfWeek.Wednesday][wedCheckboxes.IndexOf(item) + 9] = (bool)item.IsChecked;
            }
            foreach (var item in thursCheckboxes)
            {
                sched[DayOfWeek.Thursday][thursCheckboxes.IndexOf(item) + 9] = (bool)item.IsChecked;
            }
            tester.schedule = sched;
            bl = FactoryBL.GetBL();


            try
            {
                Functions.ValidatePerson(tester);
                bl.AddTester(tester);
                AutoClosingMessageBox.Show("Adding Successful!", "Alert", 3500, MessageBoxButton.OK, MessageBoxImage.Information);

                //MessageBox.Show("Adding Successful!", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
                TesterWindow testerWindow = new TesterWindow();
                testerWindow.Show();
                Close();
            }catch (InvalidOperationException exc) {
                MessageBox.Show(exc.Message, "Alert", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
Пример #4
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            var resetResult = MessageBox.Show(" Are you sure you want to delete this tester?", "Delete Tester", MessageBoxButton.YesNo, MessageBoxImage.Information);

            if (resetResult == MessageBoxResult.Yes)
            {
                try
                {
                    bl.RemoveTester(tester.ID);
                    bl.RemovePassword(tester.ID);
                    if (!(GlobalSettings.User is Admin))
                    {
                        LoginWindow loginWindow = new LoginWindow();
                        loginWindow.Show();
                        Close();
                    }
                    else
                    {
                        if (bl.GetTesters().Count() == 0)
                        {
                            TesterWindow testerWindow = new TesterWindow();
                            testerWindow.Show();
                            Close();
                        }
                        else
                        {
                            testerList = (List <Tester>)bl.GetTesters();
                            RightButton_Click(sender, e);
                        }
                    }
                }
                catch (InvalidOperationException exc)
                {
                    MessageBox.Show(exc.Message, "Alert", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
        }