Exemplo n.º 1
0
        private SetupStatus GetDatabaseUpdateStatus()
        {
            var databaseStatusGenerator = new SetupStatusGenerator(_schemaRepository, _pathMapper);
            var databaseStatus          = databaseStatusGenerator.GetSetupStatus();

            return(databaseStatus);
        }
Exemplo n.º 2
0
        public ActionResult Update()
        {
            var databaseStatusGenerator = new SetupStatusGenerator(_schemaRepository, _pathMapper);
            var databaseStatus          = databaseStatusGenerator.GetSetupStatus();

            if (databaseStatus.StatusCode == SetupStatusCode.DatabaseError)
            {
                return(RedirectToRoute("SetupError"));
            }

            if (databaseStatus.StatusCode == SetupStatusCode.DatabaseNotSetup)
            {
                return(RedirectToRoute("InitializeDatabase"));
            }

            if (databaseStatus.StatusCode == SetupStatusCode.NoUpdates && !_settingsRepository.InstallationComplete)
            {
                return(RedirectToRoute("SetupIndex"));
            }

            if (databaseStatus.StatusCode == SetupStatusCode.NoUpdates && _settingsRepository.InstallationComplete)
            {
                return(RedirectToAction("Index", "Home", new { Area = "" }));
            }

            var scripts            = GetRunnableScripts().ToList().Select(r => Path.GetFileName(r.ScriptPath)).ToList();
            var databaseSetupModel = new DatabaseSetupModel {
                Scripts = scripts
            };

            return(View(databaseSetupModel));
        }
Exemplo n.º 3
0
        private bool GetDatabaseUpdateStatus()
        {
            var databaseStatusGenerator = new SetupStatusGenerator(_schemaRepository, _pathMapper);
            var databaseStatus          = databaseStatusGenerator.GetSetupStatus();

            return(GetUserId() == 1 && databaseStatus.StatusCode == SetupStatusCode.HasUpdates);
        }
Exemplo n.º 4
0
        private void VerifyInstallation()
        {
            var schemaInstance    = InstanceFactory.CreateSchemaInstance();
            var pathMapper        = InstanceFactory.CreatePathMapperInstance();
            var dbStatusGenerator = new SetupStatusGenerator(schemaInstance, pathMapper);

            Application["Installation_Status"] = dbStatusGenerator.GetSetupStatus();
        }