상속: IOrder
예제 #1
0
        static void Main()
        {
            Stock     abcStock       = new Stock();
            BuyStock  buyStockOrder  = new BuyStock(abcStock);
            SellStock sellStockOrder = new SellStock(abcStock);

            Broker broker = new Broker();

            broker.TakeOrder(buyStockOrder);
            broker.TakeOrder(sellStockOrder);
            broker.PlaceOrders();
        }
예제 #2
0
        static void Main(string[] args)
        {
            StockManager stockManager = new StockManager();
            BuyStock     buyStock     = new BuyStock(stockManager);
            SellStock    sellStock    = new SellStock(stockManager);

            StockController stockController = new StockController();

            stockController.TakeOrder(buyStock);
            stockController.TakeOrder(sellStock);

            stockController.PlaceOrders();
        }
예제 #3
0
파일: Program.cs 프로젝트: pelehok/patterns
        static void Main(string[] args)
        {
            Stock abcStock = new Stock();

            BuyStock  buyStockOrder  = new BuyStock(abcStock);
            SellStock sellStockOrder = new SellStock(abcStock);

            Broker broker = new Broker();

            broker.takeOrder(buyStockOrder);
            broker.takeOrder(sellStockOrder);

            broker.placeOrders();
        }
예제 #4
0
        static void Main(string[] args)
        {
            StockManager stockManager = new StockManager();
            BuyStock     buyStock     = new BuyStock(stockManager);
            SellStock    sellStock    = new SellStock(stockManager);

            StockOrdersController stockOrdersController = new StockOrdersController();

            stockOrdersController.AddOrder(buyStock);
            stockOrdersController.AddOrder(sellStock);
            stockOrdersController.AddOrder(buyStock);
            stockOrdersController.ExecuteOrders();

            Console.ReadLine();
        }
예제 #5
0
        static void Main(string[] args)
        {
            // yapılan işlemleri hafızaya alma ve toplu şekilde db ye aktarma
            StockManager    stockManager    = new StockManager();
            BuyStock        buyStock        = new BuyStock(stockManager);
            SellStock       sellStock       = new SellStock(stockManager);
            StockController stockController = new StockController();

            stockController.TakeOrder(buyStock);
            stockController.TakeOrder(buyStock);
            stockController.TakeOrder(buyStock);
            stockController.TakeOrder(sellStock);
            stockController.TakeOrder(sellStock);
            stockController.PlaceOrders();
            Console.ReadLine();
        }
예제 #6
0
        static void Main(string[] args)
        {
            Stock abcStock = new Stock();

            BuyStock  buyStockOrder  = new BuyStock(abcStock);
            SellStock sellStockOrder = new SellStock(abcStock);

            Broker broker = new Broker();

            broker.TakeOrder(buyStockOrder);
            broker.TakeOrder(sellStockOrder);

            broker.PlaceOrders();

            Console.ReadKey();
        }
예제 #7
0
        static void Main(string[] args)
        {
            StockService stockService = new StockService();

            BuyStock buyStock = new BuyStock(stockService);

            SellStock sellStock = new SellStock(stockService);

            StockController controller = new StockController();

            controller.AddOrder(buyStock);
            controller.AddOrder(sellStock);
            controller.AddOrder(buyStock);
            controller.AddOrder(sellStock);

            controller.ExecuteOrders();
            Console.Read();
        }
예제 #8
0
        //ctrl + Z komutların geri alınmasını gösterir

        //bu desen için sipariş takip sisteminden örnek oluşturacağız
        static void Main(string[] args)
        {
            //ana kısımda

            StockManager stockManager = new StockManager();         //stok işlemlerini tanımladık
            BuyStock     buy          = new BuyStock(stockManager); //burada parametre gerekiyor
            SellStock    sell         = new SellStock(stockManager);

            StockController stockController = new StockController(); //kontrolerı çağırdık

            stockController.TakeOrder(buy);                          //siparişleri verdik
            stockController.TakeOrder(sell);
            stockController.TakeOrder(buy);

            stockController.PlaceOrders();

            Console.ReadLine();
        }
예제 #9
0
        public static void Demo()
        {
            Stock  s  = new Stock();
            IOrder bs = new BuyStock()
            {
                Stock = s
            };
            IOrder ss = new SellStock()
            {
                Stock = s
            };

            Broker b = new Broker();

            b.TakeOrder(bs);
            b.TakeOrder(ss);
            b.PlaceOrder();
            Console.ReadLine();
        }
예제 #10
0
        static void Main(string[] args)
        {
            //komut deseni
            //bazı komutlarla veri tabanının işlenmesi örnek verilebilir.

            StockManager stockManager = new StockManager();
            BuyStock     buyStock     = new BuyStock(stockManager);
            SellStock    sellStock    = new SellStock(stockManager);

            StockController stockController = new StockController();

            stockController.TakeOrder(buyStock);
            stockController.TakeOrder(sellStock);
            stockController.TakeOrder(buyStock);

            stockController.PlaceOrders();

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            StockManager stockManager = new StockManager("iPhone", 200);

            BuyStock  buyStock  = new BuyStock(stockManager);
            SellStock sellStock = new SellStock(stockManager);

            StockController stockController = new StockController();

            stockController.TakeOrder(buyStock);
            stockController.TakeOrder(sellStock);
            stockController.TakeOrder(sellStock);


            stockController.PlaceOrders();
            // output:
            //  Stock: iPhone, 200 bought!
            //  Stock: iPhone, 200 sold!
            //  Stock: iPhone, 200 sold!
        }