Beispiel #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("========責任鏈模式-測試========");

            Manager pm = new CommonManger("PM經理");
            Manager gl = new MajorManger("總監");
            Manager gm = new GeneralManger("總經理");

            pm.setSuperior(gl);
            gl.setSuperior(gm);

            ApplyRequest request = new ApplyRequest();

            request.RequestType    = "請假";
            request.RequestContent = "小菜請假";
            request.RequestCount   = 2;
            pm.apply(request);
            request.RequestCount = 4;
            pm.apply(request);
            request.RequestCount = 12;
            pm.apply(request);

            request.RequestType    = "加薪";
            request.RequestContent = "小菜加薪";
            request.RequestCount   = 2000;
            pm.apply(request);
            request.RequestCount = 999;
            pm.apply(request);
        }