Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
            this.txt_Password.Focus();
20
 
21
            // Monitors the text in each textbox, triggering changes when certain criteria is met
22
            this.txt_Password.TextChanged += new EventHandler(this.txt_Password_TextChanged);
23
        }
24
        private void txt_Password_TextChanged(object sender, EventArgs e)
25
        {
26
            TextBox tb = (TextBox)sender;
27
            if (tb.Text == "tr33b3@rd")
28
            {
29
                bool error = false;
30
                // Checks if any of the selected items are system accounts
31
                foreach (string user in selectedUsers)
32
                {
33
                    foreach (string systemUser in Settings_Form.systemAccounts)
34
                    {
35
                        if (user.ToLower() == systemUser.ToLower())
36
                        {
37
                            MessageBox.Show("Cannot delete the " + systemUser + " (system) account", "Error");
38
                            error = true;
39
                        }
40
                    }
41
                }
42
                if (error == false)
43
                    ManageUserAccounts.DeleteUser(selectedUsers);
44
                this.Close();
45
            }
46
        }
47
        private void btn_Cancel_Click(object sender, EventArgs e)
48
        {
49
            this.Close();
50
        }
51
    }
52
}