Esempio n. 1
0
        private void ConnectOffline()
        {
            context.Splash.SetLabel("Starte Offline-Datenbank...");
            DirectoryInfo derbyDir = new DirectoryInfo("azusaOffline");

            if (!derbyDir.Exists)
            {
                context.Splash.InvokeClose();
                MessageBox.Show("Die Offline-Datenbank existiert nicht!");
                return;
            }
            context.DatabaseDriver = new OfflineDriver();

            context.Splash.SetLabel("Überprüfe Lizenz...");
            StartupFailReason licenseState = context.DatabaseDriver.CheckLicenseStatus(context.LicenseKey);

            switch (licenseState)
            {
            case StartupFailReason.NoError:
                break;

            default:
                throw new NotImplementedException(licenseState.ToString());
            }
        }
Esempio n. 2
0
        private void ConnectOnline()
        {
            context.Splash.SetLabel("Verbinde mit Datenbank...");
            context.DatabaseDriver = new PostgresDriver();
            if (!context.DatabaseDriver.ConnectionIsValid())
            {
                MessageBox.Show("Verbindung zur Datenbank ist ungültig!");
                context.DatabaseDriver.Dispose();
                context.DatabaseDriver = null;
                return;
            }

            context.Splash.SetLabel("Überprüfe Lizenz...");
            StartupFailReason licenseState = context.DatabaseDriver.CheckLicenseStatus(context.LicenseKey);

            switch (licenseState)
            {
            case StartupFailReason.NoError:
                break;

            case StartupFailReason.LicenseRevoked:
            case StartupFailReason.LicenseNotInDatabase:
                throw new StartupFailedException(licenseState);

            default:
                throw new NotImplementedException(licenseState.ToString());
            }

            context.Splash.SetLabel("Validiere Datenbank...");
            List <string> knownTables = context.DatabaseDriver.GetAllSchemas();

            if (knownTables.Count < 3)
            {
                throw new DatabaseValidationFailedException();
            }

            bool hasAzusaTables = knownTables.Any(x => x.ToLowerInvariant().StartsWith("azusa"));

            if (!hasAzusaTables)
            {
                throw new DatabaseValidationFailedException();
            }

            context.Splash.SetLabel("Führe Aufgaben aus, die nach dem Herstellen der Verbindung ausgeführt werden müssen...");
            ExecutePreSyncTasks();

            try
            {
                SynchronizeIfNecessary();
            }
            catch (KeyNotFoundException knfe)
            {
                throw new StartupFailedException(knfe, StartupFailReason.IniBroken);
            }
        }
Esempio n. 3
0
 public StartupFailedException(Exception innerException, StartupFailReason sfr) :
     base(sfr.ToString(), innerException)
 {
     Data.Add("StartupFailReason", sfr);
 }