示例#1
0
 public override void ProcessRequest(Purchase purchase)
 {
     if (purchase.Amount < 25000.0)
     {
         Console.WriteLine("{0} approved request# {1}",
         this.GetType().Name, purchase.Number);
     }
     else if (successor != null)
     {
         successor.ProcessRequest(purchase);
     }
 }
示例#2
0
 public override void ProcessRequest(Purchase purchase)
 {
     if (purchase.Amount < 100000.0)
     {
         Console.WriteLine("{0} approved request# {1}",
         this.GetType().Name, purchase.Number);
     }
     else
     {
         Console.WriteLine("Request # {0} requires an executing meeting",purchase.Number);
     }
 }
示例#3
0
        static void Main(string[] args)
        {
            Director Larry = new Director();
            VicePresident Sam = new VicePresident();
            President Tammy = new President();

            Larry.SetSuccessor(Sam);
            Sam.SetSuccessor(Tammy);
            // Generate and process purchase requests
            Purchase p = new Purchase(2034, 350.00, "Supplies");
            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.Read();

        }
示例#4
0
 public abstract void ProcessRequest(Purchase purchase);