Universal Agent on demond SDK --UADataPacket(100分)

  • 主题发起人 主题发起人 vinson_zeng
  • 开始时间 开始时间
V

vinson_zeng

Unregistered / Unconfirmed
GUEST, unregistred user!
{******************************************************************************************}
{ }
{ Universal Agent on demond SDK }
{ }
{ }
{ COPYRIGHT }
{ ========= }
{ The UA SDK (software) is Copyright (C) 2001-2003, by vinson zeng(曾胡龙). }
{ All rights reserved. }
{ The authors - vinson zeng (曾胡龙), }
{ exclusively own all copyrights to the Advanced Application }
{ Controls (AppControls) and all other products distributed by Utilmind Solutions(R). }
{ }
{ LIABILITY DISCLAIMER }
{ ==================== }
{ THIS SOFTWARE IS DISTRIBUTED "AS IS" AND WITHOUT WARRANTIES AS TO PERFORMANCE }
{ OF MERCHANTABILITY OR ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED. }
{ YOU USE IT AT YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS, }
{ DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR MISUSING THIS SOFTWARE.}
{ }
{ RESTRICTIONS }
{ ============ }
{ You may not attempt to reverse compile, modify, }
{ translate or disassemble the software in whole or in part. }
{ You may not remove or modify any copyright notice or the method by which }
{ it may be invoked. }
{******************************************************************************************}

unit UADataPacket;
interface
uses
Windows, Variants, ActiveX, Classes, SysUtils,UAUnits,
Contnrs,DB;
type
//-----------------------------------------------------------------
TUAParam = class(TPersistent)
private
FMachineID:string;
FIP:string;
FTag:LongWord;
FVersion:string;
FSessionID:string;
protected
function GetUaData: OleVariant;virtual;
procedure SetUaData(const Value: OleVariant);virtual;
public
constructor Create;
virtual;
destructor Destroy;
override;
property UAData:OleVariant read GetUaData write SetUaData;
end;

TClassUAParam = class of TUAParam;
TUAParams = class(TObjectList)
protected
function GetUaData: OleVariant;virtual;
procedure SetUaData(const Value: OleVariant);virtual;
public
property UAData:OleVariant read GetUaData write SetUaData;
end;

TUAParamsList = class(TObjectList)
protected
function GetUaData: OleVariant;virtual;
procedure SetUaData(const Value: OleVariant);virtual;
public
destructor Destroy;
override;
function AddItem( index: integer;
AObject: TObject ):Integer;
virtual;
function GetItem( index, itemid: integer ): TObject;virtual;
function CountParamsItem(const Index :Integer = -1 ):Integer;virtual;
property UAData:OleVariant read GetUaData write SetUaData;
end;

//--------------%% end of %%------------------------------------------------
TMasterLinkParam = class(TUAParam) // support multi primary key and forei key relationship or asso
private
FMasterAliasTableName:string;
FMasterField:string;
FDataType:TFieldType;
FMasterFieldValue:Variant;
procedure SetDataType(const Value: TFieldType);
procedure SetMasterAliasTableName(const Value: string);
procedure SetMasterField(const Value: string);
procedure SetMasterFieldValue(const Value: Variant);
function BuildMasterSqlScript: string;
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create;
override;
destructor Destroy;
override;
property UAData:OleVariant read GetUaData write SetUaData;
property MasterAliasTableName:string read FMasterAliasTableName write SetMasterAliasTableName;
property MasterField:string read FMasterField write SetMasterField;
property DataType:TFieldType read FDataType write SetDataType default ftString;
property MasterFieldValue:Variant read FMasterFieldValue write SetMasterFieldValue;
property MasterSqlScript:string read BuildMasterSqlScript;
end;

TDataRequestParam = class(TUAParam)
private
FAliasTableName:string;
FKeyFields: string;
FAllRecCount:integer;
FCurrRecCount:integer;
FRequestRecCount:integer;
FSqlParams:string;
function GetAliasTableName: string;
function GetAllRecCount: integer;
function GetCurrRecCount: integer;
procedure SetAliasTableName(const Value: string);
procedure SetAllRecCount(const Value: integer);
procedure SetCurrRecCount(const Value: integer);
function GetKeyFields: string;
procedure SetKeyFields(const Value: string);
function GetRequestRecCount: integer;
procedure SetRequestRecCount(const Value: integer);
function GetSqlParams: string;
procedure SetSqlParams(const Value: string);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create;
override;
destructor Destroy;
override;
property AliasTableName:string read GetAliasTableName write SetAliasTableName;
property KeyFields:string read GetKeyFields write SetKeyFields ;
property AllRecCount:integer read GetAllRecCount write SetAllRecCount;
property CurrRecCount:integer read GetCurrRecCount write SetCurrRecCount;
property RequestRecCount:integer read GetRequestRecCount write SetRequestRecCount;
property SqlParams:string read GetSqlParams write SetSqlParams;
property UAData:OleVariant read GetUaData write SetUaData;
end;

TDataReturnParam = class(TUAParam)
private
FAliasTableName:string;
FData:OleVariant;
//in equal null ;out equal array of variant
FAllRecCount:integer;
FCurrRecCount:integer;
FDataSheetValue:OleVariant;
FRowSheetValue:OleVariant;
function GetAliasTableName: string;
function GetAllRecCount: integer;
function GetCurrRecCount: integer;
function GetData: OleVariant;
procedure SetAliasTableName(const Value: string);
procedure SetAllRecCount(const Value: integer);
procedure SetCurrRecCount(const Value: integer);
procedure SetData(const Value: OleVariant);
function GetDataSheetValue: OleVariant;
function GetRowSheetValue: OleVariant;
procedure SetDataSheetValue(const Value: OleVariant);
procedure SetRowSheetValue(const Value: OleVariant);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create;
override;
destructor Destroy;
override;
property AliasTableName:string read GetAliasTableName write SetAliasTableName;
property Data:OleVariant read GetData write SetData;
property AllRecCount:integer read GetAllRecCount write SetAllRecCount;
property CurrRecCount:integer read GetCurrRecCount write SetCurrRecCount;
property DataSheetValue:OleVariant read GetDataSheetValue write SetDataSheetValue;
property RowSheetValue:OleVariant read GetRowSheetValue write SetRowSheetValue;
property UAData:OleVariant read GetUaData write SetUaData;
end;

TDeltaParam = class(TUAParam)
private
FAliasTableName:string;
FKeyFields:string;
FDelta:OleVariant;
procedure SetAliasTableName(const Value: string);
procedure SetDelta(const Value: OleVariant);
procedure SetKeyFields(const Value: string);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create;
override;
destructor Destroy;
override;
property AliasTableName:string read FAliasTableName write SetAliasTableName;
property KeyFields:string read FKeyFields write SetKeyFields;
property Delta:OleVariant read FDelta write SetDelta;
property UAData:OleVariant read GetUaData write SetUaData;

