Example #1
0
void dbInterface::deleteGymnast(QString& p_strFirstName, QString& p_strLastName)
{

    if (m_bInitialized)
    {
        QSqlDatabase db = QSqlDatabase::database("ConnMG");
        QSqlQuery query(db);
        QString strQuery = "DELETE FROM athlete WHERE first_name='" + p_strFirstName
                + "' AND last_name='" + p_strLastName.trimmed() + "'";
        bool bRet = query.exec(strQuery);

        if (bRet)
        {
            qInfo() << "Athlete removed: " << p_strFirstName << " " << p_strLastName;
        }
        else
        {
            QString strErr = "Athlete NOT removed: " + p_strFirstName + " " + p_strLastName
                    +  "\n" + query.lastError().text();
            qCritical() << strErr;

            MessageBox cMsgBox;
            cMsgBox.SetTitle("Warning");
            cMsgBox.SetText(strErr);
            cMsgBox.Show();
        }
    }
    else
    {
        qInfo() << "dbInterface::deleteGymnast(): Db not initialized";
    }
}
Example #2
0
void GUISystem::ShowMessageBox(const CEGUI::String& text, MessageBox::eMessageBoxType type, MessageBox::Callback callback, int32 tag)
{
	MessageBox* messageBox = new MessageBox(type, tag);
	messageBox->SetText(text);
	messageBox->RegisterCallback(callback);
	messageBox->Show();
}
Example #3
0
void SaveScore::onSaveScore(QString p_strGymnastFullTxt,
                            QString p_strApparatus,
                            QString p_strStartScore,
                            QString p_strFinalScore,
                            bool p_bFinalApparatus)
{
    QString strFinalApparatus = p_bFinalApparatus ? "FinalApparatus" : "";
    qDebug() << "onSaveScore(): " << p_strGymnastFullTxt <<  ", "
                << p_strApparatus <<  ", "
                << p_strStartScore <<  ", "
                << p_strFinalScore <<   ", "
                << strFinalApparatus;

    QString strErr = "";
    bool bConvStartScoreOk = false;
    float fStartScore = CheckStartScore(p_strStartScore, &bConvStartScoreOk);

    if (!bConvStartScoreOk)
    {
        strErr = "Nota di partenza non é tra 0 e 10";
    }

    bool bConvFinalScoreOk = false;
    float fFinalScore = CheckFinalScore(p_strFinalScore, &bConvFinalScoreOk);

    if (!bConvFinalScoreOk)
    {
        if (!strErr.isEmpty())
            strErr += "\n";

        strErr += "Nota finale non é tra 0 e 20";
    }

    // save it to DB
    SendToDb(p_strGymnastFullTxt, p_strApparatus, fStartScore, fFinalScore, p_bFinalApparatus);

    // Show it to the user
    if ((!bConvStartScoreOk) || (!bConvFinalScoreOk))
    {
        MessageBox cMsgBox;
        cMsgBox.SetTitle("Warning");
        cMsgBox.SetText(strErr);
        cMsgBox.Show();
    }
}
Example #4
0
void
MainForm::OnParsingFailure(String &error) {
	String title;
	String text;
	String emptyText;
	AppResource *pAppResource = Application::GetInstance()->GetAppResource();
	pAppResource->GetString("IDS_APPNAME", title);
	pAppResource->GetString("IDS_FAILURE", text);
	pAppResource->GetString("IDS_ERROR", emptyText);

	__pListFood->SetTextOfEmptyList(emptyText);
	__pListFood->RequestRedraw();

	MessageBox *pMessageBox = new MessageBox();
	pMessageBox->Construct(title, text, MSGBOX_STYLE_OK );
	pMessageBox->Show();
	delete pMessageBox;

	StopLoadingAnimation();
}