--- oup/rewrite/DataAccess/ConnectionManager.pas 2007/01/18 17:15:59 93 +++ oup/rewrite/DataAccess/ConnectionManager.pas 2007/01/22 23:05:45 97 @@ -17,12 +17,14 @@ type function GetConnectionCount: Integer; function GetConnection(ConnectionID: Integer): TDataAccess; function GetConnectionByIndex(Index: Integer): TDataAccess; + function GetConnectionIndex(ConnectionID: Integer): Integer; procedure RemoveConnection(ArrayIndex: Integer); protected public property Count: Integer read GetConnectionCount; property Connection[ConnectionID: Integer]: TDataAccess read GetConnection; property ConnectionByIndex[Index: Integer]: TDataAccess read GetConnectionByIndex; + property ConnectionIndexByID[ConnectionID: Integer]: Integer read GetConnectionIndex; property OnCoonnectionListChanged: TConnectionListChangedEvent read FConnectionListChanged write FConnectionListChanged; constructor Create; @@ -36,6 +38,10 @@ type end; +var + ConManager: TConnectionManager; + + implementation uses SysUtils, Dialogs; @@ -50,6 +56,20 @@ begin Result := Length(FConnections); end; +function TConnectionManager.GetConnectionIndex(ConnectionID: Integer): Integer; +var + i: Integer; +begin + Result := -1; + if Count > 0 then + for i := 0 to Count - 1 do + if ConnectionByIndex[i].ConnectionID = ConnectionID then + begin + Result := i; + Break; + end; +end; + function TConnectionManager.GetConnection(ConnectionID: Integer): TDataAccess; var i: Integer; @@ -239,4 +259,8 @@ begin end; +initialization + ConManager := TConnectionManager.Create; +finalization + ConManager.Free; end.