private void Login() { string password = txtPassword.Text; if (IsMasterPassword(password)) { _isMaster = true; this.Close(); } else { try { IDataController dtCtrl = Properties.Settings.Default.IsClient ? RemoteDataController.Instance : LocalDataController.Instance; int employeeNumber = Convert.ToInt32(txtEmployeeNumber.Text); _user = dtCtrl.GetFaceIDUser(employeeNumber); if (_user == null) { MessageBox.Show("User not found."); } else { if (_user.Password != password) { MessageBox.Show("Incorrect password."); } else { _userLoginCaller.SetUserAccess(_user); this.Close(); } } } catch (FormatException) { MessageBox.Show("Invalid Employee Number."); } catch (OleDbException) { MessageBox.Show("Cannot connect to Database."); Environment.Exit(0); } catch (Exception ex) { Util.ShowErrorMessage(ex); } } }