Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("***********************Assignment #2, Team Titans************************\n");
            BankService     BS     = new BankService();
            MultiCellBuffer buffer = new MultiCellBuffer();

            buffer.checkMCB.Release(3);

            HotelSupplier hotel = new HotelSupplier();

            hotel.priceCut += new priceCutEventDelegate(roomsOnSale);
            HotelSupplier hotel1 = new HotelSupplier();

            hotel1.priceCut += new priceCutEventDelegate(roomsOnSale);
            HotelSupplier hotel2 = new HotelSupplier();

            hotel2.priceCut += new priceCutEventDelegate(roomsOnSale);

            Thread supplier1 = new Thread(new ThreadStart(hotel.HotelSupplierFunc));
            Thread supplier2 = new Thread(new ThreadStart(hotel1.HotelSupplierFunc));
            Thread supplier3 = new Thread(new ThreadStart(hotel2.HotelSupplierFunc));

            supplier1.Name = "HoidaysInn";
            supplier1.Start();
            supplier2.Name = "Taj";
            supplier2.Start();
            supplier3.Name = "Four Points";
            supplier3.Start();
            for (int i = 0; i < 5; i++)
            {
                TravelAgency t = new TravelAgency(i, buffer, BS);
                hotel.priceCut  += new priceCutEventDelegate(t.roomsOnSale);
                hotel1.priceCut += new priceCutEventDelegate(t.roomsOnSale);
                hotel2.priceCut += new priceCutEventDelegate(t.roomsOnSale);
            }
            OrderProcessing OP = new OrderProcessing(buffer, BS);

            buffer.newOrder   += new NewOrderEventDelegate(OP.orderProcessing);
            OP.orderCompleted += new OrderCompletedEventDelegate(buffer.orderProcCompleted);
        }
Exemplo n.º 2
0
 public TravelAgency(int id, MultiCellBuffer buffer, BankService BS)
 {
     ID         = id;
     Buffer     = buffer;
     cardNumber = BS.getCardNo(ID);
 }
Exemplo n.º 3
0
 public OrderProcessing(MultiCellBuffer buffer, BankService bs)
 {
     this.BS = bs;
 }