Example #1
0
 public override void ProcessRequest(Purchase purchase)
 {
     if (purchase.Amount < 10000)
     {
         Console.WriteLine("{0} approved reqeuest #{1}", this.GetType().Name, purchase.Number);
     }
     else
     {
         Console.WriteLine("Request #{0} requires an executive meetings.", purchase.Number);
     }
 }
Example #2
0
 public override void ProcessRequest(Purchase purchase)
 {
     if (purchase.Amount < 5000)
     {
         Console.WriteLine("{0} approved reqeuest #{1}", this.GetType().Name, purchase.Number);
     }
     else if (this.mApprover != null)
     {
         this.mApprover.ProcessRequest(purchase);
     }
 }
        public static void Run()
        {
            Director d = new Director();
            VicePresident v = new VicePresident();
            President p = new President();

            d.SetApprover(v);
            v.SetApprover(p);

            Purchase purchase = new Purchase(2034, 350, "Supplies"); 
            d.ProcessRequest(purchase); 
            purchase = new Purchase(2035, 8888, "Project X"); 
            d.ProcessRequest(purchase); 
            purchase = new Purchase(2036, 12000, "Project Y"); 
            d.ProcessRequest(purchase);
        }
Example #4
0
 public abstract void ProcessRequest(Purchase purchase);