-
Notifications
You must be signed in to change notification settings - Fork 0
/
Modelo.Cliente.pas
145 lines (112 loc) · 2.98 KB
/
Modelo.Cliente.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
unit Modelo.Cliente;
interface
uses
System.Generics.Collections;
type
TCliente = class;
TClientes = class
private
{ Private declarations }
FClientes: TList<TCliente>;
function GetItens: TList<TCliente>;
public
{ Public declarations }
constructor Create;
destructor Destroy; override;
property Itens: TList<TCliente> read GetItens;
end;
TCliente = class
private
{ Private declarations }
FCodigo: string;
FNome: string;
FTelefone: string;
function GetCodigo: string;
function GetNome: string;
function GetTelefone: string;
procedure SetCodigo(const Value: string);
procedure SetNome(const Value: string);
procedure SetTelefone(const Value: string);
function GetBindText1: string;
function GetBindText2: string;
function GetBindText3: string;
public
{ Public declarations }
constructor Create(Codigo, Nome, Telefone: string);
destructor Destroy; override;
property Codigo: string read GetCodigo write SetCodigo;
property Nome: string read GetNome write SetNome;
property Telefone: string read GetTelefone write SetTelefone;
property BindText1: string read GetBindText1;
property BindText2: string read GetBindText2;
property BindText3: string read GetBindText3;
end;
implementation
uses
System.MaskUtils;
{ ********************************* TClientes ******************************** }
constructor TClientes.Create;
begin
Self.FClientes := TList<TCliente>.Create;
end;
destructor TClientes.Destroy;
begin
Self.FClientes.Free;
inherited;
end;
function TClientes.GetItens: TList<TCliente>;
begin
Result := Self.FClientes;
end;
{ ********************************* TCliente ********************************* }
constructor TCliente.Create(Codigo, Nome, Telefone: string);
begin
inherited Create;
Self.Codigo := Codigo;
Self.Nome := Nome;
Self.Telefone := Telefone;
end;
destructor TCliente.Destroy;
begin
inherited;
end;
function TCliente.GetBindText1: string;
begin
Result := 'Código: ' + Self.Codigo;
end;
function TCliente.GetBindText2: string;
begin
Result := 'Nome: ' + Self.Nome;
end;
function TCliente.GetBindText3: string;
begin
Result := 'Telefone: ' + FormatMaskText('\(00\) 00000-0000;0;', Self.Telefone);
end;
function TCliente.GetCodigo: string;
begin
Result := Self.FCodigo;
end;
function TCliente.GetNome: string;
begin
Result := Self.FNome;
end;
function TCliente.GetTelefone: string;
begin
Result := Self.FTelefone;
end;
procedure TCliente.SetCodigo(const Value: string);
begin
if (Self.FCodigo <> Value) then
Self.FCodigo := Value;
end;
procedure TCliente.SetNome(const Value: string);
begin
if (Self.FNome <> Value) then
Self.FNome := Value;
end;
procedure TCliente.SetTelefone(const Value: string);
begin
if (Self.FTelefone <> Value) then
Self.FTelefone := Value;
end;
end.