예제 #1
0
        private void btn_CheckConnection_Click(object sender, EventArgs e)
        {
            try
            {
                MysqlModel dbSettings = new MysqlModel();
                dbSettings.Host = txt_ip.Text;
                dbSettings.Port = Convert.ToUInt16(txt_port.Text);
                dbSettings.User = txt_user.Text;
                dbSettings.Password = txt_pass.Text;
                dbSettings.Database = txt_authdb.Text;

                using (Mysql databaseConnection = new Mysql(dbSettings))
                {
                    if (databaseConnection.OpenConnection())
                    {
                        if (databaseConnection.IsValidDatabase())
                            MessageBox.Show("Database connection successful.", RBACManagerModel.GetApplicationTitle());
                        else
                            MessageBox.Show("Database connection successful but the selected database does not contain alle needed tables with the needed columns. \n\nUpdate the database or change the settings to connect to a valid database.", RBACManagerModel.GetApplicationTitle());

                        databaseConnection.CloseConnection();
                    }
                    else
                        MessageBox.Show("Can not connect to database.", RBACManagerModel.GetApplicationTitle());
                }
            }
            catch(Exception)
            {
                MessageBox.Show("An error occured. Check your settings.", RBACManagerModel.GetApplicationTitle());
            }
        }
 public RBACManagerModel(string settingsPath)
 {
     this.settingsPath = settingsPath;
     databaseSettings = new MysqlModel();
     ini = new IniFile();
     LoadSettings();
     mysqlConnection = new Mysql(databaseSettings);
 }
 public SecurityLevelDBFunctions(Mysql mysqlConnection)
 {
     this.connection = mysqlConnection;
     mysqlConnection.OpenConnection();
 }
 public RoleDBFunctions(Mysql mysqlConnection)
 {
     connection = mysqlConnection;
     connection.OpenConnection();
 }
 public AccountDBFunctions(Mysql mysqlConnection)
 {
     this.connection = mysqlConnection;
     connection.OpenConnection();
 }
예제 #6
0
 public AccountModel(Mysql mysqlConnection)
 {
     this.accountFunctions = new AccountDBFunctions(mysqlConnection);
     LoadAccountList();
 }
예제 #7
0
 public RoleModel(Mysql mysqlConnection)
 {
     roleFunctions = new RoleDBFunctions(mysqlConnection);
         currentRole = null;
     LoadRoleList();
 }
 public SecurityLevelModel(Mysql mysqlConnection)
 {
     securityLevelFunctions = new SecurityLevelDBFunctions(mysqlConnection);
     securityLevels = securityLevelFunctions.GetSecurityLevelList();
 }