end;


TDataSheetParam = class(TUAParam)
private
FAliasTableName:string;
FFieldName: string;
FRelSymbol: string;
FFieldType: TFieldType;
FLastValue: Variant;
procedure SetAliasTableName(const Value: string);
procedure SetFieldName(const Value: string);
procedure SetFieldType(const Value: TFieldType);
procedure SetLastValue(const Value: Variant);
procedure SetRelSymbol(const Value: string);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
property AliasTableName:string read FAliasTableName write SetAliasTableName ;
property FieldName:string read FFieldName write SetFieldName;
property RelSymbol:string read FRelSymbol write SetRelSymbol;
property FieldType:TFieldType read FFieldType write SetFieldType;
property LastValue:Variant read FLastValue write SetLastValue;
property UAData:OleVariant read GetUaData write SetUaData;
end;

TRowSheetParam = class(TUAParam)
private
FAliasTableName:string;
FFieldName: string;
FFieldType: TFieldType;
FCurrValue: OleVariant;
procedure SetAliasTableName(const Value: string);
procedure SetCurrValue(const Value: OleVariant);
procedure SetFieldName(const Value: string);
procedure SetFieldType(const Value: TFieldType);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
property AliasTableName:string read FAliasTableName write SetAliasTableName ;
property FieldName:string read FFieldName write SetFieldName;
property FieldType:TFieldType read FFieldType write SetFieldType;
property CurrValue:OleVariant read FCurrValue write SetCurrValue;
property UAData:OleVariant read GetUaData write SetUaData;
end;

TAnyParam = class(TUAParam)
private
FAnyValue:Variant;
function GetAnyValue: Variant;
procedure SetAnyValue(const Value: Variant);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
property UAData:OleVariant read GetUaData write SetUaData;
property AnyValue:Variant read GetAnyValue write SetAnyValue;
end;


TErrorParam = class(TUAParam)
private
FErrorCode:integer;
FErrorMask:integer;
FErrorMsg:string;
FErrorContext:string;
procedure SetErrorCode(const Value: integer);
procedure SetErrorContext(const Value: string);
procedure SetErrorMsg(const Value: string);
procedure SetErrorMask(const Value: integer);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
property UAData:OleVariant read GetUaData write SetUaData;
property ErrorCode:integer read FErrorCode write SetErrorCode;
property ErrorContext:string read FErrorContext write SetErrorContext;
property ErrorMsg:string read FErrorMsg write SetErrorMsg;
property ErrorMask:integer read FErrorMask write SetErrorMask;
end;

//2004-4-9 add by vinson zeng
{ TAppSystemParam = class(TUAParam)
private
FIp:string;
FProxyIp:string;
FAppAccount:string;
FUserId:string;
FUserName:string;
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
property UAData:OleVariant read GetUaData write SetUaData;
property Ip:string read FIp write SetIp;
property ProxyIp:string read FProxyIp write SetProxyIp;
property UserId :string read FUserId write SetUserId;
property UserName:string read FUserName write SetUserName;
end;
//---------------%% end of %% -----------------------------
}
//-----------------------------------------------------------------------
TUARequestDataInPacket = class(TUAParam)
private
FRequestType:Integer;
FRowSheetList,FDataSheetList,
FMasterLinkList,FRequestDataList:TUAParams;
FAnyParam:TUAParamsList;
FDBConnTag:string;
FMustGetRecCount:integer;
procedure SetRequestType(const Value: Integer);
procedure SetDBConnTag(const Value: string);
procedure SetMustGetRecCount(const Value: integer);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create;
override;
destructor Destroy;
override;
procedure AddItemRowSheet(aRowSheetParam:TRowSheetParam);
function GetItemRowSheet(index:Integer):TRowSheetParam;
function CountRowSheet(index: integer = -1):integer;
procedure AddItemDataSheet(aDataSheetParam:TDataSheetParam);
function GetItemDataSheet(index:Integer):TDataSheetParam;
function CountDataSheet(index: integer = -1):integer;
procedure AddItemMasterLink(aMasterLink:TMasterLinkParam);
function GetItemMasterLink(index:Integer):TMasterLinkParam;
function CountMasterLink(index: integer = -1):integer;
procedure AddItemRequestData(aRequestData:TDataRequestParam);
function GetItemRequestData(index:Integer):TDataRequestParam;
function CountRequestData(index: integer = -1):integer;
procedure AddItemAnyParam( index: integer;
aAnyParam: TAnyParam );
function GetItemAnyParam( index, itemid: integer ): TAnyParam;
function CountAnyParam( index: integer = -1 ): integer;
procedure ClearAllUaData;
property UAData:OleVariant read GetUaData write SetUaData;
property RequestType:Integer read FRequestType write SetRequestType;
property DBConnTag:string read FDBConnTag write SetDBConnTag;
property MustGetRecCount:integer read FMustGetRecCount write SetMustGetRecCount;
end;

TUARequestDataOutPacket = class(TUAParam)
private
FRowSheetList,FDataSheetList,
FReturnDataList,FErrorList:TUAParams;
FResultCode:integer;
FAnyValue:TUAParamsList;
function GetResultCode: integer;
procedure SetResultCode(const Value: integer);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create;
override;
destructor Destroy;
override;
procedure AddItemRowSheet(aRowSheetParam:TRowSheetParam);
function GetItemRowSheet(index:Integer):TRowSheetParam;
function CountRowSheet(index: integer = -1):integer;
procedure AddItemDataSheet(aDataSheetParam:TDataSheetParam);
function GetItemDataSheet(index:Integer):TDataSheetParam;
function CountDataSheet(index: integer = -1):integer;
procedure AddItemReturnData(aReturnData:TDataReturnParam);
function GetItemReturnData(index:Integer):TDataReturnParam;
function CountReturnData(index: integer = -1):integer;
procedure AddItemErrorParam(aErrorParam:TErrorParam);
function GetItemErrorParam(index:Integer):TErrorParam;
function CountErrorParam(index: integer = -1):integer;
procedure AddItemAnyValue( index: integer;
aAnyValue: TAnyParam );
function GetItemAnyValue( index, itemid: integer ): TAnyParam;
function CountAnyValue( index: integer = -1 ): integer;
procedure ClearAllUaData;
property UAData:OleVariant read GetUaData write SetUaData;
property ResultCode:integer read GetResultCode write SetResultCode;
end;

