public static bool HasKey(string key)
 {
     try {
         return(SQLiteDataAccess.GetDataTable("Select key from APIKeys where key=@param1", CommandType.Text, null, new SQLiteParameter("@param1", key)).Rows.Count != 0);
     }
     catch (Exception ex) {
         //Let IIS handle the errors, but using own logging.
         Loggers.Log(Level.Error, "Failed getting API key from database", ex, new object[] { key });
         throw;
     }
 }
Exemplo n.º 2
0
        public static VMwareHostSystemInformation Get(string ipOrHostname)
        {
            try {
                var dt = SQLiteDataAccess.GetDataTable("Select * from VMwareHostSystemInformations where ipOrHostname=@param1", CommandType.Text, null, new SQLiteParameter("@param1", ipOrHostname));
                if (dt.Rows.Count == 0)
                {
                    return(null);
                }

                return(Parse(dt.Rows[0]));
            }
            catch (Exception ex) {
                //Let IIS handle the errors, but using own logging.
                Loggers.Log(Level.Error, "Failed retrieving vhost system info", ex, new object[] { ipOrHostname });
                throw;
            }
        }
Exemplo n.º 3
0
        public static VMwareHostSystemInformation[] GetAll()
        {
            try {
                var dt = SQLiteDataAccess.GetDataTable("Select * from VMwareHostSystemInformations");
                if (dt == null)
                {
                    return(new VMwareHostSystemInformation[0]);
                }

                var all = new VMwareHostSystemInformation[dt.Rows.Count];
                for (int i = 0; i != all.Length; i++)
                {
                    all[i] = Parse(dt.Rows[i]);
                }

                return(all);
            }
            catch (Exception ex) {
                //Let IIS handle the errors, but using own logging.
                Loggers.Log(Level.Error, "Failed retrieving all vhost system info", ex);
                throw;
            }
        }