起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 2110|回复: 2

通过代码,读取或者设置业务参数的值的方法

[复制链接]
发表于 2004-12-10 14:32:09 | 显示全部楼层 |阅读模式
有两种方法:

方法一:调用系统空间系统函数库的函数

方法二:直接调用当前环境的函数
回复

使用道具 举报

 楼主| 发表于 2004-12-10 14:33:00 | 显示全部楼层

调用系统空间系统函数库的函数

步骤:

1、在Studio中,项目管理窗口的需要访问业务参数的程序集上,右点选择“项目管理器”

2、在“引入”页添加“系统空间\系统运行库\系统函数库”

3、在代码中,调用SystemUtils.TContextUtils.GetParam函数获得业务参数

4、获取和设置这个业务参数的值

function TMainForm.GetParamValue: String;
var
  lParam: TBizParam;
  lBizURL: TBizURL;
begin
  lBizURL := TBizURL.Create;
  try
    lBizURL.URL := 'Biz:\BUSINESSFAQ\DICT\YWCSZ.ParamGroup';
    lParam := SystemUtils.TContextUtils.GetParam(Context, lBizURL, 'CSCS');
    Result := Variants.VarToStr(lParam.Value);
  finally
    lBizURL.Free;
  end;
end;
回复 支持 反对

使用道具 举报

 楼主| 发表于 2004-12-10 14:33:44 | 显示全部楼层

直接调用当前环境的函数

步骤:

1、用环境Context创建当前环境lContextCurrent

2、调用lContextCurrent的GetParam函数获得业务参数

procedure TMainForm.SetParamValue(AValue: String);
var
  lParam: TBizParam;
  lBizURL: TBizURL;
  lContextCurrent: TContextCurrent;
begin
  lBizURL := TBizURL.Create;
  lContextCurrent := TContextCurrent.Create(Context);
  try
    lBizURL.URL := 'Biz:\BUSINESSFAQ\DICT\YWCSZ.ParamGroup\CSCS.Param';
    lParam := lContextCurrent.GetParam(lBizURL);
    lParam.Value := AValue;
  finally
    lBizURL.Free;
  end;
end;
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2024-4-27 06:00 , Processed in 0.044570 second(s), 15 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表