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;
}
Exemplo n.º 3
0
/* To compile this task use g++ *.cpp -o task5 */
int main(){
	Product* prod = new Product();
	cout << "Set product name: ";
	string name;
	cin >> name;
	prod->SetName(name);
	cout << "Set product price: ";
	float price;
	cin >> price;
	prod->SetPrice(price);
	cout << "Put count in store: ";
	int count;
	cin >> count;
	prod->SetCountInStore(count);
	cout << prod->GetName() << " " <<  prod->calculateProductPrice() << endl;
}