Exemplo n.º 1
0
 public static int UpdateVersion(int currentVersion)
 {
     using (DataBaseDao dao = new DataBaseDao())
     {
         return dao.SetDatabaseVersion(currentVersion);
     }
 }
Exemplo n.º 2
0
        public static bool StartupProcess()
        {
            int currentVersion = -1;
            bool isContinue = false;
            try {
                isContinue = Init.IsSetup();
                if (isContinue)
                {
                    do {
                        try {
                            using (DataBaseDao dao = new DataBaseDao()) {
                                currentVersion = dao.GetDatabaseVersion();
                            }
                        }
                        catch (Exception ex) {
                            logger.Log(LogLevel.Error, "Startup Error : " + ex.Message);
                            if (SysVars.isConsole)
                                Console.WriteLine(ex.Message);
                            throw;
                        }
                    }
                    while (!Update.Init.Update(currentVersion));  // TODO: Take this off so that DB gets manually updated

                    if (SysVars.isConsole)
                        Console.WriteLine("Console Service Host");
                    if (SysVars.isConsole)
                        Console.WriteLine("Checking For Updates... Complete");
                    if (SysVars.isConsole)
                        Console.WriteLine("Database Version :" + currentVersion);
                    if (SysVars.isConsole)
                        Console.WriteLine("Application Version :" + SysVars.appVersion);

                    Init.Startup();
                }
            }
            catch (Exception) {
                throw;
            }
            return isContinue;
        }
Exemplo n.º 3
0
 public void ShowAdmins()
 {
     if (DbCurrenVersion == 0)
     {
         if (this.hostSettings != null)
         {
             if (hostSettings.ValidateModel())
             {
                 using (HostDAO dao = new HostDAO())
                 {
                     dao.SaveHostSettings(this.hostSettings);
                 }
             }
         }
         ServiceHost.Implementation.Init.GetSettings();
         using (DataBaseDao dao = new DataBaseDao())
         {
             this.DbCurrenVersion = dao.GetDatabaseVersion();
         }
     }
     if (ServiceHost.Update.Init.Update(DbCurrenVersion))
         CurrentView = ManagerViews.Admins;
 }
Exemplo n.º 4
0
        public void Save()
        {
            if (this.hostSettings != null) {
                if (hostSettings.ValidateModel()) {
                    using (HostDAO dao = new HostDAO()) {
                        dao.SaveHostSettings(this.hostSettings);
                        AppVars.dbSettings = hostSettings;
                    }
                }
            }

            if (this.hostOptions != null) {
                if (HostOptions.Validate(hostOptions)) {
                    using (HostDAO dao = new HostDAO()) {
                        dao.SaveHostOptions(this.hostOptions);
                    }
                }
            }

            if (this.accountingSettings != null)
            {
                using (HostDAO dao = new HostDAO())
                {
                    dao.SaveAccountingSettings(this.AccountingSettings);
                }
            }

            SaveAdministrators(adminList);

            if (DbCurrenVersion == 0)
            {
                ServiceHost.Implementation.Init.GetSettings();
                using (DataBaseDao dao = new DataBaseDao())
                {
                    this.DbCurrenVersion = dao.GetDatabaseVersion();
                }

                ServiceHost.Update.Init.Update(DbCurrenVersion);
            }
            Environment.Exit(1);
        }