TUAUpdateDataInPacket = class(TUAParam)
private
FUpdateIndex:Integer;
FDeltaList:TUAParams;
FAnyParam:TUAParamsList;
FDBConnTag:string;
procedure SetUpdateIndex(const Value: Integer);
procedure SetDBConnTag(const Value: string);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create;
override;
destructor Destroy;
override;
procedure AddItemDelta(aDelta:TDeltaParam);
function GetItemDelta(index:Integer):TDeltaParam;
function CountItemDelta(index: integer = -1):integer;
procedure AddItemAnyParam( index: integer;
aAnyParam: TAnyParam );
function GetItemAnyParam( index, itemid: integer ): TAnyParam;
function CountAnyParam( index: integer = -1 ): integer;
procedure ClearAllUaData;
property UAData:OleVariant read GetUaData write SetUaData;
property UpdateIndex:Integer read FUpdateIndex write SetUpdateIndex;
property DBConnTag:string read FDBConnTag write SetDBConnTag;
end;

TUAUpdateDataOutPacket = class(TUAParam)
private
FResultCode:Integer;
FErrorList:TUAParams;
FAnyValue:TUAParamsList;
function GetResultCode: Integer;
procedure SetResultCode(const Value: Integer);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create;
override;
destructor Destroy;
override;
procedure ClearAllUaData;
procedure AddItemErrorParam(aErrorParam:TErrorParam);
function GetItemErrorParam(index:Integer):TErrorParam;
function CountErrorParam(index: integer = -1):integer;
procedure AddItemAnyValue( index: integer;
aAnyValue: TAnyParam );
function GetItemAnyValue( index, itemid: integer ): TAnyParam;
function CountAnyValue( index: integer = -1 ): integer;
property UAData:OleVariant read GetUaData write SetUaData;
property ResultCode:Integer read GetResultCode write SetResultCode;
end;
//=======================================================================
TUAExecuteDataInPacket = class(TUAParam)
private
FAnyParam:TUAParamsList;
FDBConnTag:string;
procedure SetDBConnTag(const Value: string);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create;
override;
destructor Destroy;
override;
procedure AddItemAnyParam( index: integer;
aAnyParam: TAnyParam );
function GetItemAnyParam( index, itemid: integer ): TAnyParam;
function CountAnyParam( index: integer = -1 ): integer;
procedure ClearAllUaData;
property UAData:OleVariant read GetUaData write SetUaData;
property DBConnTag:string read FDBConnTag write SetDBConnTag;
end;

TUAExecuteDataOutPacket = class(TUAParam)
private
FResultCode:Integer;
FErrorList:TUAParams;
FAnyValue:TUAParamsList;
function GetResultCode: Integer;
procedure SetResultCode(const Value: Integer);
protected
function GetUaData: OleVariant;override;
procedure SetUaData(const Value: OleVariant);override;
public
constructor Create;
override;
destructor Destroy;
override;
procedure AddItemAnyValue( index: integer;
aAnyValue: TAnyParam );
function GetItemAnyValue( index, itemid: integer ): TAnyParam;
function CountAnyValue( index: integer = -1 ): integer;
procedure ClearAllUaData;
procedure AddItemErrorParam(aErrorParam:TErrorParam);
function GetItemErrorParam(index:Integer):TErrorParam;
function CountErrorParam(index: integer = -1):integer;
property UAData:OleVariant read GetUaData write SetUaData;
property ResultCode:Integer read GetResultCode write SetResultCode;
end;


function GetUAClassName(const UAData: OleVariant): string;
function AnyValueToStr(lDataType: TFieldType;aValue: Variant ): string;
implementation


function AnyValueToStr(lDataType: TFieldType;aValue: Variant ): string;
begin

case lDataType of
ftString, ftFixedChar, ftWideString:
Result := ''''+VarToStr(aValue)+'''';
ftSmallint, ftInteger, ftWord, ftLargeint, ftAutoInc, ftCurrency:
Result := VarToStr(aValue);
ftBoolean:
if aValue=true then
Result:='1'
else
Result :='0';
ftFloat:
Result := VarToStr(aValue);
ftDate, ftTime, ftDateTime:
Result := ''''+DatetimeToStr(VarToDateTime(aValue))+'''';
ftBCD:
Result := VarToStr(aValue);
ftTimeStamp:
Result := VarToStr(aValue);
ftBytes, ftVarBytes:
Result := ''''+VarToStr(aValue)+'''';
ftUnknown, ftBlob, ftMemo, ftGraphic,
ftFmtMemo, ftParadoxOle, ftDBaseOle,
ftTypedBinary, ftCursor, ftADT, ftArray, ftReference,
ftDataSet, ftOraBlob, ftOraClob, ftVariant, ftInterface,
ftIDispatch, ftGuid, ftFMTBcd:
Result := '""'
else
Result := '""';
end;

end;


{ TUACustomDataPacket }
function GetUAClassName(const UAData: OleVariant): string;
var
aUAData: OleVariant;
begin

Result := '';
if not VarIsArray(UAData) then
Exit;
aUAData := UAData;
while VarIsArray(aUAData[0])do
aUAData:=aUAData[0];
Result := aUAData[0];
end;


{ TUAParam }
constructor TUAParam.Create;
begin
FSessionID := RandomHex;
FIP := LocalIP;
FTag := GenerateGUID32;
FVersion := 'ver 1.03A';
FMachineID := GetComputerName + '#'+GetUserName;
end;

destructor TUAParam.Destroy;
begin

inherited;
end;

function TUAParam.GetUaData: OleVariant;
begin
Result := VarArrayCreate([0,5], varVariant);
Result[0] := ClassName;
Result[1] := FTag;
Result[2] := FVersion;
Result[3] := FMachineID;
Result[4] := FIP;
Result[5] := FSessionID;
end;

procedure TUAParam.SetUaData(const Value: OleVariant);
begin
if VarIsArray(Value) then
begin
FTag := Value[1];
FVersion := Value[2];
FMachineID := Value[3];
FIP := Value[4];
FSessionID := Value[5];
end;
end;

{ TDataRequestParam }
constructor TDataRequestParam.Create;
begin
inherited;
end;

destructor TDataRequestParam.Destroy;
begin

inherited;
end;

function TDataRequestParam.GetAliasTableName: string;
begin
Result := FAliasTableName;
end;

function TDataRequestParam.GetAllRecCount: integer;
begin
Result := FAllRecCount;
end;

function TDataRequestParam.GetCurrRecCount: integer;
begin
Result := FCurrRecCount;
end;


function TDataRequestParam.GetKeyFields: string;
begin
Result := FKeyFields;
end;

function TDataRequestParam.GetRequestRecCount: integer;
begin
Result := FRequestRecCount;
end;

