Example #1
0
        static void Main12()
        {
            Console.WriteLine("Hello Chain of Responsibility Pattern!");

            Approver wjzhang, gyang, jguo, meeting;

            wjzhang = new Director("Wuji Zhang");
            gyang   = new VicePresident("Guo Yang");
            jguo    = new President("Jing Guo");
            meeting = new Congress("Board");

            wjzhang.SetNextApprover(gyang);
            gyang.SetNextApprover(jguo);
            jguo.SetNextApprover(meeting);

            PurchaseRequest pr1 = new PurchaseRequest(45000, 10001, "Purchase Yi Tian Jian");
            PurchaseRequest pr2 = new PurchaseRequest(60000, 10002, "Purchase <<Muxplay>>");
            PurchaseRequest pr3 = new PurchaseRequest(160000, 10003, "Purchase <<Diamond Sutra>>");
            PurchaseRequest pr4 = new PurchaseRequest(800000, 10004, "Purchase Peach Land");

            wjzhang.ProcessRequest(pr1);
            wjzhang.ProcessRequest(pr2);
            wjzhang.ProcessRequest(pr3);
            wjzhang.ProcessRequest(pr4);

            Console.ReadLine();
        }