Rev 63 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace SWAT_Office_App{public partial class Add_System_Account_Form : Form{public Add_System_Account_Form(){InitializeComponent();this.btn_Ok.Enabled = false;this.txt_AddSystemAccount.TextChanged += new EventHandler(this.txt_TextChanged);}private void txt_TextChanged(object sender, EventArgs e){TextBox tb = (TextBox)sender;if (tb.Text.Length == 0)this.btn_Ok.Enabled = false;elsethis.btn_Ok.Enabled = true;}private void btn_Cancel_Click(object sender, EventArgs e){this.Close();}private void btn_Ok_Click(object sender, EventArgs e){bool error = false;// Checks if account already exists in the list of system accountsforeach (string systemUser in Settings_Form.systemAccounts){if (this.txt_AddSystemAccount.Text.ToLower() == systemUser.ToLower()){MessageBox.Show("Account is already in the list of system accounts", "Error");error = true;this.txt_AddSystemAccount.Text = "";this.txt_AddSystemAccount.Focus();}}if (error == false){Settings_Form.systemAccounts.Add(txt_AddSystemAccount.Text);this.Close();}}}}