Skip to content

Commit 6201028

Browse files
committed
Parte3
1 parent 8640a63 commit 6201028

20 files changed

+1208
-16
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ __history/Orm.dpr.~2~
33
*.dcu
44
__history/Orm.dpr.~3~
55
Win32/Debug/Orm.exe
6-
*.~2~
6+
*.~2~
7+
*.ini

Main.dfm

Lines changed: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ object fmMain: TfmMain
22
Left = 0
33
Top = 0
44
Caption = 'Main'
5-
ClientHeight = 300
6-
ClientWidth = 635
5+
ClientHeight = 387
6+
ClientWidth = 774
77
Color = clBtnFace
88
Font.Charset = DEFAULT_CHARSET
99
Font.Color = clWindowText
@@ -13,4 +13,101 @@ object fmMain: TfmMain
1313
OldCreateOrder = False
1414
PixelsPerInch = 96
1515
TextHeight = 13
16+
object Label1: TLabel
17+
Left = 8
18+
Top = 27
19+
Width = 27
20+
Height = 13
21+
Caption = 'Nome'
22+
end
23+
object Label2: TLabel
24+
Left = 8
25+
Top = 51
26+
Width = 19
27+
Height = 13
28+
Caption = 'CPF'
29+
end
30+
object Label3: TLabel
31+
Left = 8
32+
Top = 81
33+
Width = 45
34+
Height = 13
35+
Caption = 'Endere'#231'o'
36+
end
37+
object Label4: TLabel
38+
Left = 8
39+
Top = 108
40+
Width = 19
41+
Height = 13
42+
Caption = 'Cep'
43+
end
44+
object Label5: TLabel
45+
Left = 315
46+
Top = 103
47+
Width = 11
48+
Height = 13
49+
Caption = 'ID'
50+
end
51+
object edtNome: TEdit
52+
Left = 59
53+
Top = 24
54+
Width = 121
55+
Height = 21
56+
TabOrder = 0
57+
end
58+
object edtCpf: TEdit
59+
Left = 59
60+
Top = 51
61+
Width = 110
62+
Height = 21
63+
TabOrder = 1
64+
end
65+
object edtEndereco: TEdit
66+
Left = 59
67+
Top = 78
68+
Width = 121
69+
Height = 21
70+
TabOrder = 2
71+
end
72+
object edtCEP: TEdit
73+
Left = 59
74+
Top = 105
75+
Width = 121
76+
Height = 21
77+
TabOrder = 3
78+
end
79+
object Button1: TButton
80+
Left = 59
81+
Top = 132
82+
Width = 75
83+
Height = 25
84+
Caption = 'Inserir'
85+
TabOrder = 4
86+
OnClick = Button1Click
87+
end
88+
object Button2: TButton
89+
Left = 398
90+
Top = 127
91+
Width = 75
92+
Height = 25
93+
Caption = 'Load'
94+
TabOrder = 5
95+
OnClick = Button2Click
96+
end
97+
object edtID: TEdit
98+
Left = 352
99+
Top = 100
100+
Width = 121
101+
Height = 21
102+
TabOrder = 6
103+
end
104+
object Update: TButton
105+
Left = 140
106+
Top = 132
107+
Width = 75
108+
Height = 25
109+
Caption = 'Update'
110+
TabOrder = 7
111+
OnClick = UpdateClick
112+
end
16113
end

Main.pas

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,29 @@ interface
44

55
uses
66
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
7-
Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
7+
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, uClientes;
88

99
type
1010
TfmMain = class(TForm)
11+
edtNome: TEdit;
12+
edtCpf: TEdit;
13+
edtEndereco: TEdit;
14+
edtCEP: TEdit;
15+
Label1: TLabel;
16+
Label2: TLabel;
17+
Label3: TLabel;
18+
Label4: TLabel;
19+
Button1: TButton;
20+
Button2: TButton;
21+
edtID: TEdit;
22+
Label5: TLabel;
23+
Update: TButton;
24+
procedure Button1Click(Sender: TObject);
25+
procedure Button2Click(Sender: TObject);
26+
procedure UpdateClick(Sender: TObject);
1127
private
1228
{ Private declarations }
29+
FCliente: TCliente;
1330
public
1431
{ Public declarations }
1532
end;
@@ -21,4 +38,48 @@ implementation
2138

2239
{$R *.dfm}
2340

