예제 #1
0
        public void ExecuteAction(NewsEntryAction action, int portalId, int tabId, int?userId = null)
        {
            try {
                switch (action.Action)
                {
                case NewsEntryActions.Duplicate:
                    Duplicate(action.EntryId, portalId, tabId, action.ModuleId);
                    break;

                case NewsEntryActions.SyncTab:
                    SyncTab(action.EntryId, portalId, tabId);
                    break;

                case NewsEntryActions.StartDiscussion:
                    StartDiscussion(action.EntryId, portalId, userId.Value, action.Params [0]);
                    break;

                case NewsEntryActions.JoinDiscussion:
                    JoinDiscussion(action.EntryId, portalId);
                    break;
                }
            }
            catch (Exception ex) {
                var log = new LogInfo();
                log.Exception   = new ExceptionInfo(ex);
                log.LogTypeKey  = EventLogController.EventLogType.HOST_ALERT.ToString();
                log.LogPortalID = portalId;
                log.AddProperty("Message", $"Cannot execute {action.Action} action");
                EventLogController.Instance.AddLog(log);
            }
        }
예제 #2
0
 public NewsEntryActionViewModel(NewsEntryAction action, ViewModelContext context)
 {
     Action  = action.Action;
     EntryId = action.EntryId;
     Params  = action.Params;
     Enabled = action.Enabled;
     Context = context;
 }
예제 #3
0
 public void ExecuteAction(NewsEntryAction action, int portalId, int userId)
 {
     try {
         if (action.Action == NewsEntryActions.StartDiscussion)
         {
             StartDiscussion(action.Params [0], action.EntryId, portalId, userId);
         }
         else if (action.Action == NewsEntryActions.JoinDiscussion)
         {
             JoinDiscussion(action.EntryId, portalId);
         }
     }
     catch (Exception ex) {
         var log = new LogInfo();
         log.Exception   = new ExceptionInfo(ex);
         log.LogTypeKey  = EventLogController.EventLogType.HOST_ALERT.ToString();
         log.LogPortalID = portalId;
         log.AddProperty("Message", $"Cannot execute {action.Action} action");
         EventLogController.Instance.AddLog(log);
     }
 }