function TDataRequestParam.GetUaData: OleVariant;
begin

Result := VarArrayCreate([0,6], varVariant);
Result[0] := inherited GetUaData;
Result[1] := FAliasTableName;
Result[2] := FKeyFields;
Result[3] := FAllRecCount;
Result[4] := FCurrRecCount;
Result[5] := FRequestRecCount;
Result[6] := FSqlParams;
end;

procedure TDataRequestParam.SetAliasTableName(const Value: string);
begin

if Trim(Value) <> '' then
FAliasTableName := Value ;
end;

procedure TDataRequestParam.SetAllRecCount(const Value: integer);
begin
FAllRecCount := Value;
end;

procedure TDataRequestParam.SetCurrRecCount(const Value: integer);
begin
FCurrRecCount := Value;
end;

procedure TDataRequestParam.SetKeyFields(const Value: string);
begin
if Trim(Value)<> '' then
FKeyFields := Value;
end;

procedure TDataRequestParam.SetRequestRecCount(const Value: integer);
begin
FRequestRecCount := Value;
end;

procedure TDataRequestParam.SetUaData(const Value: OleVariant);
begin

inherited SetUaData(Value[0]);
FAliasTableName := Value[1];
FKeyFields := Value[2];
FAllRecCount := Value[3];
FCurrRecCount:= Value[4];
FRequestRecCount := Value[5];
FSqlParams := Value[6];

end;

function TDataRequestParam.GetSqlParams: string;
begin
Result := FSqlParams;
end;

procedure TDataRequestParam.SetSqlParams(const Value: string);
begin
FSqlParams := Value;
end;

{ TUAParams }
function TUAParams.GetUaData: OleVariant;
var
i, iCount: integer;
aParam:TUAParam;
begin

if Count=0 then
begin
TVarData(result).VType := varEmpty;
Exit;
end;

iCount := Count;
Result := VarArrayCreate([0,iCount-1],varVariant);
for i:=0 to iCount-1do
begin
aParam := TUAParam(Items);
Result := aParam.UAData;
end;

end;

procedure TUAParams.SetUaData(const Value: OleVariant);
var
i: integer;
aParam:TUAParam;
aParamClass:TClassUAParam;
begin

if not VarIsArray(Value) then
Exit;
Clear;
for i:=0 to VarArrayHighBound(Value,1)do
begin
aParamClass := TClassUAParam(GetClass(GetUAClassName(Value[0])));
aParam := TUAParam(aParamClass.Create);
aParam.UAData := Value;
Add(aParam);
end;

end;


{ TUAParamsList }
function TUAParamsList.AddItem(index: integer;
AObject: TObject): Integer;
var
i: integer;
aParams:TUAParams;
begin

for i := Count to indexdo
begin
aParams := TUAParams.Create;
Add(aParams);
end;
aParams := TUAParams(Items[Index]);
Result := aParams.Add(AObject);
end;

function TUAParamsList.CountParamsItem(const Index:Integer = -1): Integer;
begin
Result := 0;
end;

destructor TUAParamsList.Destroy;
begin

inherited;
end;

function TUAParamsList.GetItem(index, itemid: integer): TObject;
var
aParams:TUAParams;
begin

Result := nil;
if index>=Count then
Exit;
aParams := TUAParams(Items[Index]);
if ItemID >=aParams.Count then
Exit;
Result := aParams.Items[ItemId];
end;

function TUAParamsList.GetUaData: OleVariant;
var
i, iCount: integer;
aParams:TUAParams;
begin

if Count=0 then
begin
TVarData(Result).VType := varEmpty;
Exit;
end;

iCount := Count;
Result := VarArrayCreate([0,iCount-1],varVariant);
for i:=0 to iCount-1do
begin
aParams := TUAParams(Items);
Result := aParams.UAData;
end;

end;

procedure TUAParamsList.SetUaData(const Value: OleVariant);
var
i: integer;
aParams:TUAParams;
begin

if not VarIsArray(Value) then
Exit;
Clear;
for i:=0 to VarArrayHighBound(Value,1)do
begin
aParams := TUAParams.Create;
aParams.UAData := Value;
Add(aParams);
end;

end;

{ TDeltaParam }
constructor TDeltaParam.Create;
begin
inherited;
end;

destructor TDeltaParam.Destroy;
begin

inherited;
end;

function TDeltaParam.GetUaData: OleVariant;
begin
Result := VarArrayCreate([0,3], varVariant);
Result[0] := inherited GetUaData;
Result[1] := FAliasTableName;
Result[2] := FKeyFields;
Result[3] := FDelta;
end;

procedure TDeltaParam.SetAliasTableName(const Value: string);
begin
FAliasTableName := Value;
end;

procedure TDeltaParam.SetDelta(const Value: OleVariant);
begin
FDelta := Value;
end;

procedure TDeltaParam.SetKeyFields(const Value: string);
begin
FKeyFields := Value;
end;

procedure TDeltaParam.SetUaData(const Value: OleVariant);
begin

inherited SetUaData(Value[0]);
FAliasTableName := Value[1];
FKeyFields := Value[2];
FDelta := Value[3];
end;

{ TUARequestDataInPacket }

procedure TUARequestDataInPacket.AddItemAnyParam(index: integer;
aAnyParam: TAnyParam);
begin
FAnyParam.AddItem(index, aAnyParam);
end;

procedure TUARequestDataInPacket.AddItemDataSheet(
aDataSheetParam: TDataSheetParam);
begin
FDataSheetList.Add(aDataSheetParam);
end;

procedure TUARequestDataInPacket.AddItemMasterLink(
aMasterLink: TMasterLinkParam);
begin
FMasterLinkList.Add(aMasterLink);
end;

procedure TUARequestDataInPacket.AddItemRequestData(
aRequestData: TDataRequestParam);
begin
FRequestDataList.Add(aRequestData);
end;

procedure TUARequestDataInPacket.AddItemRowSheet(
aRowSheetParam: TRowSheetParam);
begin
FRowSheetList.Add(aRowSheetParam);
end;

procedure TUARequestDataInPacket.ClearAllUaData;
begin

FRowSheetList.Clear;
FDataSheetList.Clear;
FMasterLinkList.Clear;
FRequestDataList.Clear;
FAnyParam.Clear;
end;

function TUARequestDataInPacket.CountAnyParam(index: integer): integer;
var
aList: TObjectList;
begin
if index=-1 then
result := FAnyParam.Count
else
if index>=FAnyParam.Count then
result := -1
else
begin
aList := TObjectList(FAnyParam[index]);
result := aList.Count;
end;

end;

