-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuCadastroCategoria.pas
More file actions
139 lines (126 loc) · 3.59 KB
/
Copy pathuCadastroCategoria.pas
File metadata and controls
139 lines (126 loc) · 3.59 KB
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
unit uCadastroCategoria;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
Data.Bind.Controls, FMX.ListView.Types, FMX.ListView.Appearances,
FMX.ListView.Adapters.Base, FMX.Edit, FMX.ListView, fMensagem,
Fmx.Bind.Navigator, FMX.Objects, FMX.Controls.Presentation, FMX.StdCtrls,
FMX.Layouts, Data.Bind.EngExt, Fmx.Bind.DBEngExt, System.Rtti,
System.Bindings.Outputs, Fmx.Bind.Editors, Data.Bind.Components,
Data.Bind.DBScope, Data.DB;
type
TFrmCadastroCategoria = class(TForm)
LoBase: TLayout;
RBackground: TRectangle;
LoTopo: TLayout;
RBackgroundTopo: TRectangle;
LoTopoRight: TLayout;
BtnNovo: TRectangle;
Label4: TLabel;
Layout6: TLayout;
Rectangle8: TRectangle;
LoTopoLeft: TLayout;
BtnVoltar: TRectangle;
LoTopoCenter: TLayout;
LblTitulo: TLabel;
LoCorpo: TLayout;
Layout2: TLayout;
Layout17: TLayout;
BtnExcluir: TRectangle;
Layout7: TLayout;
Image4: TImage;
Label3: TLabel;
LoRodape: TLayout;
Rectangle3: TRectangle;
Layout1: TLayout;
Layout18: TLayout;
BtnSalvar: TRectangle;
Image1: TImage;
Label7: TLabel;
BtnCancelar: TRectangle;
Image5: TImage;
Label11: TLabel;
Layout13: TLayout;
BindNavigator1: TBindNavigator;
FrameMensagem1: TFrameMensagem;
RecCombo: TRectangle;
LVCombo: TListView;
Layout9: TLayout;
Rectangle5: TRectangle;
Layout15: TLayout;
Layout19: TLayout;
BtnFecharLV: TRectangle;
Layout23: TLayout;
Label9: TLabel;
Layout4: TLayout;
Layout5: TLayout;
EditDescricao: TEdit;
Layout10: TLayout;
Label2: TLabel;
Layout12: TLayout;
LblCodigo: TLabel;
Label8: TLabel;
BindSourceDB1: TBindSourceDB;
BindingsList1: TBindingsList;
LinkPropertyToFieldText: TLinkPropertyToField;
LinkControlToField1: TLinkControlToField;
procedure BtnSalvarClick(Sender: TObject);
procedure BtnVoltarClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BtnCancelarClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmCadastroCategoria: TFrmCadastroCategoria;
implementation
{$R *.fmx}
uses Funcoes, VariaveisGlobais, DataModulo;
procedure TFrmCadastroCategoria.BtnCancelarClick(Sender: TObject);
begin
if DM.TblCategoria.State in [dsInsert, dsEdit] then
begin
DM.TblCategoria.Cancel;
ShowMessage('Cancelado com sucesso!');
end;
end;
procedure TFrmCadastroCategoria.BtnSalvarClick(Sender: TObject);
begin
if DM.TblCategoria.State in [dsInsert] then
begin
if not VerificaExisteDescricao('CATEGORIA', 'DESCRICAO', EditDescricao.Text) then
begin
ShowMessage('Adicionado com sucesso');
DM.TblCategoria.Post;
end;
end
else
if DM.TblCategoria.State in [dsEdit] then
begin
if DM.TblCategoria.FieldByName('Descricao').OldValue <> EditDescricao.Text then
begin
if not VerificaExisteDescricao('CATEGORIA', 'DESCRICAO', EditDescricao.Text) then
begin
ShowMessage('Modificado com sucesso');
DM.TblCategoria.Post;
end
else
begin
ShowMessage('Ja existe');
end;
end;
end;
end;
procedure TFrmCadastroCategoria.BtnVoltarClick(Sender: TObject);
begin
DM.TblCategoria.Cancel;
Close;
end;
procedure TFrmCadastroCategoria.FormCreate(Sender: TObject);
begin
DM.TblCategoria.Open();
end;
end.