12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- unit rpgGatherProjDm;
- interface
- uses
- SysUtils, Classes, sdProvider, sdDB, GatherProjInfo, ADODB;
- type
- TrpgGatherProjData = class(TDataModule)
- sdpGatherProj: TsdADOProvider;
- sddGatherProj: TsdDataSet;
- private
- procedure SaveGatherInfo(AProjs: TList);
- public
- constructor Create(AConnection: TADOConnection);
- procedure SaveDataTo(AProjs, ASProjs: TList; const ATableName: string);
- end;
- implementation
- {$R *.dfm}
- { TrpgGatherProjData }
- constructor TrpgGatherProjData.Create(AConnection: TADOConnection);
- begin
- inherited Create(nil);
- sdpGatherProj.Connection := AConnection;
- end;
- procedure TrpgGatherProjData.SaveDataTo(AProjs, ASProjs: TList; const ATableName: string);
- begin
- sdpGatherProj.TableName := ATableName;
- sddGatherProj.Open;
- sddGatherProj.BeginUpdate;
- try
- SaveGatherInfo(AProjs);
- SaveGatherInfo(ASProjs);
- finally
- sddGatherProj.EndUpdate;
- sddGatherProj.Save;
- end;
- end;
- procedure TrpgGatherProjData.SaveGatherInfo(AProjs: TList);
- var
- i: Integer;
- Rec: TsdDataRecord;
- ProjInfo: TGatherProjInfo;
- begin
- for i := 0 to AProjs.Count - 1 do
- begin
- ProjInfo := TGatherProjInfo(AProjs.Items[i]);
- Rec := sddGatherProj.Add;
- if ProjInfo.ProjType = 0 then
- Rec.ValueByName('ID').AsInteger := i
- else
- Rec.ValueByName('ID').AsInteger := -3;
- Rec.ValueByName('ProjectID').AsInteger := ProjInfo.ProjectID;
- Rec.ValueByName('ProjectName').AsString := ProjInfo.ProjectName;
- Rec.ValueByName('ProjType').AsInteger := ProjInfo.ProjType;
- Rec.ValueByName('ParentName').AsString := ProjInfo.ParentName;
- Rec.ValueByName('TopParentName').AsString := ProjInfo.TopParentName;
- Rec.ValueByName('PhaseCount').AsInteger := ProjInfo.ProjRec.ValueByName('PhaseCount').AsInteger;
- Rec.ValueByName('AuditStatus').AsInteger := ProjInfo.ProjRec.ValueByName('AuditStatus').AsInteger;
- end;
- end;
- end.
|