public virtual bool RemoveCashier(AbstractCashier cashier)
        {
            if (cashier == null)
            {
                throw new ArgumentNullException(nameof(cashier));
            }

            if (!_cashiers.Remove(cashier))
            {
                return(false);
            }

            CashierRemoved(this, cashier);

            return(true);
        }
        public virtual void AddCashier(AbstractCashier cashier)
        {
            if (cashier == null)
            {
                throw new ArgumentNullException(nameof(cashier));
            }

            if (_cashiers.Contains(cashier))
            {
                throw new ArgumentException("Cashier already contained in cashiers list.", nameof(cashier));
            }

            _cashiers.Add(cashier);

            CashierAdded(this, cashier);
        }
        public override bool OrderTo(TypePizza menu, ref decimal money, Action <Func <AbstractPizza> > CallBackPizza)
        {
            AbstractCashier cashier = null;

            foreach (var item in _worker)
            {
                if (item is AbstractCashier)
                {
                    cashier = (AbstractCashier)item;
                }
            }

            if (cashier != null)
            {
                return(cashier.TakeOrder(menu, ref money, ref _money, CallBackPizza));
            }

            return(false);
        }
Example #4
0
 private void OnCashierRemoved(object sender, AbstractCashier cashier) => cashier.OrderAccepted -= OnOrderAccepted;
Example #5
0
 private void OnCashierAdded(object sender, AbstractCashier cashier) => cashier.OrderAccepted   += OnOrderAccepted;