Exemplo n.º 1
0
        static void RunAdvancedCOR()
        {
            ITicketSystem customerRep    = new CustomerRep();
            ITicketSystem manager        = new Manager();
            ITicketSystem generalManager = new GeneralManager();
            ITicketSystem vicePresident  = new VicePresident();

            customerRep.NextChain(manager);
            manager.NextChain(generalManager);
            generalManager.NextChain(vicePresident);

            Ticket ticket = new Ticket()
            {
                Id         = 1,
                Difficulty = Difficulty.Low,
                Issue      = "An use cannot login",
                Name       = "Failure to login"
            };

            Console.WriteLine("------ Running Advanced COR ------");
            Console.WriteLine($"{ticket} || Assigned To: {customerRep.Assign(ticket)}");
            ticket.Difficulty = Difficulty.Medium;
            Console.WriteLine($"{ticket} || Assigned To: {customerRep.Assign(ticket)}");
            ticket.Difficulty = Difficulty.High;
            Console.WriteLine($"{ticket} || Assigned To: {customerRep.Assign(ticket)}");
            ticket.Difficulty = Difficulty.VeryHigh;
            Console.WriteLine($"{ticket} || Assigned To: {customerRep.Assign(ticket)}");
        }
Exemplo n.º 2
0
        private static void TestHandlingIssue()
        {
            // set tickets
            List <Ticket> ticketList = new List <Ticket>()
            {
                new Ticket {
                    Difficulty = Difficulty.Low
                },
                new Ticket {
                    Difficulty = Difficulty.Medium
                },
                new Ticket {
                    Difficulty = Difficulty.High
                },
                new Ticket {
                    Difficulty = Difficulty.VeryHigh
                },
            };

            // set Employees
            var customerRep    = new CustomerRep(0, "Customer Rep", Difficulty.Low);
            var teamManager    = new TeamManager(0, "Team Manager", Difficulty.Medium);
            var generalManager = new GeneralManager(0, "General Manager", Difficulty.High);
            var vicePresident  = new VicePresident(0, "Vice President", Difficulty.VeryHigh);

            // set chained relation
            customerRep.NextChain(teamManager);
            teamManager.NextChain(generalManager);
            generalManager.NextChain(vicePresident);

            foreach (Ticket ticket in ticketList)
            {
                string s = customerRep.HandleTicket(ticket);
                Console.WriteLine(s);
            }
        }
Exemplo n.º 3
0
 public CustomerSvc()
 {
     customerRep = new CustomerRep();
 }
Exemplo n.º 4
0
 public CustomerController()
 {
     repCustomer    = new CustomerRep();
     mapperCustomer = new MapperCustomer();
 }