| 2263 |
kivins |
1 |
//---------------------------------------------------------------------------
|
|
|
2 |
|
|
|
3 |
#include <vcl.h>
|
|
|
4 |
#pragma hdrstop
|
|
|
5 |
|
|
|
6 |
#include "TransactionConfig.h"
|
|
|
7 |
//---------------------------------------------------------------------------
|
|
|
8 |
#pragma package(smart_init)
|
|
|
9 |
#pragma resource "*.dfm"
|
|
|
10 |
TTxnConfig *TxnConfig;
|
|
|
11 |
//---------------------------------------------------------------------------
|
|
|
12 |
__fastcall TTxnConfig::TTxnConfig(TComponent* Owner)
|
|
|
13 |
: TForm(Owner)
|
|
|
14 |
{
|
|
|
15 |
}
|
|
|
16 |
//---------------------------------------------------------------------------
|
|
|
17 |
|
|
|
18 |
bool TTxnConfig::ShowForm(const AnsiString& project_code, int iteration, const AnsiString &testcase_text)
|
|
|
19 |
{
|
|
|
20 |
bool result = false;
|
|
|
21 |
AnsiString sql_statement;
|
|
|
22 |
|
|
|
23 |
m_selected_txns.clear();
|
|
|
24 |
TransactionList->Clear();
|
|
|
25 |
|
|
|
26 |
sql_statement.sprintf(
|
|
|
27 |
"SELECT * FROM MASS_TXNS "
|
|
|
28 |
"WHERE PROJECTCODE='%s' "
|
|
|
29 |
"AND ITERATION=%d "
|
|
|
30 |
"AND ENABLED = 'Y' "
|
|
|
31 |
"ORDER BY NAME",
|
|
|
32 |
project_code.c_str(), iteration);
|
|
|
33 |
|
|
|
34 |
MASSTxnQuery->SQL->Text = sql_statement;
|
|
|
35 |
|
|
|
36 |
MASSTxnQuery->Open();
|
|
|
37 |
|
|
|
38 |
while (!MASSTxnQuery->Eof)
|
|
|
39 |
{
|
|
|
40 |
unsigned short udtype = MASSTxnQuery->FieldByName("UDTYPE")->AsInteger;
|
|
|
41 |
unsigned short udsubtype = MASSTxnQuery->FieldByName("UDSUBTYPE")->AsInteger;
|
|
|
42 |
|
|
|
43 |
unsigned int txn_index = (udtype << 16) + udsubtype;
|
|
|
44 |
|
|
|
45 |
TransactionList->AddItem(MASSTxnQuery->FieldByName("NAME")->AsString, (TObject *)txn_index);
|
|
|
46 |
|
|
|
47 |
MASSTxnQuery->Next();
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
AnsiString caption;
|
|
|
51 |
caption.sprintf("Project: %s - Iteration: %d", project_code.c_str(), iteration);
|
|
|
52 |
TitlePanel->Caption = caption;
|
|
|
53 |
|
|
|
54 |
TestCasePanel->Caption = testcase_text;
|
|
|
55 |
|
|
|
56 |
if (ShowModal() == mrOk)
|
|
|
57 |
{
|
|
|
58 |
result = true;
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
return result;
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
//---------------------------------------------------------------------------
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
void __fastcall TTxnConfig::TransactionListClickCheck(TObject *Sender)
|
|
|
68 |
{
|
|
|
69 |
if (TransactionList->Checked[TransactionList->ItemIndex])
|
|
|
70 |
{
|
|
|
71 |
unsigned int txnindex = (int)(TransactionList->Items->Objects[TransactionList->ItemIndex]);
|
|
|
72 |
|
|
|
73 |
m_selected_txns.push_back(txnindex);
|
|
|
74 |
}
|
|
|
75 |
else
|
|
|
76 |
{
|
|
|
77 |
vector<unsigned int>::iterator itr = m_selected_txns.begin();
|
|
|
78 |
|
|
|
79 |
unsigned int txnindex = (int)(TransactionList->Items->Objects[TransactionList->ItemIndex]);
|
|
|
80 |
|
|
|
81 |
while (itr != m_selected_txns.end())
|
|
|
82 |
{
|
|
|
83 |
if (txnindex == (*itr))
|
|
|
84 |
{
|
|
|
85 |
m_selected_txns.erase(itr);
|
|
|
86 |
|
|
|
87 |
break;
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
++itr;
|
|
|
91 |
}
|
|
|
92 |
}
|
|
|
93 |
}
|
|
|
94 |
//---------------------------------------------------------------------------
|
|
|
95 |
|
|
|
96 |
vector<unsigned int> &TTxnConfig::getSelectedTxns()
|
|
|
97 |
{
|
|
|
98 |
return m_selected_txns;
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
//---------------------------------------------------------------------------
|
|
|
102 |
|
|
|
103 |
|
|
|
104 |
|