示例#1
0
void MenuSupport::addProductToAllStores()
{
	Product* localProduct = getProductWithUserChoise();
	const char* const productName = localProduct->getProductName();

	StoreCountType storeCount = _shoppingStores->getStoreCount();
	for (StoreCountType i = 0; i < storeCount; i++)
	{
		Store* store = _shoppingStores->getStoreAtIndex(i);
		store->addProduct(new Product(*localProduct));
	}
	delete localProduct;
}
示例#2
0
void MenuSupport::addProductToOneStore()
{
	printf(kAddProductToOneStoreByOptionMessage);
	printf(kInputSymbolMessage);
	StoreCountType storeIndex = getStoreIndexFromUserChoise();
	if (kUndefinedStoreIndex == storeIndex)
		return;

	Product* localProduct = getProductWithUserChoise();
	const char* const productName = localProduct->getProductName();
	if (0 == strcmp(productName, ""))
	{
		return;
	}

	Store* store = _shoppingStores->getStoreAtIndex(storeIndex);
	store->addProduct(localProduct);
}