ReportConnection.pas 1002 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. unit ReportConnection;
  2. interface
  3. uses
  4. ADODB, ProjectData, ReportManager, rpgGatherControl;
  5. type
  6. TReportConnection = class
  7. private
  8. FProjectData: TProjectData;
  9. FConnection: TADOConnection;
  10. FCommonGather: TrpgGatherControl;
  11. public
  12. constructor Create(AProjectData: TProjectData);
  13. destructor Destroy; override;
  14. procedure RefreshConnection(ATemplate: TTemplateNode);
  15. property Connection: TADOConnection read FConnection;
  16. end;
  17. implementation
  18. { TReportConnection }
  19. constructor TReportConnection.Create(AProjectData: TProjectData);
  20. begin
  21. FProjectData := AProjectData;
  22. FCommonGather := TrpgGatherControl.Create(AProjectData.ProjectID);
  23. end;
  24. destructor TReportConnection.Destroy;
  25. begin
  26. FCommonGather.Free;
  27. inherited;
  28. end;
  29. procedure TReportConnection.RefreshConnection(ATemplate: TTemplateNode);
  30. begin
  31. case ATemplate.DataBaseFlag of
  32. 0: FConnection := FProjectData.ADOConnection;
  33. 1: FConnection := FCommonGather.RefreshConnection;
  34. end;
  35. end;
  36. end.