function TUARequestDataInPacket.CountDataSheet(index: integer): integer;
//var
// aList: TObjectList;
begin
if index=-1 then
result := FDataSheetList.Count
else
result := -1
end;

function TUARequestDataInPacket.CountMasterLink(index: integer): integer;
//var
// aList: TObjectList;
begin
if index=-1 then
result := FMasterLinkList.Count
else
result := -1
end;

function TUARequestDataInPacket.CountRequestData(index: integer): integer;
//var
// aList: TObjectList;
begin
if index=-1 then
result := FRequestDataList.Count
else
result := -1
end;

function TUARequestDataInPacket.CountRowSheet(index: integer): integer;
//var
// aList: TObjectList;
begin
if index=-1 then
result := FRowSheetList.Count
else
result := -1
end;

constructor TUARequestDataInPacket.Create;
begin

inherited;
FRowSheetList := TUAParams.Create;
FDataSheetList:= TUAParams.Create;
FMasterLinkList := TUAParams.Create;
FRequestDataList := TUAParams.Create;
FAnyParam := TUAParamsList.Create;
FMustGetRecCount := 0;
end;

destructor TUARequestDataInPacket.Destroy;
begin

FRowSheetList.Free;
FDataSheetList.Free;
FMasterLinkList.Free;
FRequestDataList.Free;
FAnyParam.Free;
inherited;
end;

function TUARequestDataInPacket.GetItemAnyParam(index,
itemid: integer): TAnyParam;
begin
Result := TAnyParam( FAnyParam.GetItem(index,itemid) );
end;

function TUARequestDataInPacket.GetItemDataSheet(
index: Integer): TDataSheetParam;
begin
Result := TDataSheetParam(FDataSheetList.Items[index]);
end;

function TUARequestDataInPacket.GetItemMasterLink(
index: Integer): TMasterLinkParam;
begin
Result := TMasterLinkParam(FMasterLinkList.Items[index]);
end;

function TUARequestDataInPacket.GetItemRequestData(
index: Integer): TDataRequestParam;
begin
Result := TDataRequestParam(FRequestDataList.Items[index]);
end;

function TUARequestDataInPacket.GetItemRowSheet(
index: Integer): TRowSheetParam;
begin
Result := TRowSheetParam(FRowSheetList.Items[Index]);
end;

function TUARequestDataInPacket.GetUaData: OleVariant;
begin
Result := VarArrayCreate([0,8], varVariant);
Result[0] := inherited GetUaData;
Result[1] := FRequestType;
Result[2] := FRequestDataList.UAData;
Result[3] := FMasterLinkList.UAData;
Result[4] := FRowSheetList.UAData;
Result[5] := FDataSheetList.UAData;
Result[6] := FAnyParam.UAData;
Result[7] := FDBConnTag;
Result[8] := FMustGetRecCount;
end;

procedure TUARequestDataInPacket.SetDBConnTag(const Value: string);
begin
FDBConnTag := Value;
end;

procedure TUARequestDataInPacket.SetMustGetRecCount(const Value: integer);
begin
FMustGetRecCount := Value;
end;

procedure TUARequestDataInPacket.SetRequestType(const Value: Integer);
begin
FRequestType := Value;
end;

procedure TUARequestDataInPacket.SetUaData(const Value: OleVariant);
begin

inherited SetUaData(value[0]);
FRequestType := value[1];
FRequestDataList.UAData := value[2];
FMasterLinkList.UAData := value[3];
FRowSheetList.UAData := value[4];
FDataSheetList.UAData := value[5];
FAnyParam.UAData := value[6];
FDbConnTag := value[7];
FMustGetRecCount := value[8];
end;

{ TUARequestDataOutPacket }

procedure TUARequestDataOutPacket.AddItemAnyValue(index: integer;
aAnyValue: TAnyParam);
begin
FAnyValue.AddItem(index, aAnyValue);
end;

procedure TUARequestDataOutPacket.AddItemDataSheet(
aDataSheetParam: TDataSheetParam);
begin
FDataSheetList.Add(aDataSheetParam);
end;

procedure TUARequestDataOutPacket.AddItemErrorParam(
aErrorParam: TErrorParam);
begin
FErrorList.Add(aErrorParam);
end;

procedure TUARequestDataOutPacket.AddItemReturnData(
aReturnData: TDataReturnParam);
begin
FReturnDataList.Add(aReturnData);
end;

procedure TUARequestDataOutPacket.AddItemRowSheet(
aRowSheetParam: TRowSheetParam);
begin
FRowSheetList.Add(aRowSheetParam);
end;

procedure TUARequestDataOutPacket.ClearAllUaData;
begin
FRowSheetList.Clear;
FDataSheetList.Clear;
FReturnDataList.Clear;
FErrorList.Clear;
FAnyValue.Clear;
end;

function TUARequestDataOutPacket.CountAnyValue(index: integer): integer;
var
aList: TObjectList;
begin
if index=-1 then
result := FAnyValue.Count
else
if index>=FAnyValue.Count then
result := -1
else
begin
aList := TObjectList(FAnyValue[index]);
result := aList.Count;
end;

end;

function TUARequestDataOutPacket.CountDataSheet(index: integer): integer;
//var
// aList: TObjectList;
begin
if index=-1 then
result := FDataSheetList.Count
else
result := -1

end;

function TUARequestDataOutPacket.CountErrorParam(index: integer): integer;
//var
// aList: TObjectList;
begin

if index=-1 then
result := FErrorList.Count
else
result := -1
end;

function TUARequestDataOutPacket.CountReturnData(index: integer): integer;
//var
// aList: TObjectList;
begin
if index=-1 then
result := FReturnDataList.Count
else
result := -1
end;

function TUARequestDataOutPacket.CountRowSheet(index: integer): integer;
//var
// aList: TObjectList;
begin
if index=-1 then
result := FRowSheetList.Count
else
result := -1
end;

constructor TUARequestDataOutPacket.Create;
begin
inherited;
FRowSheetList := TUAParams.Create;
FDataSheetList:= TUAParams.Create;
FReturnDataList := TUAParams.Create;
FErrorList := TUAParams.Create;
FAnyValue := TUAParamsList.Create;
end;

destructor TUARequestDataOutPacket.Destroy;
begin

FRowSheetList.Free;
FDataSheetList.Free;
FReturnDataList.Free;
FErrorList.Free;
FAnyValue.Free;
inherited;
end;

function TUARequestDataOutPacket.GetItemAnyValue(index,
itemid: integer): TAnyParam;
begin
Result := TAnyParam( FAnyValue.GetItem(index,itemid) );
end;

function TUARequestDataOutPacket.GetItemDataSheet(
index: Integer): TDataSheetParam;
begin
Result := TDataSheetParam(FDataSheetList.Items[index]);
end;

