Exemplo n.º 1
0
Product ProductController::FindProductUsingRFIDTag(char* RFIDTag, bool queryShopInventory)
{
	//Log.Info("FindProductUsingRFIDTag Begin"CR);

	vector<Product> temp;
	if(queryShopInventory)
		temp = shopVector;
	else
		temp = tempVector;

	for(int i=0; i<temp.size(); i++)
	{
		char* rfidTag = temp[i].GetRFIDTag();
		if(strcmp(rfidTag, RFIDTag) == 0)	
		{
			//Log.Info("Match found."CR);			
			return temp[i];			
		}
	}
	
	//Log.Info("FindProductUsingRFIDTag End"CR);

	// A quick work-around as you cannot return a null object only a null pointer.
	Product product; product.SetRFIDTag("-1"); 	product.SetDescription("-1"); 	product.SetPrice(1);

	return product;
}
Exemplo n.º 2
0
bool ProductController::AddProduct(char* RFIDTag, char* Description, int Price)
{ 
  Product product;
  product.SetRFIDTag(RFIDTag);
  product.SetDescription(Description);
  product.SetPrice(Price);

  it = tempVector.insert(it, product);

  //Log.Info("List contains %d items."CR, tempVector.size());

  return true;
}