Пример #1
0
        public void ProcessWhitelist(ReadsDataEvent read)
        {
            DateTime  start   = DateTime.Now;
            ArrayList results = new ArrayList();

            long[] ids = this.SelectIDsWhere("active = 'True' and whitelist = 'True'", "priority", true);
            if (ids != null)
            {
                for (int i = 0; i < ids.Length; i++)
                {
                    try
                    {
                        results.Add(this.GetHotlist(ids[i]).BeginFindVrm(read.VRM));
                    }
                    catch (Exception ex)
                    {
                        //PIPS.Logger.Exception(ex);
                        results.Add(null);
                    }
                }
                int            strikes   = 0;
                long           id        = -1;
                ReadsDataEvent violation = null;
                for (int i = 0; i < ids.Length; i++)
                {
                    try
                    {
                        IAsyncResult        result = results[i] as IAsyncResult;
                        DataEventCollection vrms   = this.GetHotlist(ids[i]).EndFindVrm(result);
                        if (vrms.Count == 0)
                        {
                            if (null == violation)
                            {
                                id        = ids[i];
                                violation = read;
                            }
                            strikes++;
                        }
                    }
                    catch (Exception ex)
                    {
                        //PIPS.Logger.Exception(ex);
                    }
                }
                if (strikes == ids.Length && null != violation)
                {
                    //PIPS.Logger.WriteLine("Whitelist violation('{0}')", violation.VRM);
                    read.LinkedDataEvents(0).Add(this.CopyWhitelistToHit(id, violation));
                }
            }
            //PIPS.Logger.WriteLine("HotListsDataTable.ProcessWhitelist({0})", (DateTime.Now - start).TotalMilliseconds);
        }
Пример #2
0
        public void ProcessRead(ReadsDataEvent read)
        {
            DateTime  start   = DateTime.Now;
            ArrayList results = new ArrayList();

            long[] ids = this.SelectIDsWhere("active = 'True' and whitelist = 'False'", "priority", true);

            if (ids != null)
            {
                string vrm = this.FuzzyFilter.Filter(read.VRM);
                for (int i = 0; i < ids.Length; i++)
                {
                    try
                    {
                        results.Add(this.GetHotlist(ids[i]).BeginFindVrm(vrm));
                    }
                    catch (Exception ex)
                    {
                        //PIPS.Logger.Exception(ex);
                        results.Add(null);
                    }
                }
                for (int i = 0; i < ids.Length; i++)
                {
                    try
                    {
                        if (results[i] != null)
                        {
                            IAsyncResult        result = results[i] as IAsyncResult;
                            DataEventCollection vrms   = this.GetHotlist(ids[i]).EndFindVrm(result);
                            foreach (PIPS.PAGIS.Db.HotLists.HotListDataEvent hotlist in vrms)
                            {
                                read.LinkedDataEvents(0).Add(this.CopyHotlistToHit(ids[i], hotlist));
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        //PIPS.Logger.Exception(ex);
                    }
                }
            }
            if (!read.Permit)
            {
                ProcessWhitelist(read);
            }
            //PIPS.Logger.WriteLine("HotListsDataTable.ProcessRead({0})", (DateTime.Now - start).TotalMilliseconds);
        }
Пример #3
0
        private HitsDataEvent CopyWhitelistToHit(long hotlist_id, ReadsDataEvent read)
        {
            HitsDataEvent     hit = (this.DataFile.DataRepository as SystemRepository).Events.Reads.Hits.CreateHitsDataEvent();
            HotListsDataEvent hl  = this.SelectByID(hotlist_id) as HotListsDataEvent;

            hit.Alarm        = hl.Alarm;
            hit.DisplayColor = hl.DisplayColor;
            hit.Field1       = string.Empty;
            hit.Field2       = string.Empty;
            hit.Field3       = string.Empty;
            hit.Field4       = string.Empty;
            hit.Field5       = string.Empty;
            hit.HotList      = hl.Name;
            hit.Information  = string.Empty;
            hit.IsCovert     = hl.IsCovert;
            hit.PNCID        = string.Empty;
            hit.Priority     = hl.Priority;
            hit.VRM          = read.VRM;
            hit.Alerting     = hl.Alerting;
            return(hit);
        }