Beispiel #1
0
 // The only way to get the object's instance
 public static DBDetector GetDBDetector()
 {
     if (theDBDetectorInstance == null)
     {
         theDBDetectorInstance = new DBDetector();
     }
     return(theDBDetectorInstance);
 }
Beispiel #2
0
        private void okBtn_Click(object sender, System.EventArgs e)
        {
            if (passField.TextLength == 0)
            {
                MessageBox.Show(this,
                                "Please enter a valid password here.", "Input Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            if (confirmField.TextLength == 0)
            {
                MessageBox.Show(this,
                                "Please re-enter the password to confirm it.", "Input Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            if (!passField.Text.Equals(confirmField.Text))
            {
                // Fields don't match
                MessageBox.Show(this,
                                "The PINs do not match up. Please try again.", "PINs don't match!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            _IsSuper = (cmbUser.SelectedIndex == 1 ? true : false);

            if (_IsSuper && oldPIN.Text.Equals(_OldSuperPIN))
            {
                DBDetector.GetDBDetector().SuperLogin = true;
            }
            else if (!_IsSuper && oldPIN.Text.Equals(_OldManagerPIN))
            {
                DBDetector.GetDBDetector().ManagerLogin = true;
            }
            else
            {
                // Fields don't match
                MessageBox.Show(this,
                                "The Old password does not match up. Please try again.", "Old password doesn't match!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }
            // If we get here, then its ok to dispose of the dialog and set DialogResult to OK
            DialogResult = DialogResult.OK;
            Close();
        }