ReportConnection.pas 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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);
  23. FConnection := AProjectData.ADOConnection;
  24. end;
  25. destructor TReportConnection.Destroy;
  26. begin
  27. FCommonGather.Free;
  28. inherited;
  29. end;
  30. procedure TReportConnection.RefreshConnection(ATemplate: TTemplateNode);
  31. begin
  32. case ATemplate.DataBaseFlag of
  33. 0: FConnection := FProjectData.ADOConnection;
  34. 1: FConnection := FCommonGather.RefreshConnection(ATemplate);
  35. end;
  36. end;
  37. end.