/// <summary> /// Check if there are some customers in the store. /// </summary> /// <returns>True, if any customer is in the store.</returns> public bool IsAnyCustomerInStore() { bool isAnyNotInQueue = Customers.Count > 0; bool isAnyInQueue = Convert.ToBoolean(CashBoxes.Any(c => c.IsEmpty() == false)); bool isAnyInFastQueue = Convert.ToBoolean(FastCashBoxes.Any(c => c.IsEmpty() == false)); return(isAnyInQueue || isAnyInFastQueue || isAnyNotInQueue); }
// Create the number of cash boxes. private void OpenCashBoxes() { for (int i = 0; i < CashBoxesNumber; i++) { CashBoxes.Add(new CashBox() { Name = $"Cash box #{i}" }); } for (int j = 0; j < FastCashBoxesNumber; j++) { FastCashBoxes.Add(new FastCashBox() { Name = $"Fast cash box #{j}" }); } }
// Close all cash boxes in the store. private void CloseCashBoxes() { CashBoxes.Clear(); FastCashBoxes.Clear(); }