里面的表选择系统空间下的人员表即可
procedure TPersonStructInfo.CreateOrgPersonPassWord(ADataSet : TSqlDataSet;AIDField,ANameField:string);
const
cPromptText = '正在生成人员“%s”的密码到组织机构中...';
var
I : integer;
lPersonID : string;
lPersonName : string;
lPromptText: string;
begin
ADataSet.DisableControls;
ADataSet.First;
I := 0;
while not ADataSet.Eof do
begin
I := I + 1;
lPersonID := ADataSet.FieldByName(AIDField).AsString;
lPersonName := ADataSet.FieldByName(ANameField).AsString;
lPromptText := SysUtils.Format(cPromptText, [lPersonName]);
if FOnProgress <> nil then
FOnProgress(ADataSet.RecordCount, I , lPromptText);
if ftmppassword<>'' then
THrLib.ChangePersonPassWord(lPersonID,ftmppassword)
else
THrLib.ChangePersonPassWord(lPersonID,lPersonID);
ADataSet.Next;
end;
ADataSet.EnableControls;
jsDialogs.ShowMsg('人员密码生成完毕!','提示');
end;
static procedure THrLib.ChangePersonPassWord(APersonID,APassWord:string);
var
lPerson: Org.TPerson;
begin
try
lPerson := Org.OrgSys.OrgSystem.FindPerson(APersonID);
If Assigned(lPerson) then
begin
lPerson.Password := APassWord;
Org.OrgSys.OrgSystem.SaveUnit(lPerson);
end;
except
end;
end; |