private void cmdLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (system_options.ImportFlag)
                {
                    if (MessageBox.Show(this, "The system is currently locked by an administrator. It is recommended that you " +
                                        "wait until this update is complete before logging in to the system.\n\nWould you like to wait until " +
                                        "this update is complete?", "Update in progress", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) ==
                        DialogResult.Yes)
                    {
                        return;
                    }
                }

                user currentUser = ValidateLogin();
                if (currentUser != null)
                {
                    ActiveUser.UserObject = currentUser;
                    if (chkOpenExclusive.Checked)
                    {
                        if (currentUser.is_admin)
                        {
                            if (ActiveUser.UserObject.LoggedInUsers.Count > 0)
                            {
                                string userList = string.Empty;
                                foreach (user aUser in ActiveUser.UserObject.LoggedInUsers)
                                {
                                    if (aUser.id != ActiveUser.UserObject.id)
                                    {
                                        userList += aUser.username + "\n";
                                    }
                                }

                                if (MessageBox.Show(this, "The following users are currently logged in to the system.\n\n" + userList + "\nIf you continue, they might " +
                                                    "have problems with any claims they currently have open. Would you like to continue anyway?", "Continue with import?",
                                                    MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                                {
                                    return;
                                }
                            }
                            system_options.SetImportFlag(true);
                        }
                        else
                        {
                            MessageBox.Show(this, "You cannot open the program exclusively if you are not an administrator.");
                        }
                    }


                    DialogResult = DialogResult.OK;


                    ActiveUser.UserObject.Login();
                    if (chkOpenExclusive.Checked)
                    {
                        ActiveUser.LogAction(ActiveUser.ActionTypes.Login, "Exclusive");
                    }
                    else
                    {
                        ActiveUser.LogAction(ActiveUser.ActionTypes.Login);
                    }

                    C_DentalClaimTracker.Properties.Settings.Default.LastUserName = ActiveUser.UserObject.username;
                    C_DentalClaimTracker.Properties.Settings.Default.Save();

                    Close();

                    mdiMain.Instance().HideAdminMenu();
                }
                else
                {
                    LoggingHelper.Log("An invalid login was detected. User name: " + txtUserName.Text, LogSeverity.Information);
                    MessageBox.Show(this, "Incorrect login.", "Incorrect login");
                }
            }
            catch (Exception err)
            {
                LoggingHelper.Log(err);
                string errorInfo = err.Message;

                Exception inner = err.InnerException;
                while (inner != null)
                {
                    errorInfo += "\n\n" + inner.Message;
                    inner      = inner.InnerException;
                }

                if (MessageBox.Show(this, "There was an error connecting to the server to validate login information. Would you like to edit " +
                                    "the current server settings?\n\nError:" + errorInfo, "No database connection", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
                {
                    frmSettings toShow = new frmSettings(true);
                    toShow.ShowDialog(this);
                }
            }
        }
        private void mnuSettings_Click(object sender, EventArgs e)
        {
            frmSettings toShow = new frmSettings();

            toShow.ShowDialog(this);
        }