示例#1
0
void * FbMasterInfoBase::Execute(wxEvtHandler * owner, FbThread * thread, const FbFilterObj &filter)
{
	if (thread->IsClosed()) return NULL;

	FbCommonDatabase database;
	database.JoinThread(thread);
	FbGenreFunction func_genre;
	FbAggregateFunction func_aggregate;
	database.CreateFunction(wxT("AGGREGATE"), 1, func_aggregate);
	database.CreateFunction(wxT("GENRE"), 1, func_genre);
	database.AttachConfig();
	if (thread->IsClosed()) return NULL;

	wxString sql;
	switch (GetMode()) {
		case FB2_MODE_LIST: sql = GetListSQL(database); break;
		case FB2_MODE_TREE: sql = GetTreeSQL(database); break;
	}
	sql = FormatSQL(sql, GetWhere(database), filter);

	FbSQLite3Statement stmt = database.PrepareStatement(sql);
	Bind(stmt);
	FbSQLite3ResultSet result = stmt.ExecuteQuery();
	if (!result.IsOk()) return NULL;

	switch (GetMode()) {
		case FB2_MODE_LIST: MakeList(owner, thread, result); break;
		case FB2_MODE_TREE: MakeTree(owner, thread, result); break;
	}
	return NULL;
}
示例#2
0
void CTariffSetting::SaveData( )
{
    QStringList lstRows;
    QString strWhere;
    GetWhere( strWhere );
    GetValue( lstRows );

    CLogicInterface::GetInterface( )->OperateTariffInfo( lstRows, CommonDataType::UpdateData, strWhere );

    WriteIniFile( );
}
示例#3
0
Actor *ActorUtil::LoadFromNode( const XNode* _pNode, Actor *pParentActor )
{
	ASSERT( _pNode != NULL );

	XNode node = *_pNode;

	// Remove this in favor of using conditionals in Lua. -Chris
	// There are a number of themes out there that depend on this (including
	// sm-ssc default). Probably for the best to leave this in. -aj
	{
		bool bCond;
		if( node.GetAttrValue("Condition", bCond) && !bCond )
			return NULL;
	}

	RString sClass;
	bool bHasClass = node.GetAttrValue( "Class", sClass );
	if( !bHasClass )
		bHasClass = node.GetAttrValue( "Type", sClass );

	bool bLegacy = (node.GetAttr( "_LegacyXml" ) != NULL);
	if( !bHasClass && bLegacy )
		sClass = GetLegacyActorClass( &node );

	map<RString,CreateActorFn>::iterator iter = g_pmapRegistrees->find( sClass );
	if( iter == g_pmapRegistrees->end() )
	{
		RString sFile;
		if (bLegacy && node.GetAttrValue("File", sFile) && sFile != "")
		{
			RString sPath;
			// Handle absolute paths correctly
			if (sFile.Left(1) == "/")
				sPath = sFile;
			else
				sPath = Dirname(GetSourcePath(&node)) + sFile;
			if (ResolvePath(sPath, GetWhere(&node)))
			{
				Actor *pNewActor = MakeActor(sPath, pParentActor);
				if (pNewActor == NULL)
					return NULL;
				if (pParentActor)
					pNewActor->SetParent(pParentActor);
				pNewActor->LoadFromNode(&node);
				return pNewActor;
			}
		}

		// sClass is invalid
		RString sError = ssprintf( "%s: invalid Class \"%s\"",
			ActorUtil::GetWhere(&node).c_str(), sClass.c_str() );
		LuaHelpers::ReportScriptError(sError);
		return new Actor;	// Return a dummy object so that we don't crash in AutoActor later.
	}

	const CreateActorFn &pfn = iter->second;
	Actor *pRet = pfn();

	if( pParentActor )
		pRet->SetParent( pParentActor );

	pRet->LoadFromNode( &node );
	return pRet;
}
示例#4
0
void CTariffSetting::GetTariff(  )
{
    QStringList lstRows;
    QString strWhere;
    GetWhere( strWhere );

    CLogicInterface::GetInterface( )->OperateTariffInfo( lstRows, CommonDataType::SelectData, strWhere );

    if ( 1 > lstRows.count( ) ) {
        return;
    }

    int nField = 2;
    ui->spLimitTime->setValue( lstRows[ nField++ ].toInt( ) );
    ui->spNoFullTime->setValue( lstRows[ nField++ ].toInt( ) );

    ui->tdtSection1->setTime( CCommonFunction::String2Time( lstRows[ nField++ ] ) );//QTime
    ui->tdtSection2->setTime( CCommonFunction::String2Time( lstRows[ nField++ ] ) );

    //ui->rbtnNoSection->setChecked( pSettings->value( strSection.arg( "NoSection" ), true ).toBool( ) );// bool
    //ui->rbtnSection->setChecked( pSettings->value( strSection.arg( "Section" ), false ).toBool( ) );
    //ControlUI( !ui->rbtnNoSection->isChecked( ) );

    ui->rule1MinInner->setValue( lstRows[ nField++ ].toInt( ) );//int
    ui->rule1FootInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule2MinInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule2FootInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule3MinInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule3FootInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule4MinInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule4FootInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule5MinInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule5FootInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule6MinInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule6FootInner->setValue( lstRows[ nField++ ].toInt( ) );

    ui->rule1MinOuter->setValue( lstRows[ nField++ ].toInt( ) );//int
    ui->rule1FootOuter->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule2MinOuter->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule2FootOuter->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule3MinOuter->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule3FootOuter->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule4MinOuter->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule4FootOuter->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule5MinOuter->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule5FootOuter->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule6MinOuter->setValue( lstRows[ nField++ ].toInt( ) );
    ui->rule6FootOuter->setValue( lstRows[ nField++ ].toInt( ) );

    ui->perMinInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->perMinFootInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->perMinOuter->setValue( lstRows[ nField++ ].toInt( ) );
    ui->perMinFootOuter->setValue( lstRows[ nField++ ].toInt( ) );

    ui->spLimitFootInner->setValue( lstRows[ nField++ ].toInt( ) );
    ui->spLimitFootOuter->setValue( lstRows[ nField++ ].toInt( ) );

    ui->perMinNoSectionLimit->setValue( lstRows[ nField++ ].toInt( ) );
    ui->perMinFootNoSection->setValue( lstRows[ nField++ ].toInt( ) );

    ui->perMinNoSectionFirst->setValue( lstRows[ nField++ ].toInt( ) );

    bool bSection = lstRows[ nField++ ].toInt( ) == 0 ? false : true;

    if ( bSection ) {
        ui->rbtnSection->setChecked( true );
    } else {
        ui->rbtnNoSection->setChecked( true );
    }

    ControlUI( !ui->rbtnNoSection->isChecked( ) );
}