Beispiel #1
0
 private static void initDb()
 {
     // establecer como offline todos los servers y robots
     db.updateAllOffline();
     // intentar cargar ajustes, si no es posible, guardar unos nuevos ajustes y cargar
     ajuste = db.getAjuste();
     if (ajuste == null)
     {
         ajuste = new Ajuste();
         ajuste.defaultAjustes();
         short id = db.addAjuste(ajuste);
         db.activarAjuste(id);
         ajuste = db.getAjuste();
     }
     // si no existe el usuario con ID 1, crearlo con los datos por defecto
     db.initUsers();
 }
Beispiel #2
0
        private static string activarAjuste(DBStorage db, string message)
        {
            short id;

            try
            {
                id = Int16.Parse(message);
            }
            catch (Exception) { return("ERR"); }
            if (id <= 0)
            {
                return("ERR");
            }

            bool ok = db.activarAjuste(id);

            if (!ok)
            {
                return("ERR");
            }

            Program.ajuste = db.getAjuste();
            return("OK");
        }