104 lines
3.2 KiB
ObjectPascal
104 lines
3.2 KiB
ObjectPascal
unit EtcMachInfo;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
||
wItem,
|
||
FireDAC.Stan.Intf,
|
||
FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf,
|
||
FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys,
|
||
FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt,
|
||
FireDAC.Phys.PGDef, FireDAC.VCLUI.Wait, FireDAC.Comp.UI, FireDAC.Phys.PG,
|
||
Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client;
|
||
|
||
type
|
||
TEtcMachInfo = class(TwItem)
|
||
private
|
||
{ Private declarations }
|
||
FKind: string;
|
||
FHostIP: string;
|
||
FPort: string;
|
||
FHostName: string;
|
||
FPassword: string;
|
||
FID: string;
|
||
FServerIP: string;
|
||
protected
|
||
{ Protected declarations }
|
||
public
|
||
{ Public declarations }
|
||
class function xGetObjsCctvList(AQuery: TFDQuery; kind:string): TList;
|
||
class function xAddSqlMark(velStr: string): string;
|
||
class function LoadFromQuery(AQuery: TFDQuery): TList;
|
||
published
|
||
{ Published declarations }
|
||
property Kind: string read FKind write FKind;
|
||
property HostIP: string read FHostIP write FHostIP;
|
||
property Port: string read FPort write FPort;
|
||
property HostName: string read FHostName write FHostName;
|
||
property Password: string read FPassword write FPassword;
|
||
property ID: string read FID write FID;
|
||
property ServerIP: string read FServerIP write FServerIP;
|
||
end;
|
||
|
||
implementation
|
||
|
||
{ TEtcMachInfo }
|
||
|
||
class function TEtcMachInfo.LoadFromQuery(AQuery: TFDQuery): TList;
|
||
var
|
||
curEtc: TEtcMachInfo;
|
||
begin
|
||
Result := TList.Create;
|
||
while not AQuery.Eof do begin
|
||
curEtc := TEtcMachInfo.Create(nil);
|
||
curEtc.OBID := AQuery.FieldByName('OBID').AsString;
|
||
curEtc.Name := AQuery.FieldByName('Name').AsString;
|
||
curEtc.wClassName := AQuery.FieldByName('wClassName').AsString;
|
||
curEtc.CreateDate := AQuery.FieldByName('CreateDate').AsString;
|
||
curEtc.CreateTime := FormatDateTime('hh:nn:ss', AQuery.FieldByName('CreateTime').AsDateTime);
|
||
curEtc.CreatorID := AQuery.FieldByName('CreatorID').AsString;
|
||
curEtc.IsValid := AQuery.FieldByName('IsValid').AsString;
|
||
curEtc.LcStatus := AQuery.FieldByName('LcStatus').AsString;
|
||
|
||
curEtc.Kind := AQuery.FieldByName('Kind').AsString;
|
||
curEtc.HostIP := AQuery.FieldByName('HostIP').AsString;
|
||
curEtc.Port := AQuery.FieldByName('Port').AsString;
|
||
curEtc.HostName := AQuery.FieldByName('HostName').AsString;
|
||
curEtc.Password := AQuery.FieldByName('Password').AsString;
|
||
curEtc.ID := AQuery.FieldByName('ID').AsString;
|
||
curEtc.ServerIP := AQuery.FieldByName('ServerIP').AsString;
|
||
Result.Add(curEtc);
|
||
|
||
AQuery.Next;
|
||
end;
|
||
end;
|
||
|
||
class function TEtcMachInfo.xAddSqlMark(velStr: string): string;
|
||
begin
|
||
Result := '';
|
||
Result := '''' + velStr + '''';
|
||
end;
|
||
|
||
class function TEtcMachInfo.xGetObjsCctvList(AQuery: TFDQuery; kind:string): TList;
|
||
var
|
||
sql: string;
|
||
begin
|
||
Result := nil;
|
||
sql := 'SELECT * FROM "EtcMachInfo"';
|
||
sql := sql + ' WHERE "IsValid"=' + xAddSqlMark('t');
|
||
if Length(Trim(kind)) > 0 then sql := sql + ' AND "Kind"=' + xAddSqlMark(kind);
|
||
|
||
try
|
||
AQuery.Close;
|
||
AQuery.SQL.Text := sql;
|
||
AQuery.Open;
|
||
except
|
||
on E: Exception do ShowMessage('xGetEtcMachInfo <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>: ' + E.Message);
|
||
end;
|
||
Result := LoadFromQuery(AQuery);
|
||
end;
|
||
|
||
end.
|
||
|