forked from joseafilho/cine-tapioca
-
Notifications
You must be signed in to change notification settings - Fork 1
/
uCadastroSessoes.pas
115 lines (99 loc) · 2.77 KB
/
uCadastroSessoes.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
unit uCadastroSessoes;
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, Vcl.Buttons;
type
TfmCadastroSessoes = class(TfmCadastroBase)
qrDadosNOME: TStringField;
qrDadosHORA: TTimeField;
qrDadosFILME: TIntegerField;
qrDadosSALA: TIntegerField;
qrDadosID: TFDAutoIncField;
Id: TLabel;
edId: TDBEdit;
Label1: TLabel;
edNome: TDBEdit;
Label2: TLabel;
tpHora: TDateTimePicker;
lkSalas: TDBLookupComboBox;
qrSalas: TFDQuery;
dsSalas: TDataSource;
qrSalasID: TIntegerField;
qrSalasNOME: TStringField;
qrSalasCAPACIDADE: TIntegerField;
Label3: TLabel;
qrFilmes: TFDQuery;
qrFilmesID: TIntegerField;
qrFilmesNOME: TStringField;
qrFilmesDUBLADO: TSmallintField;
qrFilmesCLASSIFICADO: TSmallintField;
qrFilmesTIPO: TSmallintField;
dsFilmes: TDataSource;
Label4: TLabel;
lkFilmes: TDBLookupComboBox;
qrDadosFILME_NOME: TStringField;
qrDadosSALA_NOME: TStringField;
btSalasRefresh: TSpeedButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure qrDadosBeforePost(DataSet: TDataSet);
procedure qrDadosAfterScroll(DataSet: TDataSet);
procedure btSalasRefreshClick(Sender: TObject);
private
{ Private declarations }
protected
function ValidarDados: boolean; override;
public
{ Public declarations }
end;
var
fmCadastroSessoes: TfmCadastroSessoes;
implementation
{$R *.dfm}
uses uDmConn, uSystemUtils;
{ TfmCadastroSessoes }
procedure TfmCadastroSessoes.btSalasRefreshClick(Sender: TObject);
begin
inherited;
qrSalas.Refresh;
end;
procedure TfmCadastroSessoes.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
fmCadastroSessoes := nil;
end;
procedure TfmCadastroSessoes.FormShow(Sender: TObject);
begin
inherited;
qrSalas.Open;
qrFilmes.Open;
end;
procedure TfmCadastroSessoes.qrDadosAfterScroll(DataSet: TDataSet);
begin
inherited;
tpHora.Time := qrDadosHORA.AsDateTime;
end;
procedure TfmCadastroSessoes.qrDadosBeforePost(DataSet: TDataSet);
begin
inherited;
qrDadosHORA.AsDateTime := tpHora.Time;
end;
function TfmCadastroSessoes.ValidarDados: boolean;
begin
if Trim(qrDadosNOME.AsString) = '' then
begin
ShowInformation('Informe o nome.');
edNome.SetFocus;
Exit(false);
end;
Result := true;
end;
end.