Esempio n. 1
0
        private static TeamLead MakeApprovalChainForTeamLead(string teamLeadName, string managerName, string directorName)
        {
            var brendon = new TeamLead(teamLeadName);
            var trav    = new Manager(managerName);
            var pete    = new Director(directorName);

            brendon.SetSuccessor(trav);
            trav.SetSuccessor(pete);
            return(brendon);
        }
        public static void Main()
        {
            Approver teamLead = new TeamLead();
            Approver vicePresident = new VicePresident();
            Approver president = new President();

            teamLead.SetSuccessor(vicePresident);
            vicePresident.SetSuccessor(president);

            Purchase purchase = new Purchase(2019, 90000.00);
            teamLead.ProcessRequest(purchase);
        }
Esempio n. 3
0
        public static void SecondDemo()
        {
            Approver teamLead = new TeamLead();
            Approver vp       = new VicePrezicent();
            Approver ceo      = new President();

            teamLead.SetSuccessor(vp);
            vp.SetSuccessor(ceo);
            teamLead.ProcessRequest(new Purchase(2033, 9999));
            teamLead.ProcessRequest(new Purchase(2034, 350.00));
            teamLead.ProcessRequest(new Purchase(2035, 24000));
            teamLead.ProcessRequest(new Purchase(2036, 50000));
            teamLead.ProcessRequest(new Purchase(2037, 500000));
        }
        internal static void Main()
        {
            Approver teamLead = new TeamLead();
            Approver vicePresident = new VicePresident();
            Approver president = new President();

            teamLead.SetSuccessor(vicePresident);
            vicePresident.SetSuccessor(president);

            var purchase = new Purchase(2034, 350.00);
            teamLead.ProcessRequest(purchase);

            purchase = new Purchase(2035, 32590.10);
            teamLead.ProcessRequest(purchase);

            purchase = new Purchase(2036, 122100.00);
            teamLead.ProcessRequest(purchase);
        }
Esempio n. 5
0
        public static void Main()
        {
            Approver teamLead = new TeamLead();
            Approver vp = new VicePresident();
            Approver ceo = new President();

            teamLead.SetSuccessor(vp);
            vp.SetSuccessor(ceo);

            var purchase = new Purchase(2034, 350.00);
            teamLead.ProcessRequest(purchase);

            purchase = new Purchase(2035, 32590.10);
            teamLead.ProcessRequest(purchase);

            purchase = new Purchase(2036, 122100.00);
            teamLead.ProcessRequest(purchase);
        }
Esempio n. 6
0
        public static void Main()
        {
            Approver teamLead = new TeamLead();
            Approver vp       = new VicePresident();
            Approver ceo      = new President();

            teamLead.SetSuccessor(vp);
            vp.SetSuccessor(ceo);

            var purchase = new Purchase(2034, 350.00);

            teamLead.ProcessRequest(purchase);

            purchase = new Purchase(2035, 32590.10);
            teamLead.ProcessRequest(purchase);

            purchase = new Purchase(2036, 122100.00);
            teamLead.ProcessRequest(purchase);
        }
        public static void Main()
        {
            Approver teamLead      = new TeamLead();
            Approver vicePresident = new VicePresident();
            Approver president     = new President();

            teamLead.SetSuccessor(vicePresident);
            vicePresident.SetSuccessor(president);

            var purchase = new Purchase(350, 1);

            teamLead.ProcessRequest(purchase);

            purchase = new Purchase(24000, 2);
            teamLead.ProcessRequest(purchase);

            purchase = new Purchase(32590, 3);
            teamLead.ProcessRequest(purchase);

            purchase = new Purchase(100001, 4);
            teamLead.ProcessRequest(purchase);
        }