예제 #1
0
void Calculator::validate()
{
    QString value = sum->text();
    sum->clear();
    if(isBalanceCorrect(value))
    {
        float floatValue = value.toFloat();
        // ###### APPEL AU CONTROLLEUR POUR TRANSACTION #####
        controller->receiveCalculatorEntry(floatValue);
        this->hide();
    }

}
예제 #2
0
void EditProduct::validate()
{
    if(!isBalanceCorrect(price->text()))
        return;
    else if(!isInteger(stock->text()))
        return;
    else if(!isUInteger(volume->text()))
        return;

    tmpProduct.setProductCategory(categorie->currentIndex());
    tmpProduct.setProductName(newName->text());
    tmpProduct.setProductPrice(price->text().toFloat());
    tmpProduct.setProductStock(stock->text().toInt());
    //tuple.setProductID()
    tmpProduct.setProductVolume(volume->text().toUInt());
    controller->receiveNewProduct(tmpProduct);

    this->reset();
    this->hide();
}
void AddProduct::validate()
{
    if(!isBalanceCorrect(price->text()))
        return;
    else if(!isUInteger(stock->text()))
        return;
    else if(!isUInteger(volume->text()))
        return;

    view_productTuple tuple;
    tuple.setProductCategory(categorie->currentIndex()+1); // 0 is reserved for +/-
    tuple.setProductName(name->text());
    tuple.setProductPrice(price->text().toFloat());
    tuple.setProductStock(stock->text().toInt());
    tuple.setProductVolume(volume->text().toUInt());
    tuple.setProductTVAcat(tva->currentIndex()+1);
    controller->receiveNewProduct(tuple);

    this->reset();
    this->hide();
}