-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuSchemeDialog.pas
99 lines (85 loc) · 2.29 KB
/
uSchemeDialog.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{
Oracle Deploy System ver.1.0 (ORDESY)
by Volodymyr Sedler aka scribe
2016
Desc: wrap/deploy/save objects of oracle database.
No warranty of using this program.
Just Free.
With bugs, suggestions please write to justscribe@yahoo.com
On Github: github.com/justscribe/ORDESY
Dialog to create/edit schemes.
}
unit uSchemeDialog;
interface
uses
// ORDESY Modules
{$IFDEF Debug}
uLog,
{$ENDIF}
uORDESY,
// Delphi Modules
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TfmSchemeDialog = class(TForm)
pnlMain: TPanel;
gbxLogin: TGroupBox;
gbxPass: TGroupBox;
edtPass: TEdit;
edtLogin: TEdit;
btnCancel: TButton;
btnSave: TButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btnSaveClick(Sender: TObject);
end;
function ShowSchemeCreateDialog(aProjectList: TORDESYProjectList): boolean;
function ShowSchemeEditDialog(aScheme: TOraScheme): boolean;
implementation
{$R *.dfm}
function ShowSchemeCreateDialog(aProjectList: TORDESYProjectList): boolean;
begin
with TfmSchemeDialog.Create(Application) do
try
Caption:= 'Add scheme';
if ShowModal = mrOk then
begin
aProjectList.AddOraScheme(TOraScheme.Create(aProjectList, aProjectList.GetFreeSchemeId, edtLogin.Text, edtPass.Text));
end;
finally
Free;
end;
end;
function ShowSchemeEditDialog(aScheme: TOraScheme): boolean;
begin
with TfmSchemeDialog.Create(Application) do
try
Caption:= 'Edit scheme';
edtLogin.Text:= aScheme.Login;
edtPass.Text:= aScheme.Pass;
if ShowModal = mrOk then
begin
aScheme.Login:= edtLogin.Text;
aScheme.Pass:= edtPass.Text;
end;
finally
Free;
end;
end;
procedure TfmSchemeDialog.btnSaveClick(Sender: TObject);
begin
if (edtLogin.Text = '') or (Length(edtLogin.Text) > 255) then
begin
ModalResult:= mrNone;
raise Exception.Create('Incorrect scheme name, empty or more than 255 characters!');
end;
if (Length(edtPass.Text) > 255) then
begin
ModalResult:= mrNone;
raise Exception.Create('Incorrect scheme password, more than 255 characters!');
end;
end;
procedure TfmSchemeDialog.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:= caFree;
end;
end.