Exemple #1
0
void workerHandlingProductsMenu(Product *products, int *productCount) {
    int op;
    do {
        workerHandlingProductsMenuPrint();
        readInt(&op, MENU_OPT_MIN, MENU_OPT_MAX, MENU_MSG_OPT);
        switch (op) {
            case 0: //exit
                break;
            case 1: 
                cleanScreen();
                addProduct(products, productCount);
                break;
            case 2: 
                cleanScreen();
                editProduct(products, productCount);
                break;
            case 3: 
                cleanScreen();
                removeProduct(products, productCount);
                break;
            case 4: 
                cleanScreen();
                listProducts(products, productCount);
                break;
            default:
                printf(MENU_MSG_OPT_INVALID);
        }
    } while (op != 0);
}
Exemple #2
0
void clientMenu(Client *clients, Order *orders, Product *products,
        int *clientCount, int *orderCounts, int *productCount) {
    int op, posLogged = 0;
    posLogged = loginClient(clients, clientCount);
    if (posLogged != EOF) {
        do {
            clientMenuPrint();
            readInt(&op, MENU_OPT_MIN, MENU_OPT_MAX, MENU_MSG_OPT);
            switch (op) {
                case 0: //exit
                    break;
                case 1:
                    cleanScreen();
                    listProducts(products, productCount);
                    break;
                case 2:
                    cleanScreen();
                    addOrder(orders, orderCounts, products, productCount, clients[posLogged].bi);
                    break;
                case 3:
                    cleanScreen();
                    listMyOrders(orders, orderCounts, clients[posLogged].bi);
                    removeOrderClient(orders, orderCounts, clients[posLogged].bi);
                    break;
                case 4: //
                    cleanScreen();
                    listMyClient(clients[posLogged]);
                    printf("\n\n");
                    break;
                case 5: //
                    cleanScreen();
                    editClient(clients, clientCount, posLogged);
                    printf("\n\n");
                    break;
                case 6: //
                    cleanScreen();
                    listMyOrders(orders, orderCounts, clients[posLogged].bi);
                    printf("\n\n");
                    break;
                case 7: //
                    cleanScreen();
                    listMyOrdersPendingApproval(orders, orderCounts, clients[posLogged].bi);
                    printf("\n\n");
                    break;
                case 8: //
                    cleanScreen();
                    listMyOrdersPendingDelivery(orders, orderCounts, clients[posLogged].bi);
                    printf("\n\n");
                    break;
                default:
                    printf(MENU_MSG_OPT_INVALID);
            }
        } while (op != 0);
    }
}
Exemple #3
0
void addOrder(Order *orders, int *oCount, Product *products, int *pCount, long clientBI) {
    
    setOrderId(orders, *oCount);
    setOrderClientBi(orders, *oCount, clientBI);
    setOrderDate(orders, *oCount);
    listProducts(products, pCount);
    setOrderLines(orders, *oCount, products, pCount);
    setOrderAddress(orders, *oCount);
    setOrderTotalPrice(orders, *oCount);
    orders[*oCount].approvalWorkerBI = 0;
    (*oCount)++;
    saveOrdersFile(orders);
    saveOrderCountFile(oCount);
}
Exemple #4
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);
		}
	}
}
Exemple #5
0
void CommandLineFrontend::handleProjectsResolved()
{
    if (m_cancelStatus != CancelStatusNone)
        throw ErrorInfo(Tr::tr("Execution canceled."));
    switch (m_parser.command()) {
    case ResolveCommandType:
        qApp->quit();
        break;
    case CleanCommandType:
        makeClean();
        break;
    case ShellCommandType:
        qApp->exit(runShell());
        break;
    case StatusCommandType:
        qApp->exit(printStatus(m_projects.front().projectData()));
        break;
    case GenerateCommandType:
        checkGeneratorName();
        Q_FALLTHROUGH();
    case BuildCommandType:
        build();
        break;
    case InstallCommandType:
    case RunCommandType:
        if (m_parser.buildBeforeInstalling())
            build();
        else
            install();
        break;
    case UpdateTimestampsCommandType:
        updateTimestamps();
        qApp->quit();
        break;
    case DumpNodesTreeCommandType:
        dumpNodesTree();
        qApp->quit();
        break;
    case ListProductsCommandType:
        listProducts();
        qApp->quit();
        break;
    case HelpCommandType:
    case VersionCommandType:
        Q_ASSERT_X(false, Q_FUNC_INFO, "Impossible.");
    }
}