Exemple #1
0
        static void Main(string[] args)
        {
            var request = new LeaveRequest {
                Employee = "John Smith", LeaveDays = 34
            };

            ILeaveRequestHandler supervisor = new Supervisor();
            ILeaveRequestHandler manager    = new ProjectManager();
            ILeaveRequestHandler hr         = new Hr();

            supervisor.NextHandler = manager;
            manager.NextHandler    = hr;

            supervisor.HandleRequest(request);

            request.LeaveDays = 14;
            supervisor.HandleRequest(request);

            request.LeaveDays = 4;
            supervisor.HandleRequest(request);

            Console.ReadLine();
        }