private void txt_LoginName_LostFocus(object sender, RoutedEventArgs e)
 {
     if (!RegExpressions.RegexValidateEventName(txt_LoginName.Text))
     {
         WPFMessageBox.Show("Administrator names may only include numbers and letters.");
         btn_Save.IsEnabled = false;
     }
     else if ((lst_AdminList.Items.Contains(txt_LoginName.Text) && !(lst_AdminList.SelectedItem.ToString().Equals(txt_LoginName.Text))) || txt_LoginName.Text.Equals("superuser"))
     {
         WPFMessageBox.Show("An administrator with that name already exists. Please change the login name to be unique before continuing");
         btn_Save.IsEnabled = false;
     }
 }
        private void btn_Save_Click(object sender, RoutedEventArgs e)
        {
            if (!RegExpressions.RegexValidateEventName(txt_LoginName.Text))
            {
                WPFMessageBox.Show("Administrator names may only include numbers and letters.");
                btn_Save.IsEnabled = false;
            }
            else
            {
                //this check will ensure that if the user is logged in as the currently selected administrator and changes their name it won't break functionality
                if (lst_AdminList.SelectedItem.ToString().Equals(loggedInAs))
                {
                    loggedInAs = txt_LoginName.Text;
                }

                if (pwChanged)
                {
                    if (rdb_Full.IsChecked == true)
                    {
                        db.UpdateAdmin(lst_AdminList.SelectedItem.ToString(), txt_LoginName.Text, txt_Password.Password, txt_Email.Text, "1");
                    }
                    else if (rdb_Limited.IsChecked == true)
                    {
                        db.UpdateAdmin(lst_AdminList.SelectedItem.ToString(), txt_LoginName.Text, txt_Password.Password, txt_Email.Text, "2");
                    }
                }
                else
                {
                    if (rdb_Full.IsChecked == true)
                    {
                        db.UpdateAdmin(lst_AdminList.SelectedItem.ToString(), txt_LoginName.Text, txt_Email.Text, "1");
                    }
                    else if (rdb_Limited.IsChecked == true)
                    {
                        db.UpdateAdmin(lst_AdminList.SelectedItem.ToString(), txt_LoginName.Text, txt_Email.Text, "2");
                    }
                }

                lst_AdminList.ItemsSource = db.FindAdmins();
                clearForm();
            }
        }
        private void btn_ChnagePIN_Click(object sender, RoutedEventArgs e)
        {
            string pID = "", PIN = "";
            bool   formNotComplete = CheckIfNull();

            if (!formNotComplete)
            {
                bool samePIN = CheckIfSame(psw_ParentPIN1.Password, psw_ParentPIN2.Password);

                bool regexPIN = RegExpressions.RegexPIN(psw_ParentPIN1.Password);

                if (samePIN && regexPIN)
                {
                    pID = string.Format("{0:000000}", txt_ParentID1.Text);
                    PIN = string.Format("{0:0000}", psw_ParentPIN1.Password);

                    string hashedPIN = ChildcareApplication.AdminTools.Hashing.HashPass(PIN);
                    this.db.UpdateParentPIN(pID, hashedPIN);
                    this.Close();
                }
            }
        }