Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2218 sbetterm 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
		"ORDER BY NAME",
31
		project_code.c_str(), iteration);
32
 
33
	MASSTxnQuery->SQL->Text = sql_statement;
34
 
35
    MASSTxnQuery->Open();
36
 
37
    while (!MASSTxnQuery->Eof)
38
    {
39
    	unsigned short	udtype = MASSTxnQuery->FieldByName("UDTYPE")->AsInteger;
40
        unsigned short	udsubtype = MASSTxnQuery->FieldByName("UDSUBTYPE")->AsInteger;
41
 
42
    	unsigned int	txn_index = (udtype << 16) + udsubtype;
43
 
44
    	TransactionList->AddItem(MASSTxnQuery->FieldByName("NAME")->AsString, (TObject *)txn_index);
45
 
46
        MASSTxnQuery->Next();
47
    }
48
 
49
    AnsiString	caption;
50
    caption.sprintf("Project: %s - Iteration: %d", project_code.c_str(), iteration);
51
    TitlePanel->Caption = caption;
52
 
53
    TestCasePanel->Caption = testcase_text;
54
 
55
    if (ShowModal() == mrOk)
56
    {
57
	    result = true;
58
    }
59
 
60
    return result;
61
}
62
 
63
//---------------------------------------------------------------------------
64
 
65
 
66
void __fastcall TTxnConfig::TransactionListClickCheck(TObject *Sender)
67
{
68
	if (TransactionList->Checked[TransactionList->ItemIndex])
69
    {
70
		unsigned int   txnindex = (int)(TransactionList->Items->Objects[TransactionList->ItemIndex]);
71
 
72
    	m_selected_txns.push_back(txnindex);
73
    }
74
    else
75
    {
76
    	vector<unsigned int>::iterator	itr = m_selected_txns.begin();
77
 
78
		unsigned int   txnindex = (int)(TransactionList->Items->Objects[TransactionList->ItemIndex]);
79
 
80
        while (itr != m_selected_txns.end())
81
        {
82
		    if (txnindex == (*itr))
83
            {
84
            	m_selected_txns.erase(itr);
85
 
86
            	break;
87
            }
88
 
89
            ++itr;
90
        }
91
    }
92
}
93
//---------------------------------------------------------------------------
94
 
95
vector<unsigned int> &TTxnConfig::getSelectedTxns()
96
{
97
	return m_selected_txns;
98
}
99
 
100
//---------------------------------------------------------------------------
101
 
102
 
103