Пример #1
0
        public AlertActionBase[] GetActions(int pageNumber)
        {
            var startIndex = pageSize * pageNumber;

            if (startIndex > alertActions.Values.Count)
            {
                return(new AlertActionBase[] {});
            }
            var values = new AlertActionBase[alertActions.Values.Count];

            alertActions.Values.CopyTo(values, 0);
            var targetSize = pageSize;

            if (startIndex + pageSize > values.Length)
            {
                targetSize = values.Length - startIndex;
            }
            var ret = new AlertActionBase[targetSize];

            for (int i = startIndex, j = 0; i < startIndex + targetSize; i++, j++)
            {
                ret[j] = values[i];
                ret[j].Initialize();
            }
            return(ret);
        }
Пример #2
0
        public AlertActionBase AddAction(AlertActionBase action)
        {
            var add = (AlertActionBase)action.Clone();

            add.Id = GetIdAndIncrement();
            alertActions.Add(add.Id, add);
            return(add);
        }
Пример #3
0
        public AlertActionBase[] GetLinkedActions(Guid ruleId)
        {
            List <int> list;

            if (ruleToActionMap.TryGetValue(ruleId, out list))
            {
                var actions = new AlertActionBase[list.Count];
                for (int i = 0; i < list.Count; i++)
                {
                    actions[i] = GetAction(list[i]);
                }
                return(actions);
            }
            return(new AlertActionBase[0]);
        }
Пример #4
0
 public void UpdateAction(int actionId, AlertActionBase update)
 {
     alertActions[actionId] = (AlertActionBase)update.Clone();
 }