41+
procedure TfmMain.Button1Click(Sender: TObject);
42+
begin
43+
with TCliente.Create do
44+
try
45+
Nome := edtNome.Text;
46+
CnpjCpf := edtCpf.Text;
47+
Endereco := edtEndereco.Text;
48+
Cep := edtCEP.Text;
49+
if Insert then
50+
begin
51+
ShowMessage('Inserido com sucesso!');
52+
edtID.Text := IntToStr(ID);
53+
end;
54+
finally
55+
Free;
56+
end;
57+
end;
58+
59+
procedure TfmMain.Button2Click(Sender: TObject);
60+
begin
61+
if not Assigned(FCliente) then
62+
FCliente := TCliente.Create;
63+
FCliente.Load(StrToIntDef(edtID.Text,0));
64+
with FCliente do
65+
begin
66+
edtNome.Text := Nome;
67+
edtCpf.Text := CnpjCpf;
68+
edtEndereco.Text := Endereco;
69+
edtCEP.Text := Cep;
70+
end;
71+
end;
72+
73+
procedure TfmMain.UpdateClick(Sender: TObject);
74+
begin
75+
with FCliente do
76+
begin
77+
Nome := edtNome.Text;
78+
CnpjCpf := edtCpf.Text;
79+
Endereco := edtEndereco.Text;
80+
Cep := edtCEP.Text;
81+
Update;
82+
end;
83+
end;
84+
2485
end.

Orm.dpr

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ uses
55
Main in 'Main.pas' {fmMain},
66
uAtrib in 'uAtrib.pas',
77
uConnection in 'uConnection.pas',
8-
uCFG in '..\Exemplo\uCFG.pas',
9-
uPersistentObject in 'uPersistentObject.pas';
8+
uPersistentObject in 'uPersistentObject.pas',
9+
uCFG in 'uCFG.pas',
10+
uClientes in 'uClientes.pas';
1011

1112
{$R *.res}
1213

Orm.dproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@
8181
</DCCReference>
8282
<DCCReference Include="uAtrib.pas"/>
8383
<DCCReference Include="uConnection.pas"/>
84-
<DCCReference Include="..\Exemplo\uCFG.pas"/>
8584
<DCCReference Include="uPersistentObject.pas"/>
85+
<DCCReference Include="uCFG.pas"/>
86+
<DCCReference Include="uClientes.pas"/>
8687
<BuildConfiguration Include="Release">
8788
<Key>Cfg_2</Key>
8889
<CfgParent>Base</CfgParent>

Orm.dproj.local

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@
44
<Transaction>2015/03/12 20:47:49.000.191,=C:\Users\Derkoski\Documents\Embarcadero\Studio\Projects\Unit1.pas</Transaction>
55
<Transaction>2015/09/01 22:28:20.000.388,=C:\Users\Derkoski\Documents\Embarcadero\Studio\Projects\Unit1.pas</Transaction>
66
<Transaction>2015/09/01 22:28:25.000.565,=C:\Users\Derkoski\Documents\Embarcadero\Studio\Projects\Unit2.pas</Transaction>
7-
<Transaction>2015/09/01 22:29:00.000.161,C:\Users\Derkoski\Documents\Embarcadero\Studio\Projects\Unit2.pas=C:\JustCode\Exemplo 1\uAtrib.pas</Transaction>
8-
<Transaction>2015/09/01 22:29:06.000.984,C:\Users\Derkoski\Documents\Embarcadero\Studio\Projects\Unit1.dfm=C:\JustCode\Exemplo 1\Unit1.dfm</Transaction>
9-
<Transaction>2015/09/01 22:29:06.000.984,C:\Users\Derkoski\Documents\Embarcadero\Studio\Projects\Unit1.pas=C:\JustCode\Exemplo 1\Unit1.pas</Transaction>
10-
<Transaction>2015/09/01 22:29:16.000.131,C:\Users\Derkoski\Documents\Embarcadero\Studio\Projects\Project1.dproj=C:\JustCode\Exemplo 1\Orm.dproj</Transaction>
11-
<Transaction>2015/09/02 22:46:03.686,=C:\JustCode\ORMDelphi\Main.pas</Transaction>
12-
<Transaction>2015/09/02 22:46:04.478,=C:\JustCode\ORMDelphi\uConnection.pas</Transaction>
13-
<Transaction>2015/09/02 22:46:30.428,=C:\JustCode\Exemplo\uCFG.pas</Transaction>
14-
<Transaction>2015/09/02 22:53:54.176,=C:\JustCode\ORMDelphi\Unit1.pas</Transaction>
15-
<Transaction>2015/09/02 22:54:13.336,C:\JustCode\ORMDelphi\uPersistentObject.pas=C:\JustCode\ORMDelphi\Unit1.pas</Transaction>
7+
<Transaction>2015/09/01 22:29:00.000.161,C:\JustCode\Exemplo 1\uAtrib.pas=C:\Users\Derkoski\Documents\Embarcadero\Studio\Projects\Unit2.pas</Transaction>
8+
<Transaction>2015/09/01 22:29:06.000.984,C:\JustCode\Exemplo 1\Unit1.dfm=C:\Users\Derkoski\Documents\Embarcadero\Studio\Projects\Unit1.dfm</Transaction>
9+
<Transaction>2015/09/01 22:29:06.000.984,C:\JustCode\Exemplo 1\Unit1.pas=C:\Users\Derkoski\Documents\Embarcadero\Studio\Projects\Unit1.pas</Transaction>
10+
<Transaction>2015/09/01 22:29:16.000.131,C:\JustCode\Exemplo 1\Orm.dproj=C:\Users\Derkoski\Documents\Embarcadero\Studio\Projects\Project1.dproj</Transaction>
11+
<Transaction>2015/09/02 22:46:03.000.686,=C:\JustCode\ORMDelphi\Main.pas</Transaction>
12+
<Transaction>2015/09/02 22:46:04.000.478,=C:\JustCode\ORMDelphi\uConnection.pas</Transaction>
13+
<Transaction>2015/09/02 22:46:30.000.428,=C:\JustCode\Exemplo\uCFG.pas</Transaction>
14+
<Transaction>2015/09/02 22:53:54.000.176,=C:\JustCode\ORMDelphi\Unit1.pas</Transaction>
15+
<Transaction>2015/09/02 22:54:13.000.336,C:\JustCode\ORMDelphi\Unit1.pas=C:\JustCode\ORMDelphi\uPersistentObject.pas</Transaction>
16+
<Transaction>2015/09/07 21:00:18.000.546,C:\JustCode\Exemplo\uCFG.pas=</Transaction>
17+
<Transaction>2015/09/07 21:00:21.000.819,=C:\JustCode\ORMDelphi\Unit1.pas</Transaction>
18+
<Transaction>2015/09/07 21:00:32.000.510,C:\JustCode\ORMDelphi\Unit1.pas=C:\JustCode\ORMDelphi\uCFG.pas</Transaction>
19+
<Transaction>2015/09/07 21:16:56.186,=C:\JustCode\ORMDelphi\Unit1.pas</Transaction>
20+
<Transaction>2015/09/07 21:17:08.122,C:\JustCode\ORMDelphi\uClientes.pas=C:\JustCode\ORMDelphi\Unit1.pas</Transaction>
1621
</Transactions>
1722
</BorlandProject>

