示例#1
0
        public void PerformTask(ITasking tasking)
        {
            CheckTask(tasking.Name);

            if (!tasking.DoTask())
            {
                Console.WriteLine($"{GetName()} was unable to perform '{tasking.Name}' because the customer left unhappy...");
                TaskNumber--; // Task doesn't count if the customer left already...
            }
        }
        public object PerformTask(ITasking tasking)
        {
            // Given the current method here, in order to add a new task, we would go and modify this file and add more cases
            switch (tasking.Name)
            {
            case "find a table":
                return(FindEmptyTable());

            case "seat the customer":
                SeatCustomer(null, 1);
                return(null);

            case "take customer's order":
                return(TakeCustomerOrder(null));

            case "prepare food":
                PrepareFood("food");
                return(null);

            case "cook order":
                CookOrder("food");
                return(null);

            case "plate food":
                return(PlateFood("food"));

            case "deliver order":
                DeliverOrder(null, null);
                return(null);

            case "bill customer":
                BillCustomer(null);
                return(null);

            case "bus table":
                BusTable(1);
                return(null);

            default:
                throw new NotSupportedException("worker doesn't know how to do that task!");
            }
        }