function TUARequestDataOutPacket.GetItemErrorParam(
index: Integer): TErrorParam;
begin
Result := TErrorParam(FErrorList.Items[index]);
end;

function TUARequestDataOutPacket.GetItemReturnData(
index: Integer): TDataReturnParam;
begin
Result := TDataReturnParam(FReturnDataList.Items[index]);
end;

function TUARequestDataOutPacket.GetItemRowSheet(
index: Integer): TRowSheetParam;
begin
Result := TRowSheetParam(FRowSheetList.Items[index]);
end;

function TUARequestDataOutPacket.GetResultCode: integer;
begin
Result := FResultCode;
end;

function TUARequestDataOutPacket.GetUaData: OleVariant;
begin

Result := VarArrayCreate([0,6], varVariant);
Result[0] := inherited GetUaData;
Result[1] := FReturnDataList.UAData;
Result[2] := FDataSheetList.UAData;
Result[3] := FRowSheetList.UAData;
Result[4] := FErrorList.UAData;
Result[5] := ResultCode;
Result[6] := FAnyValue.UAData;

end;

procedure TUARequestDataOutPacket.SetResultCode(const Value: integer);
begin
FResultCode := Value;
end;

procedure TUARequestDataOutPacket.SetUaData(const Value: OleVariant);
begin

inherited SetUaData(value[0]);
FReturnDataList.UAData := value[1];
FDataSheetList.UAData := value[2];
FRowSheetList.UAData := value[3];
FErrorList.UAData := value[4];
ResultCode := value[5];
FAnyValue.UAData := value[6];

end;

{ TUAUpdateDataOutPacket }
procedure TUAUpdateDataOutPacket.AddItemAnyValue(index: integer;
aAnyValue: TAnyParam);
begin
FAnyValue.AddItem(index, aAnyValue);
end;

procedure TUAUpdateDataOutPacket.AddItemErrorParam(
aErrorParam: TErrorParam);
begin
FErrorList.Add(aErrorParam);
end;

procedure TUAUpdateDataOutPacket.ClearAllUaData;
begin
FErrorList.Clear;
FAnyValue.Clear;
end;

function TUAUpdateDataOutPacket.CountAnyValue(index: integer): integer;
var
aList: TObjectList;
begin
if index=-1 then
result := FAnyValue.Count
else
if index>=FAnyValue.Count then
result := -1
else
begin
aList := TObjectList(FAnyValue[index]);
result := aList.Count;
end;

end;

function TUAUpdateDataOutPacket.CountErrorParam(index: integer): integer;
//var
// aList: TObjectList;
begin

if index=-1 then
result := FErrorList.Count
else
result := -1
end;

constructor TUAUpdateDataOutPacket.Create;
begin
inherited;
FErrorList := TUAParams.Create;
FAnyValue := TUAParamsList.Create;
end;

destructor TUAUpdateDataOutPacket.Destroy;
begin
FAnyValue.Free;
FErrorList.Free;
inherited;
end;

function TUAUpdateDataOutPacket.GetItemAnyValue(index,
itemid: integer): TAnyParam;
begin
Result := TAnyParam( FAnyValue.GetItem(index,itemid) );
end;

function TUAUpdateDataOutPacket.GetItemErrorParam(
index: Integer): TErrorParam;
begin
Result := TErrorParam(FErrorList.Items[index]);
end;

function TUAUpdateDataOutPacket.GetResultCode: Integer;
begin
Result := FResultCode;
end;

function TUAUpdateDataOutPacket.GetUaData: OleVariant;
begin
Result := VarArrayCreate([0,3], varVariant);
Result[0] := inherited GetUaData;
Result[1] := FResultCode;
Result[2] := FErrorList.UAData;
Result[3] := FAnyValue.UAData;
end;

procedure TUAUpdateDataOutPacket.SetResultCode(const Value: Integer);
begin
FResultCode := Value;
end;

procedure TUAUpdateDataOutPacket.SetUaData(const Value: OleVariant);
begin

inherited SetUaData(value[0]);
FResultCode := value[1];
FErrorList.UAData := value[2];
FAnyValue.UAData := value[3];
end;

{ TUAExecuteDataInPacket }
procedure TUAExecuteDataInPacket.AddItemAnyParam(index: integer;
aAnyParam: TAnyParam);
begin
FAnyParam.AddItem(index, aAnyParam);
end;

procedure TUAExecuteDataInPacket.ClearAllUaData;
begin
FAnyParam.Clear;
end;

function TUAExecuteDataInPacket.CountAnyParam(index: integer): integer;
var
aList: TObjectList;
begin
if index=-1 then
result := FAnyParam.Count
else
if index>=FAnyParam.Count then
result := -1
else
begin
aList := TObjectList(FAnyParam[index]);
result := aList.Count;
end;

end;

constructor TUAExecuteDataInPacket.Create;
begin
inherited;
FAnyParam := TUAParamsList.Create;
end;

destructor TUAExecuteDataInPacket.Destroy;
begin
FAnyParam.Free;
inherited;
end;

function TUAExecuteDataInPacket.GetItemAnyParam(index,
itemid: integer): TAnyParam;
begin
Result := TAnyParam( FAnyParam.GetItem(index,itemid) );
end;

function TUAExecuteDataInPacket.GetUaData: OleVariant;
begin

Result := VarArrayCreate([0,2], varVariant);
Result[0] := inherited GetUaData;
Result[1] := FAnyParam.UAData;
Result[2] := FDbConnTag;
end;

procedure TUAExecuteDataInPacket.SetDBConnTag(const Value: string);
begin
FDBConnTag := Value;
end;

procedure TUAExecuteDataInPacket.SetUaData(const Value: OleVariant);
begin

inherited SetUaData(value[0]);
FAnyParam.UAData := value[1];
FDbConnTag := value[2];

end;

{ TUAExecuteDataOutPacket }
procedure TUAExecuteDataOutPacket.AddItemAnyValue(index: integer;
aAnyValue: TAnyParam);
begin
FAnyValue.AddItem(index, aAnyValue);
end;

procedure TUAExecuteDataOutPacket.AddItemErrorParam(
aErrorParam: TErrorParam);
begin
FErrorList.Add(aErrorParam);
end;

procedure TUAExecuteDataOutPacket.ClearAllUaData;
begin
FErrorList.Clear;
FAnyValue.Clear;
end;

function TUAExecuteDataOutPacket.CountAnyValue(index: integer): integer;
var
aList: TObjectList;
begin
if index=-1 then
result := FAnyValue.Count
else
if index>=FAnyValue.Count then
result := -1
else
begin
aList := TObjectList(FAnyValue[index]);
result := aList.Count;
end;

