| 2265 |
kivins |
1 |
//---------------------------------------------------------------------------
|
|
|
2 |
|
|
|
3 |
#include <vcl.h>
|
|
|
4 |
#pragma hdrstop
|
|
|
5 |
|
|
|
6 |
#include "CopyIteration.h"
|
|
|
7 |
#include "Utilities.h"
|
|
|
8 |
//---------------------------------------------------------------------------
|
|
|
9 |
#pragma package(smart_init)
|
|
|
10 |
#pragma link "AdvGrid"
|
|
|
11 |
#pragma link "AdvPanel"
|
|
|
12 |
#pragma link "BaseGrid"
|
|
|
13 |
#pragma link "DBAdvGrd"
|
|
|
14 |
#pragma resource "*.dfm"
|
|
|
15 |
TCopyIterationForm *CopyIterationForm;
|
|
|
16 |
//---------------------------------------------------------------------------
|
|
|
17 |
__fastcall TCopyIterationForm::TCopyIterationForm(TComponent* Owner)
|
|
|
18 |
: TForm(Owner)
|
|
|
19 |
{
|
|
|
20 |
}
|
|
|
21 |
//---------------------------------------------------------------------------
|
|
|
22 |
|
|
|
23 |
void __fastcall TCopyIterationForm::ShowForm(
|
|
|
24 |
const AnsiString & projectCode,
|
|
|
25 |
const int & projectIteration )
|
|
|
26 |
{
|
|
|
27 |
m_projectCode = projectCode;
|
|
|
28 |
m_projectIteration = projectIteration;
|
|
|
29 |
|
|
|
30 |
AnsiString sqlStatement;
|
|
|
31 |
sqlStatement.sprintf(
|
|
|
32 |
"SELECT "
|
|
|
33 |
"* "
|
|
|
34 |
"FROM "
|
|
|
35 |
"ITERATIONS "
|
|
|
36 |
"WHERE "
|
|
|
37 |
"NOT ( PROJECT_CODE=\'%s\' AND "
|
|
|
38 |
"ITERATION=%d ) "
|
|
|
39 |
"ORDER BY "
|
|
|
40 |
"PROJECT_CODE,"
|
|
|
41 |
"ITERATION",
|
|
|
42 |
Utilities::EscapeString( m_projectCode ).c_str(),
|
|
|
43 |
m_projectIteration );
|
|
|
44 |
SourceIterationsQuery->SQL->Text = sqlStatement;
|
|
|
45 |
|
|
|
46 |
SourceIterationsQuery->Open();
|
|
|
47 |
|
|
|
48 |
ShowModal();
|
|
|
49 |
}
|
|
|
50 |
//---------------------------------------------------------------------------
|
|
|
51 |
|
|
|
52 |
void __fastcall TCopyIterationForm::CopyClick(TObject *Sender)
|
|
|
53 |
{
|
|
|
54 |
/*
|
|
|
55 |
* Copy the selected iteration into our current iteration.
|
|
|
56 |
*/
|
|
|
57 |
|
|
|
58 |
const AnsiString sourceProjectCode = SourceIterationsQuery->FieldByName( "PROJECT_CODE" )->AsString;
|
|
|
59 |
const int sourceProjectIteration = SourceIterationsQuery->FieldByName( "ITERATION" )->AsInteger;
|
|
|
60 |
|
|
|
61 |
CopyIterationProcedure->Parameters->ParamValues[ "fromProjectCode" ] = sourceProjectCode;
|
|
|
62 |
CopyIterationProcedure->Parameters->ParamValues[ "fromIteration" ] = sourceProjectIteration;
|
|
|
63 |
CopyIterationProcedure->Parameters->ParamValues[ "toProjectCode" ] = m_projectCode;
|
|
|
64 |
CopyIterationProcedure->Parameters->ParamValues[ "toIteration" ] = m_projectIteration;
|
|
|
65 |
|
|
|
66 |
CopyIterationProcedure->ExecProc();
|
|
|
67 |
}
|
|
|
68 |
//---------------------------------------------------------------------------
|
|
|
69 |
|