|
//Business平台的人员并没有“性别”、“电话”的等人员对象的扩展属性信息。
//但是可以通过在Business平台的人员表中增加“E”字母开头的字段来实现增加人员的扩展属性,
//增加后的属性可以在系统功能的“人员设计器”中看到。
//但是有时需要使用代码获取这些扩展信息,以下为使用代码获取人员扩展信息的示例。
procedure TMainForm.btnGetExtInfoClick(Sender: TObject);
var
I: integer;
FieldList: TStrings;
lTableDef: TBizTableDef;
lFieldDef: TBizFieldDef;
lDataField: TUserDataField;
ExtendInfoKind: TOrgSysExtendInfoKind;
OrgObjectURL: TBizURL;
lFileAttribute: TFileAttribute;
lField: TDataField;
lAttribStr: string;
DataSetExtInfo: TUserDataSet;
begin
{获取系统表}
DataSetExtInfo := TUserDataSet.Create(self);
ExtendInfoKind := TOrgSysExtendInfoKind.eikPerson;
lTableDef := TOrgSysExtendInfoManager.GetOrgSysTableDef(ExtendInfoKind);
if lTableDef = nil then Exit;
FieldList := TStringList.Create;
OrgObjectURL := TBizURL.Create;
try
FieldList.Clear;
OrgObjectURL.URL := 'Org:\PERSON\ZXX.psn';
lFileAttribute := FileSys.FileSystem.CreateAttribute(OrgObjectURL.FileName,
SysUtils.fmOpenRead);
TOrgSysExtendInfoManager.GetOrgSysTableExtendFields(ExtendInfoKind, FieldList);
if FieldList.Count = 0 then Exit; //如果没有扩展字段则退出
for I := 0 to FieldList.Count - 1 do
begin
lFieldDef := TBizFieldDef(FieldList.Objects[I]);
lDataField := TUserDataField.Create(DataSetExtInfo);
lDataField.DataSet := DataSetExtInfo;
lDataField.ID := lFieldDef.ID;
lDataField.DisplayName := lFieldDef.DisplayName;
lFieldDef.AssignAttrTo(lDataField);
end;
DataSetExtInfo.Open;
DataSetExtInfo.Edit;
for I := 0 to DataSetExtInfo.FieldCount - 1 do
begin
lField := DataSetExtInfo.Fields[I];
case lField.DataType of
TFieldType.ftGraphic, TFieldType.ftBlob, TFieldType.ftOraBlob:
TOrgSysExtendInfoManager.LoadBlobFieldFromOrgExtTable(OrgObjectURL,
TBlobField(lField), ExtendInfoKind)
else
lAttribStr := lFileAttribute.ValuesAsString[lField.FieldName];
lField.AsString := lAttribStr;
MemoResult.Lines.Add('扩展字段ID:' + lField.FieldName + ',显示名称:'
+ lField.DisplayName + ',字段值:' + lAttribStr);
if lField.FieldName = 'EXB' then edtEXB.Text := lField.AsString;
if lField.FieldName = 'EDH' then edtEDH.Text := lField.AsString;
end;
end;
DataSetExtInfo.Post;
finally
DataSetExtInfo.Free;
lFileAttribute.Free;
FieldList.Free;
end;
end;
[错误]Biz:\GYSCGLXT\GGGN\TESTYUE\YWGN4.FUNC.DIR\MainForm.Form.pas(30, 19): Undeclared identifier "TOrgSysExtendInfoKind"
[错误]Biz:\GYSCGLXT\GGGN\TESTYUE\YWGN4.FUNC.DIR\MainForm.Form.pas(33, 11): Undeclared identifier "TDataField"
[错误]Biz:\GYSCGLXT\GGGN\TESTYUE\YWGN4.FUNC.DIR\MainForm.Form.pas(39, 3): Undeclared identifier "ExtendInfoKind"
[错误]Biz:\GYSCGLXT\GGGN\TESTYUE\YWGN4.FUNC.DIR\MainForm.Form.pas(40, 16): Undeclared identifier "TOrgSysExtendInfoManager"
[错误]Biz:\GYSCGLXT\GGGN\TESTYUE\YWGN4.FUNC.DIR\MainForm.Form.pas(49, 5): Undeclared identifier "TOrgSysExtendInfoManager"
[错误]Biz:\GYSCGLXT\GGGN\TESTYUE\YWGN4.FUNC.DIR\MainForm.Form.pas(64, 7): Undeclared identifier "lField"
[错误]Biz:\GYSCGLXT\GGGN\TESTYUE\YWGN4.FUNC.DIR\MainForm.Form.pas(65, 12): Undeclared identifier "lField" |
|