forked from joseafilho/cine-tapioca
-
Notifications
You must be signed in to change notification settings - Fork 1
/
uCadastroProdutos.pas
73 lines (61 loc) · 1.62 KB
/
uCadastroProdutos.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
unit uCadastroProdutos;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uCadastroBase, Data.DB,
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, FireDAC.Comp.DataSet, FireDAC.Comp.Client,
Vcl.StdCtrls, Vcl.Grids, Vcl.DBGrids, Vcl.DBCtrls, Vcl.ExtCtrls, Vcl.ComCtrls,
Vcl.Mask;
type
TfmCadastroProdutos = class(TfmCadastroBase)
qrDadosNOME: TStringField;
qrDadosPRECO: TBCDField;
qrDadosBARRA: TStringField;
qrDadosID: TFDAutoIncField;
Label1: TLabel;
edId: TDBEdit;
Label2: TLabel;
edNome: TDBEdit;
Label3: TLabel;
edPreco: TDBEdit;
Label4: TLabel;
edBarra: TDBEdit;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
protected
function ValidarDados: boolean; override;
public
{ Public declarations }
end;
var
fmCadastroProdutos: TfmCadastroProdutos;
implementation
{$R *.dfm}
uses uSystemUtils;
procedure TfmCadastroProdutos.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
fmCadastroProdutos := nil;
end;
function TfmCadastroProdutos.ValidarDados: boolean;
begin
if Trim(qrDadosNOME.AsString) = '' then
begin
ShowInformation('Informe o nome.');
edNome.SetFocus;
Exit(false);
end;
if qrDadosPRECO.AsCurrency <= 0 then
begin
ShowInformation('Preço inválidos.');
edPreco.SetFocus;
Exit(false);
end;
Result := true;
end;
end.