示例#1
0
        static void Main(string[] args)
        {
            ProxyFactory factory = new ProxyFactory();
            ClientProxy  admin   = factory.login("admin", "123");

            Console.WriteLine("admin");
            ((AdminProxy)admin).createCompany();
            ((AdminProxy)admin).createCostumer();
            Console.WriteLine("========================================= \ncustomer");
            ClientProxy cus = factory.login("cus", "123");

            ((CustomerProxy)cus).buyTicket();
            ((CustomerProxy)cus).showMyTikcet();
        }
示例#2
0
        static void Main(string[] args)
        {
            ProxyFactory proxyFactory = new ProxyFactory();

            ClientProxy myProxy1 = proxyFactory.Login("Jonathan", "1234");

            CostumerProxy costumerProxy = (CostumerProxy)myProxy1;

            costumerProxy.BuyTicket();


            ClientProxy myProxy2 = proxyFactory.Login("ELAL", "4321");

            CompanyProxy companyProxy = (CompanyProxy)myProxy2;

            companyProxy.CreateFlight();


            ClientProxy myProxy3 = proxyFactory.Login("admin", "admin");

            AdminProxy adminProxy = (AdminProxy)myProxy3;

            adminProxy.CreateCostumer();
        }