| 9 |
Kevin |
1 |
using System;
|
|
|
2 |
using System.Collections.Generic;
|
|
|
3 |
using System.ComponentModel;
|
|
|
4 |
using System.Data;
|
|
|
5 |
using System.Drawing;
|
|
|
6 |
using System.Linq;
|
|
|
7 |
using System.Text;
|
|
|
8 |
using System.Windows.Forms;
|
|
|
9 |
|
|
|
10 |
namespace SWAT_Office_App
|
|
|
11 |
{
|
|
|
12 |
public partial class DeleteUserVerify_Form : Form
|
|
|
13 |
{
|
|
|
14 |
private List<string> selectedUsers = new List<string>();
|
|
|
15 |
public DeleteUserVerify_Form(List<string> users)
|
|
|
16 |
{
|
|
|
17 |
selectedUsers = users;
|
|
|
18 |
InitializeComponent();
|
|
|
19 |
//MessageBox.Show("Warning! Verify that all shares are closed before deleting account!", "Warning!");
|
|
|
20 |
this.txt_Password.Focus();
|
|
|
21 |
|
|
|
22 |
// Monitors the text in each textbox, triggering changes when certain criteria is met
|
|
|
23 |
this.txt_Password.TextChanged += new EventHandler(this.txt_Password_TextChanged);
|
|
|
24 |
}
|
|
|
25 |
private void txt_Password_TextChanged(object sender, EventArgs e)
|
|
|
26 |
{
|
|
|
27 |
TextBox tb = (TextBox)sender;
|
|
|
28 |
if (tb.Text == "tr33b3@rd")
|
|
|
29 |
{
|
|
|
30 |
bool error = false;
|
|
|
31 |
// Checks if any of the selected items are system accounts
|
|
|
32 |
foreach (string user in selectedUsers)
|
|
|
33 |
{
|
|
|
34 |
foreach (string systemUser in Settings_Form.systemAccounts)
|
|
|
35 |
{
|
|
|
36 |
if (user.ToLower() == systemUser.ToLower())
|
|
|
37 |
{
|
|
|
38 |
MessageBox.Show("Cannot delete the " + systemUser + " (system) account", "Error");
|
|
|
39 |
error = true;
|
|
|
40 |
}
|
|
|
41 |
}
|
|
|
42 |
}
|
|
|
43 |
if (error == false)
|
|
|
44 |
ManageUserAccounts.DeleteUser(selectedUsers);
|
|
|
45 |
this.Close();
|
|
|
46 |
}
|
|
|
47 |
}
|
|
|
48 |
private void btn_Cancel_Click(object sender, EventArgs e)
|
|
|
49 |
{
|
|
|
50 |
this.Close();
|
|
|
51 |
}
|
|
|
52 |
}
|
|
|
53 |
}
|