Example #1
0
        public static OrderClass Decoder(string code)
        {
            string[] words    = code.Split(' ');
            int      senderID = Convert.ToInt32(words[0]);
            int      amount   = Convert.ToInt32(words[1]);
            int      cardno   = Convert.ToInt32(words[2]);

            OrderClass OrderObject = new OrderClass(senderID, amount, cardno);

            return(OrderObject);
        }
Example #2
0
        public OrderProcessing(OrderClass OrderObject, double price)
        {
            if (OrderObject.getCardNo() > 7000 || OrderObject.getCardNo() < 5000)
            {
                set_card_is_valid(false);
            }
            else
            {
                set_card_is_valid(true);
            }

            //calculate total amount of charge = unitPrice*numOfRooms + Tax + LocationCharge
            double num = price * OrderObject.getamount() + .075 + 2;

            set_total_charge(num);
        }
Example #3
0
        public void TravelAgency_Func()
        {
            amount = 3;
            OrderClass oo = new OrderClass(id, amount, cardNo);

            encodedOrder = Encoder(oo);
            timestamp    = DateTime.Now;
            //At this point, the travel agency is ready to send an encoded string to the multicellbuffer

            Monitor.Enter(Program.bo);
            try
            {
                Console.WriteLine("Thread" + Thread.CurrentThread.Name + " Setting Order");
                Program.bo.setOneCell(encodedOrder);
            }
            finally { Monitor.Exit(Program.bo); }
        }
Example #4
0
 public string Encoder(OrderClass o)
 {
     return(o.getOrder());
 }