private void button1_Click(object sender, EventArgs e) { if (!_IsDatabaseImported) { MessageBox.Show("You need to import your database (*.xml) first."); } else if (textBox1.Text != string.Empty && !_IsLoggedIn) { foreach (USER user in userList) { if (textBox1.Text.Equals(user.LoginID)) { if (USER.ValidateSHA1HashData(textBox2.Text, user.Password)) { this.Hide(); mainForm = new Mainform(); _IsLoggedIn = true; mainForm.loginForm = this; mainForm.userList = this.userList; mainForm.USERTable = this.USERTable; mainForm._isLoggedIn = this._IsLoggedIn; mainForm.path = this.pathOfXml; mainForm.CurrentLoginID = textBox1.Text; mainForm.Show(this); } else MessageBox.Show("Wrong password!"); } } if (!_IsLoggedIn) MessageBox.Show("LoginName doesn't exist in database!"); } else { MessageBox.Show("You must enter a LoginName"); } }
public NewUser(Form callingForm) { _mainForm = callingForm as Mainform; InitializeComponent(); }