Пример #1
0
void removeProductMenu() {
	int id;
	printf("Id of the product: ");
	scanf("%d", &id);
	int result = deleteProduct(id);
	if (result == 0) {
		printf("Product was deleted successfully!");
	}
	else {
		printf("Unknown id!");
	}
}
Пример #2
0
void Request::executeRequest(const std::string& request) {
	utils::StringUtils util;
	if (!request.empty()) {
		std::vector<std::string> splitRequest = util.split(request,utils::separator);
		std::string type = splitRequest.front();
		if(type == utils::NEW_VISION_AREA) {
				createVisionArea(splitRequest);
		} else if(type ==  utils::MODIFY_VISION_AREA) {
				modifyVisionArea(splitRequest);
		} else if(type == utils::DELETE_VISION_AREA) {
				deleteVisionArea(splitRequest);
		} else if (type==utils::NEW_PRODUCT) {
				createProduct(splitRequest);
		} else if (type == utils::MODIFY_PRODUCT) {
				modifyProduct(splitRequest);
		} else if (type == utils::DELETE_PRODUCT) {
			deleteProduct(splitRequest);
		} else if (type == utils::LIST_AREA) {
			listAreas();
		} else if (type == utils::LIST_PRODUCT) {
			listProducts();
		} else if (type == utils::PRODUCT_IMAGE) {
			listProductImages(splitRequest);
		} else if (type == utils::STOCK_GENERAL) {
			listStockGeneral(splitRequest);
		} else if (type == utils::STOCK_AREA) {
			listStockArea(splitRequest);
		} else if (type == utils::STOCK_HISTORIC) {
			listStockHistoric(splitRequest);
		} else if (type == utils::PROCESS_FILE) {
			processFile(splitRequest);
		} else if (type == utils::PROCESS_VIDEO) {
			processVideo(splitRequest);
		} else if (type == utils::QUIT) {
			this->stop();
		} else if (type == utils::DETAILS_AREA){
			getAreas();
		}
		else if (type == utils::DETAILS_PRODUCT){
					detallesProductos();
				}
		else if (type == utils::IMAGES){
					imagenesDeProducto(splitRequest);
				}
		else {
			this->socket->send(utils::ERROR_MESSAGE);
		}
	}
}