end;

function TUAExecuteDataOutPacket.CountErrorParam(index: integer): integer;
//var
// aList: TObjectList;
begin

if index=-1 then
result := FErrorList.Count
else
result := -1
end;

constructor TUAExecuteDataOutPacket.Create;
begin
inherited;
FErrorList := TUAParams.Create;
FAnyValue := TUAParamsList.Create;
end;

destructor TUAExecuteDataOutPacket.Destroy;
begin
FAnyValue.Free;
FErrorList.Free;
inherited;
end;

function TUAExecuteDataOutPacket.GetItemAnyValue(index,
itemid: integer): TAnyParam;
begin
Result := TAnyParam( FAnyValue.GetItem(index,itemid) );
end;

function TUAExecuteDataOutPacket.GetItemErrorParam(
index: Integer): TErrorParam;
begin
Result := TErrorParam(FErrorList.Items[index]);
end;

function TUAExecuteDataOutPacket.GetResultCode: Integer;
begin
Result := FResultCode;
end;

function TUAExecuteDataOutPacket.GetUaData: OleVariant;
begin

Result := VarArrayCreate([0,3], varVariant);
Result[0] := inherited GetUaData;
Result[1] := FResultCode;
Result[2] := FErrorList.UAData;
Result[3] := FAnyValue.UAData;
end;

procedure TUAExecuteDataOutPacket.SetResultCode(const Value: Integer);
begin
FResultCode := Value;
end;

procedure TUAExecuteDataOutPacket.SetUaData(const Value: OleVariant);
begin
inherited SetUaData(value[0]);
FResultCode := value[1];
FErrorList.UAData := value[2];
FAnyValue.UAData := value[3];
end;

{ TUAUpdateDataInPacket }
constructor TUAUpdateDataInPacket.Create;
begin
Inherited;
FDeltaList := TUAParams.Create;
FAnyParam := TUAParamsList.Create;
end;

destructor TUAUpdateDataInPacket.Destroy;
begin
FAnyParam.Free;
FDeltaList.Free;
inherited;
end;

function TUAUpdateDataInPacket.GetUaData: OleVariant;
begin

Result := VarArrayCreate([0,4], varVariant);
Result[0] := inherited GetUaData;
Result[1] := FUpdateIndex;
Result[2] := FDeltaList.UAData;
Result[3] := FAnyParam.UAData;
Result[4] := FDBConnTag;
end;

procedure TUAUpdateDataInPacket.SetUaData(const Value: OleVariant);
begin

inherited SetUaData(value[0]);
FUpdateIndex := value[1];
FDeltaList.UAData := value[2];
FAnyParam.UAData := value[3];
FDbConnTag := value[4];

end;

procedure TUAUpdateDataInPacket.ClearAllUaData;
begin
FDeltaList.Clear;
FAnyParam.Clear;
end;

procedure TUAUpdateDataInPacket.AddItemDelta(aDelta: TDeltaParam);
begin
FDeltaList.Add(aDelta);
end;

function TUAUpdateDataInPacket.CountItemDelta(index: integer): integer;
//var
// aList: TObjectList;
begin
if index=-1 then
result := FDeltaList.Count
else
result := -1
end;

function TUAUpdateDataInPacket.GetItemDelta(index: Integer): TDeltaParam;
begin
Result := TDeltaParam(FDeltaList.Items[index]);
end;

procedure TUAUpdateDataInPacket.SetUpdateIndex(const Value: Integer);
begin
FUpdateIndex := Value;
end;

procedure TUAUpdateDataInPacket.AddItemAnyParam(index: integer;
aAnyParam: TAnyParam);
begin
FAnyParam.AddItem(index, aAnyParam);
end;

function TUAUpdateDataInPacket.CountAnyParam(index: integer): integer;
var
aList: TObjectList;
begin
if index=-1 then
result := FAnyParam.Count
else
if index>=FAnyParam.Count then
result := -1
else
begin
aList := TObjectList(FAnyParam[index]);
result := aList.Count;
end;

end;

function TUAUpdateDataInPacket.GetItemAnyParam(index,
itemid: integer): TAnyParam;
begin
Result := TAnyParam( FAnyParam.GetItem(index,itemid) );
end;

procedure TUAUpdateDataInPacket.SetDBConnTag(const Value: string);
begin
FDBConnTag := Value;
end;

{ TDataSheetParam }

function TDataSheetParam.GetUaData: OleVariant;
begin

Result := VarArrayCreate([0,5], varVariant);
Result[0] := inherited GetUaData;
Result[1] := AliasTableName;
Result[2] := FieldName;
Result[3] := FieldType;
Result[4] := RelSymbol;
Result[5] := LastValue;
end;

procedure TDataSheetParam.SetAliasTableName(const Value: string);
begin
if Trim(value) <> '' then
FAliasTableName := Trim(Value);
end;

procedure TDataSheetParam.SetFieldName(const Value: string);
begin
if Trim(value)<>'' then
FFieldName := Trim(value);
end;

procedure TDataSheetParam.SetFieldType(const Value: TFieldType);
begin
FFieldType := Value;
end;

procedure TDataSheetParam.SetLastValue(const Value: Variant);
begin
if (not VarIsNull(value)) and (VarCompareValue(value,Unassigned) <> vrEqual) then
FLastValue := Value;
end;

procedure TDataSheetParam.SetRelSymbol(const Value: string);
begin
if Trim(value) <> '' then
FRelSymbol := Trim(Value);
end;

procedure TDataSheetParam.SetUaData(const Value: OleVariant);
begin
inherited SetUaData(value[0]);
AliasTableName := value[1];
FieldName := value[2];
FieldType := value[3];
RelSymbol := value[4];
LastValue := value[5];
end;

{ TRowSheetParam }

function TRowSheetParam.GetUaData: OleVariant;
begin
Result := VarArrayCreate([0,4], varVariant);
Result[0] := inherited GetUaData;
Result[1] := AliasTableName;
Result[2] := FieldName;
Result[3] := FieldType;
Result[4] := CurrValue;
end;

procedure TRowSheetParam.SetAliasTableName(const Value: string);
begin
if Trim(value) <> '' then
FAliasTableName := Trim(Value);
end;

procedure TRowSheetParam.SetCurrValue(const Value: OleVariant);
begin
if (not VarIsNull(value)) and (VarCompareValue(value,Unassigned) <> vrEqual) then
FCurrValue := Value;
end;

procedure TRowSheetParam.SetFieldName(const Value: string);
begin
if Trim(value)<>'' then
FFieldName := Trim(value);
end;

procedure TRowSheetParam.SetFieldType(const Value: TFieldType);
begin
FFieldType := Value;
end;

