private Boolean doLogin() {
            String accountText = "";
            String passwordText = password.Password;

            try {
                accountText = ((ComboBoxItem)accountNameComboBox.SelectedItem).Content.ToString();
            }
            catch (Exception e) {
                MessageBox.Show("Please select an account name from the Account Name dropdown.");
                return false;
            }

            
            ISessionFactory sessionfactory = DataBaseConnection.CreateSessionFactory();
            using (var session = sessionfactory.OpenSession()) {

                if (DataBaseConnection.overwriteSchema()) {

                    Account newAccount = new Account {
                        AccountName = "Administrator",
                        Password = "******"
                    };
                    using(var transaction = session.BeginTransaction()){
                        session.Save(newAccount);
                        transaction.Commit();
                    }
                    DataBaseConnection.saveCurrentSchema();
                }

                Account account = session.CreateCriteria<Account>().Add(NHibernate.Criterion.Expression
                        .And(NHibernate.Criterion.Expression.Eq("AccountName", accountText),
                             NHibernate.Criterion.Expression.Eq("Password", passwordText)))
                    .UniqueResult<Account>();
                if (account != null) {
                    MainWindow mainWindow = new MainWindow();
                    mainWindow.SetAccountType(accountText);
                    mainWindow.Show();
                    this.Close();
                } else {
                    MessageBox.Show("An account with the current details does not exist.");
                    password.Clear();
                    loginButton.Content = "Login";
                }
            }

            return false;
        }
 public void SetParentWindow(MainWindow mainWindow) {
     parentWindow = mainWindow;
 }