Example #1
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            var resetResult = MessageBox.Show(" Are you sure you want to delete this trainee?", "Delete Trainee", MessageBoxButton.YesNo, MessageBoxImage.Information);

            if (resetResult == MessageBoxResult.Yes)
            {
                try
                {
                    bl.RemoveTrainee(trainee.ID);
                    bl.RemovePassword(trainee.ID);
                    if (!(GlobalSettings.User is Admin))
                    {
                        LoginWindow loginWindow = new LoginWindow();
                        loginWindow.Show();
                        Close();
                    }
                    else
                    {
                        if (bl.GetTrainees().Count() == 0)
                        {
                            TraineeWindow Window = new TraineeWindow();
                            Window.Show();
                            Close();
                        }
                        else
                        {
                            traineelist = (List <Trainee>)bl.GetTrainees();
                            RightButton_Click(sender, e);
                        }
                    }
                }
                catch (InvalidOperationException exc)
                {
                    MessageBox.Show(exc.Message, "Alert", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }

            //Window confirmDelete = new ConfirmDelete(sender, this, trainee.ID);
            //confirmDelete.ShowDialog();
        }
Example #2
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);
                }
            }
        }
Example #3
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            var resetResult = MessageBox.Show(" Are you sure you want to delete this admin?", "Delete Admin", MessageBoxButton.YesNo, MessageBoxImage.Information);

            if (resetResult == MessageBoxResult.Yes)
            {
                try
                {
                    bl.RemoveAdmin(admin.ID);
                    bl.RemovePassword(admin.ID);
                    if (GlobalSettings.User.Equals(admin))
                    {
                        LoginWindow loginWindow = new LoginWindow();
                        loginWindow.Show();
                        Close();
                    }
                    else
                    {
                        if (bl.GetAdmins().Count() == 0)
                        {
                            AdminWindow Window = new AdminWindow();
                            Window.Show();
                            Close();
                        }
                        else
                        {
                            adminList = (List <Admin>)bl.GetAdmins();
                            RightButton_Click(sender, e);
                        }
                    }
                }
                catch (InvalidOperationException exc)
                {
                    MessageBox.Show(exc.Message, "Alert", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
        }