-
Notifications
You must be signed in to change notification settings - Fork 1
/
ufrmCadBase.pas
148 lines (121 loc) · 3.54 KB
/
ufrmCadBase.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
unit ufrmCadBase;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, ufrmSimples, cxGraphics, cxControls,
cxLookAndFeels, cxLookAndFeelPainters, dxRibbonCustomizationForm,
dxRibbonSkins, cxButtonEdit, cxDropDownEdit, cxTextEdit, System.ImageList,
Vcl.ImgList, cxImageList, dxSkinsForm, dxBar, cxBarEditItem, cxClasses,
dxRibbon, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf,
FireDAC.Stan.Async, FireDAC.DApt, dxBarBuiltInMenu, cxStyles, cxCustomData,
cxFilter, cxData, cxDataStorage, cxEdit, cxNavigator, dxDateRanges, Data.DB,
cxDBData, cxGridLevel, cxGridCustomView, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxGrid, cxPC, FireDAC.Comp.DataSet,
FireDAC.Comp.Client, dxSkinsCore, dxSkinProject1;
type
TfrmCadBase = class(TfrmSimples)
pc: TcxPageControl;
cxTabSheet1: TcxTabSheet;
cxGrid: TcxGrid;
cxGridDBTableView1: TcxGridDBTableView;
cxGridLevel1: TcxGridLevel;
cxTabSheet2: TcxTabSheet;
procedure btnAdcClick(Sender: TObject);
procedure btnEditClick(Sender: TObject);
procedure btnDelClick(Sender: TObject);
procedure btnSaveClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure dxBarLargeButton7Click(Sender: TObject);
procedure dtsStateChange(Sender: TObject);
procedure cxGridDBTableView1DblClick(Sender: TObject);
private
{ Private declarations }
public
procedure montaQry; virtual;
end;
var
frmCadBase: TfrmCadBase;
implementation
{$R *.dfm}
uses uDM;
procedure TfrmCadBase.btnAdcClick(Sender: TObject);
begin
inherited;
dts.DataSet.Append;
end;
procedure TfrmCadBase.btnCancelClick(Sender: TObject);
begin
inherited;
dts.DataSet.Cancel;
if Dm.FDTrans.Connection.InTransaction then
Dm.FDTrans.RollbackRetaining;
end;
procedure TfrmCadBase.btnDelClick(Sender: TObject);
begin
inherited;
if dts.DataSet.RecordCount > 0 then
begin
if Application.MessageBox('Deseja realmente excluir este registro?',Dm.nomesistema,MB_ICONQUESTION + MB_YESNO) = mrYes then
begin
dts.DataSet.Delete;
if Dm.FDTrans.Connection.InTransaction then
Dm.FDTrans.CommitRetaining;
dts.DataSet.Refresh;
end;
end;
end;
procedure TfrmCadBase.btnEditClick(Sender: TObject);
begin
inherited;
if dts.DataSet.RecordCount > 0 then
dts.DataSet.Edit
end;
procedure TfrmCadBase.btnSaveClick(Sender: TObject);
begin
inherited;
dts.DataSet.Post;
if Dm.FDTrans.Connection.InTransaction then
Dm.FDTrans.CommitRetaining;
montaQry;
end;
procedure TfrmCadBase.cxGridDBTableView1DblClick(Sender: TObject);
begin
inherited;
btnEdit.Click;
end;
procedure TfrmCadBase.dtsStateChange(Sender: TObject);
begin
inherited;
if dts.State in [dsEdit, dsInsert] then
begin
barPESQ.Visible := false;
barBasicos.Visible := false;
barAcoes.Visible := true;
PC.ActivePageIndex := 1;
end
else
begin
barPESQ.Visible := true;
barBasicos.Visible := true;
barAcoes.Visible := false;
PC.ActivePageIndex := 0;
end;
end;
procedure TfrmCadBase.dxBarLargeButton7Click(Sender: TObject);
begin
inherited;
montaQry;
end;
procedure TfrmCadBase.FormCreate(Sender: TObject);
begin
inherited;
montaQry;
//DisableAero := True;
PC.ActivePageIndex := 0;
end;
procedure TfrmCadBase.montaQry;
begin
end;
end.