/[projects]/dao/DelphiScanner/Components/tpsystools_4.04/source/StDb2DBC.pas
ViewVC logotype

Contents of /dao/DelphiScanner/Components/tpsystools_4.04/source/StDb2DBC.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2671 - (show annotations) (download)
Tue Aug 25 18:15:15 2015 UTC (8 years, 9 months ago) by torben
File size: 10414 byte(s)
Added tpsystools component
1 (* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is TurboPower SysTools
15 *
16 * The Initial Developer of the Original Code is
17 * TurboPower Software
18 *
19 * Portions created by the Initial Developer are Copyright (C) 1996-2002
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 *
24 * ***** END LICENSE BLOCK ***** *)
25
26 {*********************************************************}
27 {* SysTools: StDb2DBC.pas 4.04 *}
28 {*********************************************************}
29 {* SysTools: Data-aware Two-Dimensional Barcodes *}
30 {*********************************************************}
31
32 {$I StDefine.inc}
33
34 unit StDb2DBC;
35
36 interface
37
38 uses
39 Windows,
40 Messages,
41 SysUtils,
42 Classes,
43 St2DBarC,
44 Db,
45 DbCtrls;
46
47 type
48
49 TStDbPDF417Barcode = class(TStPDF417Barcode)
50 protected {private}
51 {.Z+}
52 FCaptionDataLink : TFieldDataLink;
53 FCodeDataLink : TFieldDataLink;
54
55 procedure CaptionDataChange(Sender : TObject);
56 procedure CodeDataChange(Sender : TObject);
57 function GetCaptionDataField : string;
58 function GetCodeDataField : string;
59 function GetDataSource : TDataSource;
60 procedure SetCaptionDataField(const Value : string);
61 procedure SetCodeDataField(const Value : string);
62 procedure SetDataSource(Value : TDataSource);
63
64 public
65 constructor Create(AOwner : TComponent); override;
66 destructor Destroy;
67 override;
68 {.Z+}
69 published
70 property Code stored False;
71 property Caption stored False;
72
73 property CaptionDataField : string
74 read GetCaptionDataField write SetCaptionDataField;
75 property CodeDataField : string
76 read GetCodeDataField write SetCodeDataField;
77
78 property DataSource : TDataSource read GetDataSource write SetDataSource;
79 end;
80
81 TStDbMaxiCodeBarcode = class(TStMaxiCodeBarcode)
82 protected {private}
83 {.Z+}
84 FCaptionDataLink : TFieldDataLink;
85 FCodeDataLink : TFieldDataLink;
86 FCountryCodeDataLink : TFieldDataLink;
87 FPostalCodeDataLink : TFieldDataLink;
88 FServiceClassDataLink : TFieldDataLink;
89
90 procedure CaptionDataChange (Sender : TObject);
91 procedure CodeDataChange (Sender : TObject);
92 procedure CountryCodeChange (Sender : TObject);
93
94 function GetCaptionDataField : string;
95 function GetCodeDataField : string;
96 function GetCountryCodeDataField : string;
97 function GetDataSource : TDataSource;
98 function GetPostalCodeDataField : string;
99 function GetServiceClassDataField : string;
100
101 procedure PostalCodeChange (Sender : TObject);
102 procedure ServiceClassChange (Sender : TObject);
103
104 procedure SetCaptionDataField (const Value : string);
105 procedure SetCodeDataField (const Value : string);
106 procedure SetCountryCodeDataField (const Value : string);
107 procedure SetDataSource (Value : TDataSource);
108 procedure SetPostalCodeDataField (const Value : string);
109 procedure SetServiceClassDataField (const Value : string);
110
111 public
112 constructor Create(AOwner : TComponent); override;
113 destructor Destroy;
114 override;
115 {.Z+}
116 published
117 property Code stored False;
118 property Caption stored False;
119
120 property CaptionDataField : string
121 read GetCaptionDataField write SetCaptionDataField;
122 property CarrierCountryCodeDataField : string
123 read GetCountryCodeDataField write SetCountryCodeDataField;
124 property CarrierPostalCodeDataField : string
125 read GetPostalCodeDataField write SetPostalCodeDataField;
126 property CarrierServiceClassDataField : string
127 read GetServiceClassDataField write SetServiceClassDataField;
128 property CodeDataField : string
129 read GetCodeDataField write SetCodeDataField;
130
131 property DataSource : TDataSource read GetDataSource write SetDataSource;
132 end;
133
134 implementation
135
136 { TStDbPDF417Barcode }
137
138 constructor TStDbPDF417Barcode.Create(AOwner : TComponent);
139 begin
140 inherited Create(AOwner);
141
142 FCaptionDataLink := TFieldDataLink.Create;
143 FCaptionDataLink.OnDataChange := CaptionDataChange;
144 FCodeDataLink := TFieldDataLink.Create;
145 FCodeDataLink.OnDataChange := CodeDataChange;
146 end;
147
148 destructor TStDbPDF417Barcode.Destroy;
149 begin
150 FCaptionDataLink.OnDataChange := nil;
151 FCaptionDataLink.Free;
152 FCaptionDataLink := nil;
153 FCodeDataLink.OnDataChange := nil;
154 FCodeDataLink.Free;
155 FCodeDataLink := nil;
156
157 inherited Destroy;
158 end;
159
160 procedure TStDbPDF417Barcode.CaptionDataChange(Sender : TObject);
161 begin
162 if FCaptionDataLink.Field = nil then
163 Caption := '12345678922'
164 else
165 Caption := FCaptionDataLink.Field.DisplayText;
166 end;
167
168 procedure TStDbPDF417Barcode.CodeDataChange(Sender : TObject);
169 begin
170 if FCodeDataLink.Field = nil then
171 Code := '12345678922'
172 else
173 Code := FCodeDataLink.Field.DisplayText;
174 end;
175
176
177 function TStDbPDF417Barcode.GetCaptionDataField : string;
178 begin
179 Result := FCaptionDataLink.FieldName;
180 end;
181
182 function TStDbPDF417Barcode.GetCodeDataField : string;
183 begin
184 Result := FCodeDataLink.FieldName;
185 end;
186
187 function TStDbPDF417Barcode.GetDataSource : TDataSource;
188 begin
189 Result := FCaptionDataLink.DataSource
190 end;
191
192 procedure TStDbPDF417Barcode.SetCaptionDataField(const Value : string);
193 begin
194 FCaptionDataLink.FieldName := Value;
195 end;
196
197 procedure TStDbPDF417Barcode.SetCodeDataField(const Value : string);
198 begin
199 FCodeDataLink.FieldName := Value;
200 end;
201
202 procedure TStDbPDF417Barcode.SetDataSource(Value : TDataSource);
203 begin
204 FCaptionDataLink.DataSource := Value;
205 FCodeDataLink.DataSource := Value;
206 end;
207
208 { TStDbMaxiCodeBarcode }
209
210 constructor TStDbMaxiCodeBarcode.Create(AOwner : TComponent);
211 begin
212 inherited Create(AOwner);
213
214 FCaptionDataLink := TFieldDataLink.Create;
215 FCaptionDataLink.OnDataChange := CaptionDataChange;
216 FCodeDataLink := TFieldDataLink.Create;
217 FCodeDataLink.OnDataChange := CodeDataChange;
218 FCountryCodeDataLink := TFieldDataLink.Create;
219 FCountryCodeDataLink.OnDataChange := CountryCodeChange;
220 FPostalCodeDataLink := TFieldDataLink.Create;
221 FPostalCodeDataLink.OnDataChange := PostalCodeChange;
222 FServiceClassDataLink := TFieldDataLink.Create;
223 FServiceClassDataLink.OnDataChange := ServiceClassChange;
224 end;
225
226 destructor TStDbMaxiCodeBarcode.Destroy;
227 begin
228 FCaptionDataLink.OnDataChange := nil;
229 FCaptionDataLink.Free;
230 FCaptionDataLink := nil;
231 FCodeDataLink.OnDataChange := nil;
232 FCodeDataLink.Free;
233 FCodeDataLink := nil;
234 FCountryCodeDataLink.OnDataChange := nil;
235 FCountryCodeDataLink.Free;
236 FCountryCodeDataLink := nil;
237 FPostalCodeDataLink.OnDataChange := nil;
238 FPostalCodeDataLink.Free;
239 FPostalCodeDataLink := nil;
240 FServiceClassDataLink.OnDataChange := nil;
241 FServiceClassDataLink.Free;
242 FServiceClassDataLink := nil;
243
244 inherited Destroy;
245 end;
246
247 procedure TStDbMaxiCodeBarcode.CaptionDataChange(Sender : TObject);
248 begin
249 if FCaptionDataLink.Field = nil then
250 Caption := '12345678922'
251 else
252 Caption := FCaptionDataLink.Field.DisplayText;
253 end;
254
255 procedure TStDbMaxiCodeBarcode.CodeDataChange(Sender : TObject);
256 begin
257 if FCodeDataLink.Field = nil then
258 Code := '12345678922'
259 else
260 Code := FCodeDataLink.Field.DisplayText;
261 end;
262
263 procedure TStDbMaxiCodeBarcode.CountryCodeChange (Sender : TObject);
264 begin
265 if FCountryCodeDataLink.Field = nil then
266 CarrierCountryCode := 0
267 else
268 CarrierCountryCode := FCountryCodeDataLink.Field.AsInteger;
269 end;
270
271 function TStDbMaxiCodeBarcode.GetCaptionDataField : string;
272 begin
273 Result := FCaptionDataLink.FieldName;
274 end;
275
276 function TStDbMaxiCodeBarcode.GetCodeDataField : string;
277 begin
278 Result := FCodeDataLink.FieldName;
279 end;
280
281 function TStDbMaxiCodeBarcode.GetCountryCodeDataField : string;
282 begin
283 Result := FCountryCodeDataLink.FieldName;
284 end;
285
286 function TStDbMaxiCodeBarcode.GetDataSource : TDataSource;
287 begin
288 Result := FCaptionDataLink.DataSource
289 end;
290
291 function TStDbMaxiCodeBarcode.GetPostalCodeDataField : string;
292 begin
293 Result := FPostalCodeDataLink.FieldName;
294 end;
295
296 function TStDbMaxiCodeBarcode.GetServiceClassDataField : string;
297 begin
298 Result := FServiceClassDataLink.FieldName;
299 end;
300
301 procedure TStDbMaxiCodeBarcode.PostalCodeChange (Sender : TObject);
302 begin
303 if FPostalCodeDataLink.Field = nil then
304 CarrierPostalCode := '000'
305 else
306 CarrierPostalCode := FPostalCodeDataLink.Field.DisplayText;
307 end;
308
309 procedure TStDbMaxiCodeBarcode.ServiceClassChange (Sender : TObject);
310 begin
311 if FServiceClassDataLink.Field = nil then
312 CarrierServiceClass := 0
313 else
314 CarrierServiceClass := FServiceClassDataLink.Field.AsInteger;
315 end;
316
317 procedure TStDbMaxiCodeBarcode.SetCaptionDataField(const Value : string);
318 begin
319 FCaptionDataLink.FieldName := Value;
320 end;
321
322 procedure TStDbMaxiCodeBarcode.SetCodeDataField(const Value : string);
323 begin
324 FCodeDataLink.FieldName := Value;
325 end;
326
327 procedure TStDbMaxiCodeBarcode.SetCountryCodeDataField (const Value : string);
328 begin
329 FCountryCodeDataLink.FieldName := Value;
330 end;
331
332 procedure TStDbMaxiCodeBarcode.SetDataSource(Value : TDataSource);
333 begin
334 FCaptionDataLink.DataSource := Value;
335 FCodeDataLink.DataSource := Value;
336 FCountryCodeDataLink.DataSource := Value;
337 FPostalCodeDataLink.DataSource := Value;
338 FServiceClassDataLink.DataSource := Value;
339 end;
340
341 procedure TStDbMaxiCodeBarcode.SetPostalCodeDataField (const Value : string);
342 begin
343 FPostalCodeDataLink.FieldName := Value;
344 end;
345
346 procedure TStDbMaxiCodeBarcode.SetServiceClassDataField (const Value : string);
347 begin
348 FServiceClassDataLink.FieldName := Value;
349 end;
350
351 end.

  ViewVC Help
Powered by ViewVC 1.1.20