调用函数:
static procedure TPersonFuncLib.RecoverPerson(APersonID:string);
var
I: Integer;
lURL: TBizURL;
lOrgUnit: TOrgUnit;
lOrgURLs:TOrgURLs;
isInRecycleBin:Boolean;
lFileNames: TStrings;
begin
lURL := TBizURL.Create;
lFileNames := TStringList.Create;
lOrgURLs:=TOrgURLs.Create;
try
FileSys.FileSystem.SearchFile(FileSys.MakeDeleteFile('Org:\Person'), FileSys.SearchFileParam('*.psn', True), lFileNames); //这里不取人员文件夹
isInRecycleBin:=False;
for I := 0 to lFileNames.Count - 1 do // lOrgURLs.Count
begin
try
lURL.FileName := lFileNames[I];
lOrgUnit := OrgSys.OrgSystem.FindUnit(lURL,True);
if Assigned(lOrgUnit) then
if lOrgUnit.ID = APersonID then
begin
lOrgURLs.Add(lOrgUnit.BizURL);
isInRecycleBin:=True;
end;
except
//
end;
end;
if isInRecycleBin then
TOrgLib.RecoverOrg(lOrgURLs)
else
jsDialogs.ShowError('回收站中未发现人员"'+APersonID+'"!','错误');
finally
lURL.Free;
lOrgURLs.Free;
lFileNames.Free;
end;
end; |