Esempio n. 1
0
        static void Main(string[] args)
        {
            ProxyFactory pFactory = new ProxyFactory();

            // Cannot login
            pFactory.Login("itay", "1111111");
            Console.WriteLine("=========================================");

            // Customer login

            ClientProxy cliProxy = pFactory.Login("ron", "1234");

            (cliProxy as CustomerProxy).BuyTicket("ron", "Thailand");
            (cliProxy as CustomerProxy).ShowMyTickets("ron");
            Console.WriteLine("=========================================");
            // Company login

            ClientProxy comProxy = pFactory.Login("aeroflot", "4321");

            (comProxy as CompanyProxy).CreateFlight("49H56", "Russian", "14:00");
            (comProxy as CompanyProxy).CancleFlight("17C67R");
            Console.WriteLine("=========================================");

            // Admin login

            ClientProxy admProxy = pFactory.Login("may", "1111");

            (admProxy as AdminProxy).CreateCompany("ELAL");
            (admProxy as AdminProxy).CreateCustomer("bar");
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            ProxyFactory fp = new ProxyFactory();

            ClientProxy cp = fp.Login("Ron", "1702");

            (cp as AdminProxy).CreateCompany("ELAL");
            (cp as AdminProxy).CreateCustomer("Itay");

            Console.WriteLine();

            cp = fp.Login("May", "1234");
            (cp as CustomerProxy).BuyTicket("Singapore");
            (cp as CustomerProxy).ShowMyTicket();

            Console.WriteLine();

            cp = fp.Login("UnitedArilines", "7777");
            (cp as CompanyProxy).CreateFlight("Russia");
            (cp as CompanyProxy).CencelFlight("Makadonia");

            Console.WriteLine();



            cp = fp.Login("Itay", "1702");
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            ProxyFactory proxyFactory = new ProxyFactory();
            ClientProxy  clientProxy  = proxyFactory.Login("Ofri", "1");

            ((CustomerProxy)clientProxy).BuyTicket();
            ((CustomerProxy)clientProxy).ShowTickets();
            clientProxy = proxyFactory.Login("Elal", "2");
            ((CompanyProxy)clientProxy).CreateFlight();
            ((CompanyProxy)clientProxy).CancelFlight();
            clientProxy = proxyFactory.Login("Admin", "3");
            ((AdminProxy)clientProxy).CreateCompany();
            ((AdminProxy)clientProxy).CreateCustomer();
        }