Exemplo n.º 1
0
        public Flow[] FilterFlows(string filter, List <Flow> flows,
                                  DateTime start, DateTime end)
        {
            CustomFilter cFilter = getFilterByName(filter);

            //if filter not found return nothing
            if (cFilter == null)
            {
                return(null);
            }

            if (cFilter.Text.Equals(string.Empty))
            {
                return((from f in flows
                        where f.StartTime.CompareTo(start) >= 0 &&
                        f.EndTime.CompareTo(end) < 0
                        select f).ToArray());
            }

            object[] loCodeParms = new object[3];
            loCodeParms[0] = flows;
            loCodeParms[1] = start;
            loCodeParms[2] = end;
            object loResult = cFilter.Obj.GetType().InvokeMember(
                "FilterFlows", BindingFlags.InvokeMethod,
                null, cFilter.Obj, loCodeParms);

            Flow[] res = (Flow[])loResult;
            return((from f in res.ToList()
                    orderby f.StartTime
                    select f).ToArray());
        }
Exemplo n.º 2
0
        public void RemoveFilter(string name)
        {
            CustomFilter filter = getFilterByName(name);

            if (filter != null)
            {
                _filters.Remove(filter);
            }
        }
Exemplo n.º 3
0
        public bool UpdateFilter(string name)
        {
            CustomFilter filter = getFilterByName(name);

            if (filter != null)
            {
                _filters.Remove(filter);
            }
            return(AddFilter(name));
        }
Exemplo n.º 4
0
        private CustomFilter getFilterByName(string filter)
        {
            CustomFilter cFilter = null;

            //find custom filter by name
            foreach (CustomFilter fil in _filters)
            {
                if (fil.Name.Equals(filter))
                {
                    cFilter = fil;
                    break;
                }
            }
            //if filter not found return nothing
            return(cFilter);
        }
Exemplo n.º 5
0
        public bool MatchFilter(string filter, Flow flow)
        {
            CustomFilter cFilter = getFilterByName(filter);

            if (cFilter == null)
            {
                return(false);
            }
            if (cFilter.Text.Equals(string.Empty))
            {
                return(true);
            }

            object[] loCodeParms = new object[1];
            loCodeParms[0] = flow;
            object loResult = cFilter.Obj.GetType().InvokeMember(
                "MatchFilter", BindingFlags.InvokeMethod,
                null, cFilter.Obj, loCodeParms);

            return((bool)loResult);
        }
Exemplo n.º 6
0
        public bool RenameFilter(string oldName, string newName)
        {
            //find filter by old name
            CustomFilter filter = getFilterByName(oldName);

            if (filter == null)
            {
                _errorMsg = "Filter '" + oldName + "' does not exist";
                return(false);
            }
            if (!oldName.Equals(newName))
            {
                //verify that filter with new name does not exist
                CustomFilter filter1 = getFilterByName(newName);
                if (filter1 != null)
                {
                    _errorMsg = "Filter '" + newName + "' already exists";
                    return(false);
                }
            }
            filter.Name = newName;
            return(true);
        }
Exemplo n.º 7
0
        public bool DoNotify(string filter)
        {
            CustomFilter fil = getFilterByName(filter);

            return(fil.Notify);
        }
Exemplo n.º 8
0
        public void ChangeNotify(string filter)
        {
            CustomFilter fil = getFilterByName(filter);

            fil.Notify = !fil.Notify;
        }
Exemplo n.º 9
0
        public string GetFilterText(string filter)
        {
            CustomFilter fil = getFilterByName(filter);

            return((fil == null) ? string.Empty : fil.Text);
        }