Orm.identcache

93 Bytes
Binary file not shown.

__history/Main.dfm.~3~

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
object fmMain: TfmMain
2+
Left = 0
3+
Top = 0
4+
Caption = 'Main'
5+
ClientHeight = 387
6+
ClientWidth = 774
7+
Color = clBtnFace
8+
Font.Charset = DEFAULT_CHARSET
9+
Font.Color = clWindowText
10+
Font.Height = -11
11+
Font.Name = 'Tahoma'
12+
Font.Style = []
13+
OldCreateOrder = False
14+
PixelsPerInch = 96
15+
TextHeight = 13
16+
object Label1: TLabel
17+
Left = 8
18+
Top = 27
19+
Width = 27
20+
Height = 13
21+
Caption = 'Nome'
22+
end
23+
object Label2: TLabel
24+
Left = 8
25+
Top = 51
26+
Width = 19
27+
Height = 13
28+
Caption = 'CPF'
29+
end
30+
object Label3: TLabel
31+
Left = 8
32+
Top = 81
33+
Width = 45
34+
Height = 13
35+
Caption = 'Endere'#231'o'
36+
end
37+
object Label4: TLabel
38+
Left = 8
39+
Top = 108
40+
Width = 19
41+
Height = 13
42+
Caption = 'Cep'
43+
end
44+
object Label5: TLabel
45+
Left = 315
46+
Top = 103
47+
Width = 11
48+
Height = 13
49+
Caption = 'ID'
50+
end
51+
object edtNome: TEdit
52+
Left = 59
53+
Top = 24
54+
Width = 121
55+
Height = 21
56+
TabOrder = 0
57+
end
58+
object edtCpf: TEdit
59+
Left = 59
60+
Top = 51
61+
Width = 110
62+
Height = 21
63+
TabOrder = 1
64+
end
65+
object edtEndereco: TEdit
66+
Left = 59
67+
Top = 78
68+
Width = 121
69+
Height = 21
70+
TabOrder = 2
71+
end
72+
object edtCEP: TEdit
73+
Left = 59
74+
Top = 105
75+
Width = 121
76+
Height = 21
77+
TabOrder = 3
78+
end
79+
object Button1: TButton
80+
Left = 59
81+
Top = 132
82+
Width = 75
83+
Height = 25
84+
Caption = 'Inserir'
85+
TabOrder = 4
86+
OnClick = Button1Click
87+
end
88+
object Button2: TButton
89+
Left = 398
90+
Top = 127
91+
Width = 75
92+
Height = 25
93+
Caption = 'Load'
94+
TabOrder = 5
95+
end
96+
object edtID: TEdit
97+
Left = 352
98+
Top = 100
99+
Width = 121
100+
Height = 21
101+
TabOrder = 6
102+
end
103+
object Update: TButton
104+
Left = 140
105+
Top = 132
106+
Width = 75
107+
Height = 25
108+
Caption = 'Update'
109+
TabOrder = 7
110+
end
111+
end

0 commit comments

Comments
 (0)