-
Notifications
You must be signed in to change notification settings - Fork 0
/
UAlerterConfig.pas
120 lines (97 loc) · 2.89 KB
/
UAlerterConfig.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
unit UAlerterConfig;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, DB, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
Buttons, ComCtrls, DBCtrls, TplGradientUnit, rxdbgrid, ZDataset, ZSqlUpdate,
rxdbutils, datamodule;
type
{ TAlerterConfig }
TAlerterConfig = class(TForm)
btnDodajBind: TBitBtn;
btnUsunBind: TBitBtn;
btnGetLocalIP: TSpeedButton;
DBComboBox1: TDBComboBox;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
DBEdit3: TDBEdit;
DBNavigator1: TDBNavigator;
DSAlerterLok: TDataSource;
DSAlerterBind: TDataSource;
DSAlerterLokalizacje: TDataSource;
Image1: TImage;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Panel1: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
Panel6: TPanel;
Panel7: TPanel;
plGradient2: TplGradient;
RxDBGrid4: TRxDBGrid;
RxDBGrid5: TRxDBGrid;
RxDBGrid6: TRxDBGrid;
ZQAlerterLok: TZQuery;
ZQAlerterBind: TZQuery;
ZQAlerterLokalizacje: TZQuery;
ZUAlerterBind: TZUpdateSQL;
procedure btnDodajBindClick(Sender: TObject);
procedure btnGetLocalIPClick(Sender: TObject);
procedure btnUsunBindClick(Sender: TObject);
procedure DSAlerterLokDataChange(Sender: TObject; Field: TField);
procedure DSAlerterLokUpdateData(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
public
end;
implementation
uses UAlerter;
{$R *.frm}
{ TAlerterConfig }
procedure TAlerterConfig.FormCreate(Sender: TObject);
begin
ZQAlerterLok.Open;
end;
procedure TAlerterConfig.btnGetLocalIPClick(Sender: TObject);
begin
ZQAlerterLok.Edit;
ZQAlerterLok.FieldByName('IP').AsString:= TAlerter.GetLocalIP;
end;
procedure TAlerterConfig.btnDodajBindClick(Sender: TObject);
var id: integer;
begin
if ZQAlerterLokalizacje.IsEmpty then exit;
id:= ZQAlerterLokalizacje.FieldByName('ID').AsInteger;
ZQAlerterBind.Append;
ZQAlerterBind.FieldByName('ID_Client').AsInteger:= ZQAlerterLok.FieldByName('ID').AsInteger;
ZQAlerterBind.FieldByName('ID_Serwer').AsInteger:= id;
ZQAlerterBind.Post;
RefreshQuery(ZQAlerterLokalizacje);
RefreshQuery(ZQAlerterBind);
ZQAlerterBind.Locate('ID_serwer', id, []);
end;
procedure TAlerterConfig.btnUsunBindClick(Sender: TObject);
begin
ZQAlerterBind.Delete;
RefreshQuery(ZQAlerterLokalizacje);
end;
procedure TAlerterConfig.DSAlerterLokDataChange(Sender: TObject; Field: TField);
begin
ZQAlerterBind.Close;
ZQAlerterLokalizacje.Close;
if ZQAlerterLok.IsEmpty then exit;
ZQAlerterBind.ParamByName('ID_client').AsInteger:= ZQAlerterLok.FieldByName('ID').AsInteger;
ZQAlerterBind.Open;
ZQAlerterLokalizacje.ParamByName('ID_client').AsInteger:= ZQAlerterLok.FieldByName('ID').AsInteger;
ZQAlerterLokalizacje.Open;
end;
procedure TAlerterConfig.DSAlerterLokUpdateData(Sender: TObject);
begin
RefreshQuery(ZQAlerterLokalizacje);
end;
end.