Example #1
0
 public static bool AccountExists(string accountName)
 {
     using (FalconOrchestratorDB db = new FalconOrchestratorDB())
     {
         return(db.Accounts.Any(x => x.AccountName.Equals((accountName))));
     }
 }
Example #2
0
 public static string GetConfigValue(string key)
 {
     using (FalconOrchestratorDB db = new FalconOrchestratorDB())
     {
         return(db.Configurations.Where(x => x.Key.Equals(key)).Select(x => x.Value).FirstOrDefault());
     }
 }
Example #3
0
 public static DateTime GetAccountTimestamp(string accountName)
 {
     using (FalconOrchestratorDB db = new FalconOrchestratorDB())
     {
         return(db.Accounts.Where(x => x.AccountName == accountName).Select(y => y.Timestamp).FirstOrDefault());
     }
 }
Example #4
0
 public static bool TestConnection()
 {
     using (FalconOrchestratorDB db = new FalconOrchestratorDB())
     {
         try
         {
             db.Database.Connection.Open();
             return(true);
         }
         catch (System.Data.SqlClient.SqlException e)
         {
             return(false);
         }
     }
 }
Example #5
0
        public static string GetResponderEmailAddress(int?responderId, AppConfiguration config)
        {
            try
            {
                if (responderId == null)
                {
                    return(config.EMAIL_CC);
                }

                using (FalconOrchestratorDB db = new FalconOrchestratorDB())
                {
                    return(db.Responders.Where(x => x.ResponderId == responderId).Select(y => y.EmailAddress).FirstOrDefault());
                }
            }
            catch (InvalidOperationException)
            {
                throw;
            }
        }
Example #6
0
 public static void SetConfigValue(string key, string value)
 {
     using (FalconOrchestratorDB db = new FalconOrchestratorDB())
     {
         if (!db.Configurations.Any(x => x.Key.Equals(key)))
         {
             Configuration config = new Configuration
             {
                 Key   = key,
                 Value = value
             };
             db.Configurations.Add(config);
         }
         else
         {
             Configuration config = db.Configurations.Where(x => x.Key.Equals(key)).FirstOrDefault();
             config.Value = value;
         }
         db.SaveChanges();
     }
 }
Example #7
0
 public static int GetNextDetectionID()
 {
     try
     {
         using (FalconOrchestratorDB db = new FalconOrchestratorDB())
         {
             Detection result = db.Detections.OrderByDescending(x => x.DetectionId).FirstOrDefault();
             if (result == null)
             {
                 return(1);
             }
             else
             {
                 return((int)result.DetectionId + 1);
             }
         }
     }
     catch (InvalidOperationException)
     {
         throw;
     }
 }