public void sendOrder(Order ord)
        {
            Coder           cod      = new Coder();
            MultiCellBuffer midcells = new MultiCellBuffer();
            Thread          setorder = new Thread(new ParameterizedThreadStart(midcells.setOneCell));

            Console.WriteLine("Store{0} has sent one order", id);
            setorder.Start(cod.Encoder(ord));   //each order create a new thread
        }
 //-----------------------
 private void OrderProcessing(object ordStrObj) {
     string ordstring = ordStrObj.ToString();
     Coder cod = new Coder();
     Order  ord = cod.Decoder(ordstring);
     int BuyCard = ord.getCardNo();
     Console.WriteLine("ChickenFarm received one order from store{0}", ord.getID());
     double taxRate = 0.09;
     double tot = (taxRate + 1) *ord.getPrice()* ord.getAmt();
     Console.WriteLine("Store{0} wants to buy {1} chickens in totally {2} dollars!", ord.getID(), ord.getAmt(), tot);
     if (BuyCard>=350 && BuyCard<=450) {   //check card # correct or not
         Program.confirmed = false;
         confrim(ord);    //call order confirm
     }
     else { Console.WriteLine("Store{0} failed to buy chickens cause of wrong Card #!",ord.getID()); }
 }  
  //------------PriceModel------------
 //-------------receiveOrder---------
  public void receiveOrder()
  {
      MultiCellBuffer midcells = new MultiCellBuffer();
      string ordstring;
      Coder cod = new Coder();
      for (int i = 0; i < 80; i++)
      {
          Thread.Sleep(50);
          ordstring=midcells.getOneCell();
          if (ordstring != null)
          {  
              Thread OrderProcessingThread = new Thread(new ParameterizedThreadStart(OrderProcessing));  
              //create new thread for each order
              OrderProcessing(ordstring);
          }                
      }      
  }
        //------------PriceModel------------
        //-------------receiveOrder---------
        public void receiveOrder()
        {
            MultiCellBuffer midcells = new MultiCellBuffer();
            string          ordstring;
            Coder           cod = new Coder();

            for (int i = 0; i < 80; i++)
            {
                Thread.Sleep(50);
                ordstring = midcells.getOneCell();
                if (ordstring != null)
                {
                    Thread OrderProcessingThread = new Thread(new ParameterizedThreadStart(OrderProcessing));
                    //create new thread for each order
                    OrderProcessing(ordstring);
                }
            }
        }
        //-----------------------
        private void OrderProcessing(object ordStrObj)
        {
            string ordstring = ordStrObj.ToString();
            Coder  cod       = new Coder();
            Order  ord       = cod.Decoder(ordstring);
            int    BuyCard   = ord.getCardNo();

            Console.WriteLine("ChickenFarm received one order from store{0}", ord.getID());
            double taxRate = 0.09;
            double tot     = (taxRate + 1) * ord.getPrice() * ord.getAmt();

            Console.WriteLine("Store{0} wants to buy {1} chickens in totally {2} dollars!", ord.getID(), ord.getAmt(), tot);
            if (BuyCard >= 350 && BuyCard <= 450)     //check card # correct or not
            {
                Program.confirmed = false;
                confrim(ord);    //call order confirm
            }
            else
            {
                Console.WriteLine("Store{0} failed to buy chickens cause of wrong Card #!", ord.getID());
            }
        }
 public void sendOrder(Order ord)
 {
     Coder cod = new Coder();
     MultiCellBuffer midcells = new MultiCellBuffer();
     Thread setorder = new Thread(new ParameterizedThreadStart(midcells.setOneCell));
     Console.WriteLine("Store{0} has sent one order", id);
     setorder.Start(cod.Encoder(ord));   //each order create a new thread
 }