Beispiel #1
0
        private static bool DeleteAction(string label)
        {
            var action = Actions.FirstOrDefault(x => x.Label.Equals(label));

            if (action != null)
            {
                Actions.Remove(action);
                ActionsTableMgr.DeleteRule(label);
                return(true);
            }
            return(false);
        }
Beispiel #2
0
 public static bool AddAction(DeviceAction action, bool updateDB = true)
 {
     if (Actions.FirstOrDefault(x => x.ActionText.Equals(action.ActionText)) == null)
     {
         Actions.Add(action);
         if (updateDB)
         {
             ActionsTableMgr.AddRule(action);
         }
         return(true);
     }
     return(false);
 }
Beispiel #3
0
        public static void LoadActionsFromDB()
        {
            DataTable rules = ActionsTableMgr.GetActions();

            if (rules != null)
            {
                foreach (DataRow row in rules.Rows)
                {
                    var action = new DeviceAction();
                    action.DeviceName = row["DeviceName"].ToString();
                    action.Category   = row["Category"].ToString();
                    action.Label      = row["Label"].ToString();
                    action.ActionText = row["ActionText"].ToString();
                    action.Tooltip    = row["Tooltip"].ToString();
                    Actions.Add(action);
                }
                Logger.AddLogEntry(LogCategory.INFO, "Actions Inventory Loaded");
            }
        }
Beispiel #4
0
 public static bool UpdateActionsToDB()
 {
     return(ActionsTableMgr.UpdateActions(Actions));
 }