-
Notifications
You must be signed in to change notification settings - Fork 1
/
PravoZaModule.pas
107 lines (94 loc) · 2.88 KB
/
PravoZaModule.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
unit PravoZaModule;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables, StdCtrls, Buttons, dxTL, dxDBCtrl, dxDBGrid, dxCntner,
dxDBTLCl, dxGrClms;
type
TFPravoNaModule = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
tKorisnici: TTable;
dsKorisnici: TDataSource;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Sifra: TdxDBGridMaskColumn;
dxDBGrid1ImePrezime: TdxDBGridMaskColumn;
dxDBGrid1LoginName: TdxDBGridMaskColumn;
dxDBGrid1Lozinka: TdxDBGridMaskColumn;
dxDBGrid2: TdxDBGrid;
dxDBGrid3: TdxDBGrid;
dsPravo: TDataSource;
tPravo: TTable;
tPravoSifra: TAutoIncField;
tPravoSifraKorisnika: TIntegerField;
tPravoSifraModula: TIntegerField;
tPravoNivoPrava: TIntegerField;
tNivo: TTable;
tModuli: TTable;
dsNivo: TDataSource;
dsModuli: TDataSource;
tPravolookNazivModula: TStringField;
tPravolooknazivNivoa: TStringField;
dxDBGrid3Sifra: TdxDBGridMaskColumn;
dxDBGrid3SifraKorisnika: TdxDBGridMaskColumn;
dxDBGrid3SifraModula: TdxDBGridMaskColumn;
dxDBGrid3NivoPrava: TdxDBGridMaskColumn;
dxDBGrid3looknazivNivoa: TdxDBGridLookupColumn;
qOstalaPrava: TQuery;
dsNema: TDataSource;
dxDBGrid2sifra: TdxDBGridMaskColumn;
dxDBGrid2nazivmodula: TdxDBGridMaskColumn;
dxDBGrid3lookNazivModula: TdxDBGridColumn;
Query1: TQuery;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BitBtn1Click(Sender: TObject);
procedure onIzlaz(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FPravoNaModule: TFPravoNaModule;
implementation
{$R *.DFM}
procedure TFPravoNaModule.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TFPravoNaModule.BitBtn1Click(Sender: TObject);
begin
Query1.SQL.Text:='INSERT INTO pravonamodule '+
'(sifrakorisnika, siframodula, nivoprava) '+
'VALUES ('+tKorisnici.FieldByName('sifra').AsString+
', '+qOstalaPrava.FieldByName('sifra').AsString+', 1)';
Query1.ExecSQL;
Query1.Close;
qOstalaPrava.DisableControls;
tPravo.Close;
tPravo.Open;
qOstalaPrava.EnableControls;
end;
procedure TFPravoNaModule.onIzlaz(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=27 then Close;
end;
procedure TFPravoNaModule.BitBtn2Click(Sender: TObject);
begin
Query1.SQL.Text:='DELETE FROM pravonamodule '+
'WHERE sifra='+tPravo.FieldByName('sifra').AsString;
Query1.ExecSQL;
Query1.Close;
qOstalaPrava.DisableControls;
tPravo.Close;
tPravo.Open;
qOstalaPrava.EnableControls;
end;
end.