Esempio n. 1
0
        public ActionResult Index()
        {
            var databaseStatusGenerator = new SetupStatusGenerator(_schemaRepository, _pathMapper);
            var databaseStatus = databaseStatusGenerator.GetSetupStatus();

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

            if (databaseStatus.StatusCode == SetupStatusCode.HasUpdates)
            {
                return RedirectToRoute("UpdateDatabase");
            }

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

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

            var databaseSetupModel = new DatabaseSetupModel { Scripts = _pathMapper.GetAvailableScripts().ToList().Select(s => Path.GetFileName(s.ScriptPath)).ToList() };
            return View(databaseSetupModel);
        }
Esempio n. 2
0
 private SetupStatus GetDatabaseUpdateStatus()
 {
     var databaseStatusGenerator = new SetupStatusGenerator(_schemaRepository, _pathMapper);
     var databaseStatus = databaseStatusGenerator.GetSetupStatus();
     return databaseStatus;
 }
Esempio n. 3
0
 private bool GetDatabaseUpdateStatus()
 {
     var databaseStatusGenerator = new SetupStatusGenerator(_schemaRepository, _pathMapper);
     var databaseStatus = databaseStatusGenerator.GetSetupStatus();
     return GetUserId() == 1 && databaseStatus.StatusCode == SetupStatusCode.HasUpdates;
 }
Esempio 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();
 }