//--------------------------------------------------------------------------- #include #pragma hdrstop #include "TransactionConfig.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TTxnConfig *TxnConfig; //--------------------------------------------------------------------------- __fastcall TTxnConfig::TTxnConfig(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- bool TTxnConfig::ShowForm(const AnsiString& project_code, int iteration, const AnsiString &testcase_text) { bool result = false; AnsiString sql_statement; m_selected_txns.clear(); TransactionList->Clear(); sql_statement.sprintf( "SELECT * FROM MASS_TXNS " "WHERE PROJECTCODE='%s' " "AND ITERATION=%d " "ORDER BY NAME", project_code.c_str(), iteration); MASSTxnQuery->SQL->Text = sql_statement; MASSTxnQuery->Open(); while (!MASSTxnQuery->Eof) { unsigned short udtype = MASSTxnQuery->FieldByName("UDTYPE")->AsInteger; unsigned short udsubtype = MASSTxnQuery->FieldByName("UDSUBTYPE")->AsInteger; unsigned int txn_index = (udtype << 16) + udsubtype; TransactionList->AddItem(MASSTxnQuery->FieldByName("NAME")->AsString, (TObject *)txn_index); MASSTxnQuery->Next(); } AnsiString caption; caption.sprintf("Project: %s - Iteration: %d", project_code.c_str(), iteration); TitlePanel->Caption = caption; TestCasePanel->Caption = testcase_text; if (ShowModal() == mrOk) { result = true; } return result; } //--------------------------------------------------------------------------- void __fastcall TTxnConfig::TransactionListClickCheck(TObject *Sender) { if (TransactionList->Checked[TransactionList->ItemIndex]) { unsigned int txnindex = (int)(TransactionList->Items->Objects[TransactionList->ItemIndex]); m_selected_txns.push_back(txnindex); } else { vector::iterator itr = m_selected_txns.begin(); unsigned int txnindex = (int)(TransactionList->Items->Objects[TransactionList->ItemIndex]); while (itr != m_selected_txns.end()) { if (txnindex == (*itr)) { m_selected_txns.erase(itr); break; } ++itr; } } } //--------------------------------------------------------------------------- vector &TTxnConfig::getSelectedTxns() { return m_selected_txns; } //---------------------------------------------------------------------------