void GameLotteryLayer::onBtnGoCallback(CCObject* pSender)
{
	if (m_bTempSoundOn)
	{
		SoundPlayer::play(SNDI_CLICK);
	}
	if ((!GameUtils::s_myInfo.getHasFreeLottery()) && (GameUtils::s_myInfo.getDiamond() < MUlTIPLE_COUNT[m_iChoiceDiamond]))
	{
		CCLOG("== GameLottery not enough money ==");
		disableBtns();
		setGoResult(DIAMOND_NOT_ENOUGH);
		animateToShowHint();
		this->scheduleOnce(schedule_selector(GameLotteryLayer::removeHint), 2.0f);
		return;
	}

	disableBtns();
	SoundPlayer::play(SNDI_SLOT_ROLL);

	PlayLotteryCmd* ptrPlayerLotteryCmd = CmdSender::getInstance()->getPlayLotteryCmd(m_bIsFree ? 0 : MUlTIPLE_COUNT[m_iChoiceDiamond]);
	ptrPlayerLotteryCmd->m_needShowWaitingPanel = false;
	CCNotificationCenter::sharedNotificationCenter()->addObserver(this, callfuncO_selector(GameLotteryLayer::onGetLotteryNetworkCallback), ptrPlayerLotteryCmd->m_cmdName.c_str(), NULL);
	CmdSender::getInstance()->sendCommands(1, ptrPlayerLotteryCmd);

	m_ptrCircle->runAction(CCRepeatForever::create(CCRotateBy::create(2.0f, 360 * 4)));
}
void GameLotteryLayer::onCircleStop()
{
	SoundPlayer::stopAllSounds();
	enableBtns();

	// result Go button
	if (m_bIsLotteryNormally)
	{
		m_bIsLotteryNormally = false;
		SoundPlayer::play(SNDI_SLOT_RESULT);

		// remove old highlight
		CCNode* ptrLight = m_ptrCircle->getChildByTag(LIGHT_TAG);
		if(ptrLight)
		{
			ptrLight->removeFromParent();
			ptrLight = NULL;
		}

		// create highlight
		ptrLight = CREATE_SPRITE(this, "lottery_selected_game.png", true);
		ptrLight->setTag(LIGHT_TAG);
		ptrLight->setRotation(CircleHeightLightRotation[m_iCurLottery]);
		m_ptrCircle->addChild(ptrLight);
		ptrLight->setPosition(CircleHeightLightPositionX[m_iCurLottery], CircleHeightLightPositionY[m_iCurLottery]);

		disableBtns();
		setGoResult(WIN_CHIPS);
		animateToShowHint();
		scheduleOnce(schedule_selector(GameLotteryLayer::removeHint), 5.0f);
	}
	// reset buttons
	//initBtnGo();
	//chargeNewDay();
}
Exemple #3
0
void DeleteUser::on_closeChequing_clicked()
{
    MaintanenceView mview;


    //Close chequing account
    if (searchResult.cheqBal == 0){
          QMessageBox::StandardButton reply;
          reply = QMessageBox::question(this,"Account","User only has a Chequing Account - close?",QMessageBox::Yes|QMessageBox::No);
      if(reply == QMessageBox::Yes){
          MainWindow db;
          db.connOpen();
          QSqlQuery qry;

          qry.prepare("UPDATE BANKING_CREDENTIALS SET CheqAcct=0 WHERE Name ='"+name+"'");
          qDebug()<<(qry.lastQuery());

          //have to check if they have a chequing account before you go with this function...

          if(qry.exec()){
             db.connClose();
             QMessageBox::information(this, name, "Chequing Account has been Deleted");

             //Log
             QString action = "CLOSED ACCOUNT FOR '"+name+"': CHEQ";
             mview.isTrail(client.isTrail, action);

             MainWindow db;
             db.connOpen();

             QSqlQuery qry2;
             qry2.prepare("SELECT * FROM BANKING_CREDENTIALS WHERE Name='"+name+"'");

             if(qry2.exec()){
                qry.next();
                Helper::currentClientInfo searchResult;
                searchResult = helper.createClient(qry2);

                db.connClose();
               //Update user information in text area
               updateCustomerInformation(searchResult.hasCheq, searchResult.hasSav, ui->hey, qry2);
               //Disable action buttons based on account... ex: if cheq exists but sav doesnt, grey out 'CLOSE SAVINGS ACCOUNT' but 'CLOSE CHEQUING ACCOUNT' enabled
               disableBtns(searchResult.hasCheq, searchResult.hasSav, ui->closeSav, ui->closeChequing, ui->closeBoth);
               this->show();

              }else{
                 QMessageBox::critical(this,tr("Woops..."),tr("Query did not run!"));
                 qDebug()<<("Not Inserted into DB");
                 qDebug()<<(qry.lastError().text());}
                }
        }else{

            QMessageBox::information(this,tr("Cancelled"),tr("Did not close chequing account"));
            }
    }else{
          QMessageBox::critical(this,tr("Can't..."),tr("Balance is not $0 - Ask Customer to empty funds"));
    }
}
Exemple #4
0
void DeleteUser::on_searchButton_clicked()
{
    MaintanenceView mview;

    //Search Name and maybe other things after
    name = ui->lineEdit->text();

    MainWindow db;
    db.connOpen();

    QSqlQuery qry2;
    qry2.prepare("SELECT * FROM BANKING_CREDENTIALS WHERE Name='"+name+"'");

    if(qry2.exec()){
       qry2.next();
       qDebug()<<(qry2.record());

       searchResult.cheqBal = qry2.value(4).toDouble();
       searchResult.savBal = qry2.value(5).toDouble();
       searchResult.hasCheq = qry2.value(7).toInt();
       searchResult.hasSav = qry2.value(6).toInt();
       searchResult.name = qry2.value(0).toString();

       qDebug()<<(searchResult.hasCheq);

       db.connClose();

       if(name.isEmpty()){
           QMessageBox::information(this,"Account","Couldn't find this person. Try again and remember - Firstname Lastname");
       }else {
           updateCustomerInformation(searchResult.hasCheq, searchResult.hasSav, ui->hey, qry2);
           //Disable action buttons based on account... if cheq exists but sav doesnt, grey out 'CLOSE SAVINGS ACCOUNT' but 'CLOSE CHEQUING' enabled
           disableBtns(searchResult.hasCheq, searchResult.hasSav, ui->closeSav, ui->closeChequing, ui->closeBoth);
       }
    }
    else{
       qDebug()<<("Not Inserted into DB");
    }
}