예제 #1
0
        static void Main(string[] args)
        {
            //sample 2
            Approver larry = new Director();
            Approver sam   = new VicePresident();
            Approver tammy = new President();

            larry.SetSuccessor(sam);
            sam.SetSuccessor(tammy);

            Purchase p = new Purchase(2034, 350.00, "Assets");

            larry.ProcessRequest(p);

            p = new Purchase(2035, 32590.10, "Project X");
            larry.ProcessRequest(p);

            p = new Purchase(2036, 122100.00, "Project Y");
            sam.ProcessRequest(p);


            //sample 1
            //var message = new MessageBuilder()
            //    .setValue("hi there is a message ")
            //    .AddDestination(Destination.FAX, "9343434343")
            //    //.AddDestination(Destination.SMS, "9934834343")
            //    .AddDestination(Destination.EMAIL,"*****@*****.**")
            //    .Build();

            //var messageService = new MessageService();
            //messageService.sendMessage(message);

            Console.ReadKey();
        }
예제 #2
0
        /// <summary>

        /// Entry point into console application.

        /// </summary>

        static void Main()
        {
            // Setup Chain of Responsibility

            Approver larry = new Director();
            Approver sam   = new VicePresident();
            Approver tammy = new President();

            larry.SetSuccessor(sam);
            sam.SetSuccessor(tammy);

            // Generate and process purchase requests

            Purchase p = new Purchase(2034, 350.00, "Assets");

            larry.ProcessRequest(p);

            p = new Purchase(2035, 32590.10, "Project X");
            larry.ProcessRequest(p);

            p = new Purchase(2036, 122100.00, "Project Y");
            larry.ProcessRequest(p);

            // Wait for user

            Console.ReadKey();
        }
예제 #3
0
        static void Main(string[] args)
        {
            var director      = new Director();
            var vicePresident = new VicePresident();

            director.SetNext(vicePresident);

            director.ProcessRequest(9999);
            director.ProcessRequest(10001);
        }
        public static void Main()
        {
            var larry = new Director();
            var sam   = new VicePresident();
            var tammy = new President();

            larry.Successor = sam;
            sam.Successor   = tammy;

            var purchase = new Purchase(2034, 350.00, "Assets");

            larry.ProcessRequest(purchase);

            purchase = new Purchase(2035, 32590.10, "Project X");
            larry.ProcessRequest(purchase);

            purchase = new Purchase(2036, 122100.00, "Project Y");
            larry.ProcessRequest(purchase);
        }
예제 #5
0
        public void Main()
        {
            Approver larry = new Director();
            Approver sam   = new VicePresident();
            Approver tammy = new President();

            larry.SetSuccessor(sam);
            sam.SetSuccessor(tammy);

            // Generate and process purchase requests
            var p = new Purchase(2034, 350.00, "Assets");

            larry.ProcessRequest(p);

            p = new Purchase(2035, 32590.10, "Project X");
            larry.ProcessRequest(p);

            p = new Purchase(2036, 122100.00, "Project Y");
            larry.ProcessRequest(p);
        }
예제 #6
0
        public static void Main(string[] args)
        {
            Approver larry = new Director();
            Approver sam   = new VicePresident();
            Approver tammy = new President();

            larry.SetSuccessor(sam);
            sam.SetSuccessor(tammy);

            var p = new Purchase(2034, 350.00, "Assets");

            larry.ProcessRequest(p);

            p = new Purchase(2035, 32590.10, "Project X");
            larry.ProcessRequest(p);

            p = new Purchase(2036, 122100.00, "Project Y");
            larry.ProcessRequest(p);

            Console.ReadKey();
        }
예제 #7
0
        public static void Main()
        {
            // Setup Chain of Responsibility
            Approver director      = new Director();
            Approver vicePresident = new VicePresident();
            Approver president     = new President();

            director.SetSuccessor(vicePresident);
            vicePresident.SetSuccessor(president);

            // Generate and process purchase requests
            var p = new Purchase(2034, 350.00, "Assets");

            director.ProcessRequest(p);

            p = new Purchase(2035, 32590.10, "Project X");
            director.ProcessRequest(p);

            p = new Purchase(2036, 122100.00, "Project Y");
            director.ProcessRequest(p);
        }
예제 #8
0
        static void Main(string[] args)
        {
            Console.WriteLine("Chain of responsibility");

            Approver larry = new Director();
            Approver sam   = new VicePresident();
            Approver tammy = new President();

            larry.SetSuccessor(sam);
            sam.SetSuccessor(tammy);

            Purchase p = new Purchase(2034, 350.00, "Assets");

            larry.ProcessRequest(p);

            p = new Purchase(2035, 32590.10, "Project X");
            larry.ProcessRequest(p);

            p = new Purchase(2036, 122100.00, "Project Y");
            larry.ProcessRequest(p);
        }
        private static void Main(string[] args)
        {
            IApprover director      = new Director();
            IApprover vicePresident = new VicePresident();
            IApprover president     = new President();

            director.Successor      = vicePresident;
            vicePresident.Successor = president;

            Purchase p = new Purchase(8884, 350, "Assets");

            director.ProcessRequest(p);
            Purchase p1 = new Purchase(5675, 33390, "Project Poison");

            director.ProcessRequest(p1);
            Purchase p2 = new Purchase(5676, 144400, "Project BBD");

            director.ProcessRequest(p2);


            Console.ReadKey();
        }
예제 #10
0
        static void Main(string[] args)
        {
            // Setup Chain of Responsibility
            Approver ronny = new Director();
            Approver bobby = new VicePresident();
            Approver ricky = new President();

            ronny.SetSuccessor(bobby);
            bobby.SetSuccessor(ricky);

            // Generate and process purchase requests
            Purchase p = new Purchase(8884, 350.00, "Assets");

            ronny.ProcessRequest(p);

            p = new Purchase(5675, 33390.10, "Project Poison");
            ronny.ProcessRequest(p);

            p = new Purchase(5676, 144400.00, "Project BBD");
            ronny.ProcessRequest(p);

            // Wait for user
            Console.ReadKey();
        }
예제 #11
0
        static void Main(string[] args)
        {
            var dir  = new Director();
            var vice = new VicePresident();

            dir.SetSuccessor(vice);
            var pres = new President();

            vice.SetSuccessor(pres);

            var expense = new Purchase {
                Number = 1, Amount = 45000.0m
            };

            dir.ProcessRequest(expense);
        }
예제 #12
0
 /// <summary>
 /// Entry point into console application.
 /// </summary>
 static void Main()
 {
     // Setup Chain of Responsibility
     Approver larry = new Director();
     Approver sam = new VicePresident();
     Approver tammy = new President();
     larry.SetSuccessor(sam);
     sam.SetSuccessor(tammy);
     // Generate and process purchase requests
     Purchase p = new Purchase(2034, 350.00, "Assets");
     larry.ProcessRequest(p);
     p = new Purchase(2035, 32590.10, "Project X");
     larry.ProcessRequest(p);
     p = new Purchase(2036, 122100.00, "Project Y");
     larry.ProcessRequest(p);
     // Wait for user
     Console.ReadKey();
 }