예제 #1
0
        private void button_admin_Click(object sender, RoutedEventArgs e)
        {
            Window adminWindow = new AdminWindow();

            adminWindow.Show();
            Close();
        }
예제 #2
0
        private void BackButton_Click(object sender, RoutedEventArgs e)
        {
            Window win = new AdminWindow();

            win.Show();
            Close();
        }
예제 #3
0
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     //admin.Name = new Name(firstNameTextBox.Text, lastNameTextBox.Text);
     try
     {
         Functions.ValidatePerson(admin);
         bl.AddAdmin(admin);
         MessageBox.Show("Adding Successful!", "Alert", MessageBoxButton.OK, MessageBoxImage.Information);
         AdminWindow adminWindow = new AdminWindow();
         adminWindow.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 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);
                }
            }
        }