procedure TRowSheetParam.SetUaData(const Value: OleVariant);
begin

inherited SetUaData(value[0]);
AliasTableName := value[1];
FieldName := value[2];
FieldType := value[3];
CurrValue := value[4];
end;

{ TMasterLinkParam }
function TMasterLinkParam.BuildMasterSqlScript: string;
begin

Result := '';
if (trim(FMasterAliasTableName) = '') or (trim(FMasterField) ='')
or (VarisNull(FMasterFieldValue) or
(VarCompareValue(FMasterFieldValue,Unassigned) = vrEqual )) then
Exit;
Result := FMasterAliasTableName+'.'+FMasterField+ '='+ AnyValueToStr(FDataType,FMasterFieldValue);
end;

constructor TMasterLinkParam.Create;
begin
inherited;
end;

destructor TMasterLinkParam.Destroy;
begin

inherited;
end;

function TMasterLinkParam.GetUaData: OleVariant;
begin

Result := VarArrayCreate([0,4], varVariant);
Result[0] := inherited GetUaData;
Result[1] := FMasterAliasTableName;
Result[2] := FMasterField;
Result[3] := Ord(FDataType);
Result[4] := FMasterFieldValue;
end;

procedure TMasterLinkParam.SetDataType(const Value: TFieldType);
begin
FDataType := Value;
end;

procedure TMasterLinkParam.SetMasterAliasTableName(const Value: string);
begin
FMasterAliasTableName := Value;
end;

procedure TMasterLinkParam.SetMasterField(const Value: string);
begin
FMasterField := Value;
end;

procedure TMasterLinkParam.SetMasterFieldValue(const Value: Variant);
begin
FMasterFieldValue := Value;
end;

procedure TMasterLinkParam.SetUaData(const Value: OleVariant);
begin

inherited SetUaData(Value[0]);
FMasterAliasTableName := Value[1];
FMasterField := Value[2];
FDataType := Value[3];
FMasterFieldValue := Value[4];
end;

{ TDataReturnParam }
constructor TDataReturnParam.Create;
begin
inherited;
end;

destructor TDataReturnParam.Destroy;
begin

inherited;
end;

function TDataReturnParam.GetAliasTableName: string;
begin
Result := FAliasTableName;
end;

function TDataReturnParam.GetAllRecCount: integer;
begin
Result := FAllRecCount;
end;

function TDataReturnParam.GetCurrRecCount: integer;
begin
Result := FCurrRecCount;
end;

function TDataReturnParam.GetData: OleVariant;
begin
Result := FData;
end;

function TDataReturnParam.GetDataSheetValue: OleVariant;
begin
Result := FDataSheetValue;
end;

function TDataReturnParam.GetRowSheetValue: OleVariant;
begin
Result :=FRowSheetValue;
end;

function TDataReturnParam.GetUaData: OleVariant;
begin

Result := VarArrayCreate([0,6], varVariant);
Result[0] := inherited GetUaData;
Result[1] := FAliasTableName;
Result[2] := FData;
Result[3] := FAllRecCount;
Result[4] := FCurrRecCount;
Result[5] := FRowSheetValue;
Result[6] := FDataSheetValue;
end;

procedure TDataReturnParam.SetAliasTableName(const Value: string);
begin
if Trim(Value) <> '' then
FAliasTableName := Value;
end;

procedure TDataReturnParam.SetAllRecCount(const Value: integer);
begin
FAllRecCount := Value;
end;

procedure TDataReturnParam.SetCurrRecCount(const Value: integer);
begin
FCurrRecCount := Value;
end;

procedure TDataReturnParam.SetData(const Value: OleVariant);
begin
if (not VarIsEmpty(Value)) and (VarCompareValue(Value,Unassigned) <> vrEqual) then
FData := Value;
end;

procedure TDataReturnParam.SetDataSheetValue(const Value: OleVariant);
begin
if (not VarIsEmpty(Value)) and (VarCompareValue(Value,Unassigned) <> vrEqual) then
FDataSheetValue := Value;
end;

procedure TDataReturnParam.SetRowSheetValue(const Value: OleVariant);
begin

if (not VarIsEmpty(Value)) and (VarCompareValue(Value,Unassigned) <> vrEqual) then
FRowSheetValue := Value;
end;

procedure TDataReturnParam.SetUaData(const Value: OleVariant);
begin

inherited SetUaData(Value[0]);
FAliasTableName := Value[1];
FData := value[2];
FAllRecCount := Value[3];
FCurrRecCount:= Value[4];
FRowSheetValue := Value[5];
FDataSheetValue := Value[6];
end;

{ TAnyParam }
function TAnyParam.GetAnyValue: Variant;
begin
Result := FAnyValue;
end;

function TAnyParam.GetUaData: OleVariant;
begin
Result := VarArrayCreate([0,1], varVariant);
Result[0] := inherited GetUaData;
Result[1] := FAnyValue;
end;

procedure TAnyParam.SetAnyValue(const Value: Variant);
begin
FAnyValue := Value;
end;

procedure TAnyParam.SetUaData(const Value: OleVariant);
begin

inherited SetUaData(value[0]);
FAnyValue := value[1];
end;

{ TErrorParam }
function TErrorParam.GetUaData: OleVariant;
begin

Result := VarArrayCreate([0,4], varVariant);
Result[0] := inherited GetUaData;
Result[1] := FErrorCode;
Result[2] := FErrorMask;
Result[3] := FErrorContext;
Result[4] := FErrorMsg;
end;

procedure TErrorParam.SetErrorCode(const Value: integer);
begin
FErrorCode := Value;
end;

procedure TErrorParam.SetErrorContext(const Value: string);
begin
FErrorContext := Value;
end;

procedure TErrorParam.SetErrorMask(const Value: integer);
begin
FErrorMask := Value;
end;

procedure TErrorParam.SetErrorMsg(const Value: string);
begin
FErrorMsg := Value;
end;

procedure TErrorParam.SetUaData(const Value: OleVariant);
begin

inherited SetUaData(value[0]);
FErrorCode := value[1];
FErrorMask := value[2];
FErrorContext := value[3];
FErrorMsg := value[4];
end;

initialization
RegisterClasses( [TUAParam,TMasterLinkParam,TRowSheetParam,TDataSheetParam,TDataRequestParam,TDataReturnParam,TErrorParam,
TDeltaParam ,TUARequestDataInPacket,TUARequestDataOutPacket,TUAUpdateDataInPacket,TUAUpdateDataOutPacket
,TUAExecuteDataInPacket,TUAExecuteDataOutPacket,TAnyParam]);
end.
 
你这个东西支持数据敏感控件嘛/
 
后退
顶部