Пример #1
0
        public Bag ScanBagSecurity()
        {
            if (nbrOfSuspiciousBagPerDestination == null)
            {
                nbrOfSuspiciousBagPerDestination = new Dictionary <Destination?, Dictionary <SuspiciousBagtype, int> >();
                Airport.Destinations.Values.ToList().ForEach(destination =>
                {
                    // need to be fixed the items are being added twice
                    nbrOfSuspiciousBagPerDestination.Add(destination, new Dictionary <SuspiciousBagtype, int>
                    {
                        { SuspiciousBagtype.Flammables, 0 },
                        { SuspiciousBagtype.Drug, 0 },
                        { SuspiciousBagtype.Other, 0 },
                        { SuspiciousBagtype.Weapons, 0 },
                    });
                    destinationDistribution.Add(destination, 0);
                });
            }
            Bag b = null;

            try
            {
                lock (BagsQueue)
                {
                    b = base.Remove();
                }
            }
            catch (Exception)
            {
                // ignored
            }

            if (!b.IsNull())
            {
                foreach (var destination in Airport.Destinations.Where(destination =>
                                                                       destination.Key == b.TerminalAndGate))
                {
                    destinationDistribution[destination.Value]++;
                }
            }

            {
            }

            if (b?.GetSecurityStatus() == null)
            {
                return(b);
            }

            SuspiciousBagCategoryPerDestination(b);
            Airport.Storage.StoreSuspiciousBag(b);


            return(b);
        }
        public Bag ScanBagSecurity(Bag b)
        {
            Thread.Sleep(DelayTime);

            if (b?.GetSecurityStatus() == null)
            {
                return(b);
            }

            Airport.Storage.StoreSuspiciousBag(b);
            return(null);
        }