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); }
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); }
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"); } }
public static bool UpdateActionsToDB() { return(ActionsTableMgr.UpdateActions(Actions)); }