-
Notifications
You must be signed in to change notification settings - Fork 1
/
Empresa.pas
91 lines (76 loc) · 2.47 KB
/
Empresa.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
unit Empresa;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls,
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, Data.DB, FireDAC.Comp.DataSet,
FireDAC.Comp.Client, System.Rtti, System.Bindings.Outputs, Vcl.Bind.Editors,
Data.Bind.EngExt, Vcl.Bind.DBEngExt, Data.Bind.Components, Data.Bind.DBScope;
type
TFEmpresa = class(TForm)
GridPanel1: TGridPanel;
GroupBox1: TGroupBox;
lbedIdEmpresa: TLabeledEdit;
lbedNombreEmpresa: TLabeledEdit;
lbedCIF: TLabeledEdit;
lbedCodigoPostal: TLabeledEdit;
lbedDireccion: TLabeledEdit;
lbedCiudad: TLabeledEdit;
lbedTelefonoFijo: TLabeledEdit;
lbedTelefonoMovil: TLabeledEdit;
lbedmail: TLabeledEdit;
FDEmpresa: TFDQuery;
Panel1: TPanel;
btnAceptar: TButton;
btnCerrar: TButton;
bndsrcdb1: TBindSourceDB;
bndngslst1: TBindingsList;
lnkcntrltfld1: TLinkControlToField;
LinkControlToField1: TLinkControlToField;
LinkControlToField2: TLinkControlToField;
LinkControlToField3: TLinkControlToField;
LinkControlToField4: TLinkControlToField;
LinkControlToField5: TLinkControlToField;
LinkControlToField6: TLinkControlToField;
LinkControlToField7: TLinkControlToField;
LinkControlToField8: TLinkControlToField;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure btnAceptarClick(Sender: TObject);
procedure btnCerrarClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FEmpresa: TFEmpresa;
implementation
uses
DModule1;
{$R *.dfm}
procedure TFEmpresa.btnAceptarClick(Sender: TObject);
begin
if FDEmpresa.State in [dsInsert,dsEdit] then FDEmpresa.Post;
end;
procedure TFEmpresa.btnCerrarClick(Sender: TObject);
begin
Close;
end;
procedure TFEmpresa.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if FDEmpresa.State in [dsInsert,dsEdit] then
if Application.MessageBox('¿Guardar los cambios de la empresa?','Guardar',MB_YESNO)=IDYES then
begin
FDEmpresa.Post;
end
else FDEmpresa.Cancel;
if FDEmpresa.Active then FDEmpresa.Close;
end;
procedure TFEmpresa.FormCreate(Sender: TObject);
begin
if not FDEmpresa.Active then FDEmpresa.Open;
end;
end.