 自定程序
自定程序
  # FastWeb 自定程序
- 适用平台:WEB(桌面),APP(移动)
# 1. UGMM类副程序
UGMM类副程序在程序中调用时,必须以UGMM.开头。
# 1.1. AddLog
procedure AddLog(const msg: string; ACategory: string); 
说明:向FastWeb的日志文件中写入日志信息。
# 1.2. DelBeans
procedure DelBeans;
说明: 删除所有Bean模块。
# 1.3. DelWebSubForm
Procedure DelWebSubForm(ACaption:String);
说明: 从内存中释放子窗体(Web)
- DelWebSubForm 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACaption | 指定子窗体对象的名称 | 
- 示例
//JScript
function btnAddOnClick(sender)
{
  var F,D;
  //打开任务登记
  F = UGMM.GetWebSubForm("WebSubForm");
  TUgWebForm(F).Caption = "SubForm"; 
  
  if (F.ShowModal == mrOK) 
  {
     btnQueryOnClick(Nil);
     //从内存中释放子窗体
     UGMM.DelWebSubForm("WebSubForm");
  }
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//PasScript
procedure btnAddOnClick(sender: tobject);
Var
  F:TUniForm;
  D:TUgRFDataSet;
begin
  //打开任务登记
  F := UGMM.GetWebSubForm('WebSubForm');
  TUgWebForm(F).Caption := 'SubForm'; 
  
  if F.ShowModal = mrOK then 
  Begin
     btnQueryOnClick(Nil);
     //从内存中释放子窗体
     UGMM.DelWebSubForm('WebSubForm');
  End;
end;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Make sure to add code blocks to your code group
# 1.4. DelAppSubForm
Procedure DelAppSubForm(ACaption:String);
说明: 从内存中释放子窗体(App)
- DelAppSubForm 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACaption | 指定子窗体对象的名称 | 
- 示例
//JScript
function btnAddOnClick(sender)
{
  var F,D;
  //打开任务登记
  F = UGMM.GetWebSubForm("WebSubForm");
  TUgWebForm(F).Caption = "SubForm"; 
  
  if (F.ShowModal == mrOK) 
  {
     btnQueryOnClick(Nil);
     //从内存中释放子窗体
     UGMM.DelWebSubForm("WebSubForm");
  }
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//PasScript
procedure btnAddOnClick(sender: tobject);
Var
  F:TUniForm;
  D:TUgRFDataSet;
begin
  //打开任务登记
  F := UGMM.GetWebSubForm('WebSubForm');
  TUgWebForm(F).Caption := 'SubForm'; 
  if F.ShowModal = mrOK then 
  Begin
     btnQueryOnClick(Nil);
     //从内存中释放子窗体
     UGMM.DelAppSubForm('WebSubForm');
  End;
end;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Make sure to add code blocks to your code group
# 1.5. DelDataNodes
Procedure DelDataNodes(AGuid:String);
说明: 删除数据库节点
- AGuid 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AGuid | 指定一个节点数据库的唯一ID | 
- 示例
//JScript
//删除节点数据库
//框架模式下 DataNodes.web模块专用
function btDeleteOnClick(sender)
{
  if (cdsDataNodes.IsEmpty)
  RaiseException(UGMM.LT("No record can't be deleted"));
  
  if (MessageDlg(UGMM.LT("Note: Do you want to delete this node?"),mtWarning,mbYes + mbNo) == mrYes)
  {
    UGMM.DelDataNodes(cdsDataNodes.FieldByName("Guid").AsString); 
    cdsDataNodes.Delete;
  }
}
2
3
4
5
6
7
8
9
10
11
12
13
14
//PasScript
//删除节点数据库
//框架模式下 DataNodes.web模块专用
procedure btDeleteOnClick(sender: tobject);
begin
  if cdsDataNodes.IsEmpty then
  RaiseException(UGMM.LT('No record can''t be deleted'));
  
  if MessageDlg(UGMM.LT('Note: Do you want to delete this node?'),mtWarning,mbYes + mbNo) = mrYes then
  Begin
    UGMM.DelDataNodes(cdsDataNodes.FieldByName('Guid').AsString); 
    cdsDataNodes.Delete;
  End;
end;
2
3
4
5
6
7
8
9
10
11
12
13
14
// Make sure to add code blocks to your code group
# 1.6. DelPrintTemplate
Procedure DelPrintTemplate(AGuid:String);
说明: 删除打印模板
- DelPrintTemplate 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AGuid | 指定一个打印模板的唯一ID | 
- 示例
//JScript
//删除打印模板
function btDeleteOnClick(Sender)
{
  if (cdsPrintTemplate.IsEmpty)
  RaiseException(UGMM.LT("No record can't be deleted"));
  if (MessageDlg(UGMM.LT("Note: Delete this print template?"),mtWarning,mbYes + mbNo) == mrYes)
  {
   UGMM.DelPrintTemplate(cdsPrintTemplate.FieldbyName("Guid").asString); 
   cdsPrintTemplate.Delete;
  }
}
2
3
4
5
6
7
8
9
10
11
12
//PasScript
//删除打印模板
Procedure btDeleteOnClick(Sender: TObject);
Begin
  if cdsPrintTemplate.IsEmpty then
  RaiseException(UGMM.LT('No record can''t be deleted'));
  if MessageDlg(UGMM.LT('Note: Delete this print template?'),mtWarning,mbYes + mbNo) = mrYes then
  Begin
   UGMM.DelPrintTemplate(cdsPrintTemplate.FieldbyName('Guid').asString); 
   cdsPrintTemplate.Delete;
  end;
End;
2
3
4
5
6
7
8
9
10
11
12
// Make sure to add code blocks to your code group
# 1.7. EditorPassWord
Procedure EditorPassWord(AOldPassWord , ANewPassWord:String);
说明: 修改密码
- EditorPassWord 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AOldPassWord | 指定用户旧密码 | 
| ANewPassWord | 指定用户新密码 | 
- 示例
//JScript
//修改登陆密码
function btEditorPassWordOnClick(Sender)
{
  var f,b,e;
  F=GetEditorPassWord;
  Try{
    F.Caption = UGMM.LT("Change Password");
    e="";
    b=True;
    While (b)
    {
      if (e!="")
      MessageDlg(e,mtError,mbOK);
      if (F.ShowModal == mrOK) 
      {
        Try{
          if (TUgEdit(F.FindComponent("edOldPassWord")).Text == "")
            RaiseException(UGMM.LT("Old password cannot be empty"));
            
          if (TUgEdit(F.FindComponent("edNewPassWord1")).Text == "")
            RaiseException(UGMM.LT("New password cannot be empty")); 
            
          if (TUgEdit(F.FindComponent("edNewPassWord1")).Text != TUgEdit(F.FindComponent("edNewPassWord2")).Text) then
            RaiseException(UGMM.LT("The new password entered twice must be the same"));
          UGMM.EditorPassWord(TUgEdit(F.FindComponent("edOldPassWord")).Text , TUgEdit(F.FindComponent("edNewPassWord1")).Text);
          MessageDlg(UGMM.LT("Note: The password has been changed successfully, please remember the new password"),mtWarning,mbOK);
          b=False;
        }
        Except{RaiseException(ExceptionMessage);}
      }
      else{
      b=False;
      }
    }
  }
  finally{
    F.Free;
  }
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//PasScript
//修改登陆密码
Procedure btEditorPassWordOnClick(Sender: TObject);
Var
  F:TUgWebForm;
  b:Boolean;
  e:String;
Begin
  F:=GetEditorPassWord;
  Try
    F.Caption := UGMM.LT('Change Password');
    e:='';
    b:=True;
    While b do
    Begin
      if e<>'' then
      MessageDlg(e,mtError,mbOK);
      if F.ShowModal = mrOK then 
      Begin
        Try
          if TUgEdit(F.FindComponent('edOldPassWord')).Text = '' then
            RaiseException(UGMM.LT('Old password cannot be empty'));
          if TUgEdit(F.FindComponent('edNewPassWord1')).Text = '' then
            RaiseException(UGMM.LT('New password cannot be empty')); 
          if TUgEdit(F.FindComponent('edNewPassWord1')).Text <> TUgEdit(F.FindComponent('edNewPassWord2')).Text then
            RaiseException(UGMM.LT('The new password entered twice must be the same'));
          //修改密码
          UGMM.EditorPassWord(TUgEdit(F.FindComponent('edOldPassWord')).Text , TUgEdit(F.FindComponent('edNewPassWord1')).Text);
          MessageDlg(UGMM.LT('Note: The password has been changed successfully, please remember the new password'),mtWarning,mbOK);
          b:=False;
        Except{ExceptionMessage}
          e:=ExceptionMessage;
        end;
      end else
      b:=False;
    end;
  finally
    F.Free;
  end;
End;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Make sure to add code blocks to your code group
# 1.8. FileUpload
procedure FileUpload(path:string;singlemode: Boolean = False;maxfilesize: Integer = 50; fileexts: string = '*.*';filedesc: String = 'All files');
说明: 打开文件上传的对话框
- 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| path | 设定文件上传的目标目录地址 | 
| singlemode | 是否为单文件上传模式 | 
| maxfilesize | 设定上传文件的最大大小,超出限制的文件上传无效 | 
| fileexts | 设定上传的文件后缀名类型 | 
| filedesc | 设定目标文件 | 
- 示例
//JScript
function UGRunFrameOnAfterRunScript(sender){
  UGMM.FileUpload(UGSM.StartPath);
}
2
3
4
//PasScript
Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
Begin
  UGMM.FileUpload(UGSM.StartPath);
end;
2
3
4
5
// Make sure to add code blocks to your code group
# 1.9. GetAllMenuList
procedure GetAllMenuList(ACds:TClientDataSet;Const AType:String);
说明: 获取所有菜单列表
- 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
| AType | 指定菜单类型(Web或APP) | 
- 示例
//JScript
  //获取所有菜单列表
function UGRunFrameOnAfterRunScript(sender){
  UGMM.GetAllMenuList(cdsMenus,"WEB");
}
2
3
4
5
//PasScript
Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
Begin
  //获取所有菜单列表
  UGMM.GetAllMenuList(cdsMenus,'WEB');
end;
2
3
4
5
6
// Make sure to add code blocks to your code group
# 1.10. GetObjectEntrys
Procedure GetObjectEntrys(AObject:TObject;AEntrys:TStrings);
说明: 获取翻译词条
- GetObjectEntrys 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AObject | 指定需要需要获取翻译词条的窗体对象 | 
| AEntrys | 指定一个存储翻译词条的TStrings对象 | 
# 1.11. GetAllBeanList
procedure GetAllBeanList(ACds:TClientDataSet;Const AType:String);
说明: 获取所有Bean模块的列表
- GetAllBeanList 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
| AType | 指定获取的Bean模板类型,分为 WEB与APP两种 | 
- 示例
//JScript
UGMM.GetAllBeanList(cdsBeans,"WEB");
2
//PasScript
UGMM.GetAllBeanList(cdsBeans,'WEB');
2
// Make sure to add code blocks to your code group
# 1.12. GetAllRestApiList
procedure GetAllRestApiList(ACds:TClientDataSet);
说明: 获取所有接口列表
- GetAllRestApiList 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
- 示例
//JScript
function UGRunFrameOnAfterRunScript(sender){
  //获取所有API列表
  UGMM.GetAllRestApiList(cdsRestAPIs);
}
2
3
4
5
//PasScript
procedure UgWebRunFrameOnAfterRunScript(const sender: tobject);
Begin
  //获取所有API列表
  UGMM.GetAllRestApiList(cdsRestAPIs);
end;
2
3
4
5
6
// Make sure to add code blocks to your code group
# 1.13. GetAllSQLCommandList
procedure GetAllSQLCommandList(ACds:TClientDataSet);
说明:获取所有预设SQL信息至数据集。
- GetAllSQLCommandList 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
- 示例
//JScript
function UGRunFrameOnAfterRunScript(sender){
  //获取当前用户菜单列表
  UGMM.GetAllSQLCommandList(cdsSQLCommands);
}
2
3
4
5
//PasScript
Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
Begin
  //获取当前用户菜单列表
  UGMM.GetAllSQLCommandList(cdsSQLCommands);
end;
2
3
4
5
6
// Make sure to add code blocks to your code group
# 1.14. GetUserMenuList
procedure GetUserMenuList(ACds:TClientDataSet;Const AType:String);
说明: 获取当前用户菜单列表
- GetUserMenuList 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
| AType | 指定菜单类型(Web或APP) | 
- 示例
//JScript
function UGRunFrameOnAfterRunScript(sender){
  //获取当前用户菜单列表
  UGMM.GetUserMenuList(cdsMenus,"WEB");
}
2
3
4
5
//PasScript
Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
Begin
  //获取当前用户菜单列表
  UGMM.GetUserMenuList(cdsMenus,'WEB');
end;
2
3
4
5
6
// Make sure to add code blocks to your code group
# 1.15. GetDeveloperList
Procedure GetDeveloperList(ACds:TClientDataSet);
说明: 获取开发用户列表
- GetDeveloperList 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
- 示例
//JScript
function UGRunFrameOnAfterRunScript(sender){
  //获取开发用户列表
  UGMM.GetDeveloperList(cdsDeveloper);
}
2
3
4
5
//PasScript
Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
Begin
  //获取开发用户列表
  UGMM.GetDeveloperList(cdsDeveloper);
end;
2
3
4
5
6
// Make sure to add code blocks to your code group
# 1.16. GetAllFrameList
procedure GetAllFrameList(ACds:TClientDataSet;Const AType:String);
说明: 获取所有模块列表
- GetAllFrameList 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
| AType | 指定模块类型(Web或APP) | 
- 示例
//JScript
function UGRunFrameOnAfterRunScript(sender){
  //获取所有模块列表
  UGMM.GetAllFrameList(cdsFrame);
}
2
3
4
5
//PasScript
Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
Begin
  //获取所有模块列表
  UGMM.GetAllFrameList(cdsFrame);
end;
2
3
4
5
6
// Make sure to add code blocks to your code group
# 1.17. GetLanguages
Procedure GetLanguages(ACds:TClientDataSet);
说明: 获取语言列表
- GetLanguages 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
- 示例
//JScript
function UGRunFrameOnAfterRunScript(sender){
  //获取语言列表
  UGMM.GetAllFrameList(cdsLanguages);
}
2
3
4
5
//PasScript
Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
Begin
  //获取语言列表
  UGMM.GetAllFrameList(cdsLanguages);
end;
2
3
4
5
6
// Make sure to add code blocks to your code group
# 1.18. GetTranslations
Procedure GetTranslations(ACds:TClientDataSet);
说明: 获取翻译列表
- GetTranslations 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
- 示例
//JScript
function UGRunFrameOnAfterRunScript(sender){
  //获取翻译列表
  UGMM.GetAllFrameList(cdsTranslations);
}
2
3
4
5
//PasScript
Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
Begin
  //获取翻译列表
  UGMM.GetAllFrameList(cdsTranslations);
end;
2
3
4
5
6
// Make sure to add code blocks to your code group
# 1.19. GetUnits
Procedure GetUnits(ACds:TClientDataSet;AType:String);
说明: 获取公共单元列表
- GetUnits 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
| AType | 指定模块类型(Web或APP) | 
# 1.20. GetFramePerms
procedure GetFramePerms(ACds:TClientDataSet;AFrameGuid:String);
说明: 获取模块权限列表
- GetFramePerms 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
| AFrameGuid | 指定模块的唯一ID | 
# 1.21. GetAPIPerms
procedure GetAPIPerms(ACds:TClientDataSet);
说明: 获取API模块权限列表
- GetAPIPerms 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
- 示例
//JScript
function UGRunFrameOnAfterRunScript(sender){
  //获取翻译列表
  UGMM.GetAPIPerms(cdsAPIPerms);
}
2
3
4
5
//PasScript
Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
Begin
  //获取翻译列表
  UGMM.GetAPIPerms(cdsAPIPerms);
end;
2
3
4
5
6
// Make sure to add code blocks to your code group
# 1.22. GetRoles
procedure GetRoles(ACds:TClientDataSet;Const AQueryParams:TStringList = Nil);
说明: 获取角色列表
- GetRoles 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个数据集对象 | 
| AQueryParams | 指定参数列表 | 
# 1.23. GetRolePerms
Procedure GetRolePerms(ACds:TClientDataSet;ARoleGuid:String;Const AModeType:String = '');
说明: 获取角色权限列表,带树形
- AModeType 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个角色权限数据集对象 | 
| ARoleGuid | 指定一个角色唯一ID | 
| AModeType | 
# 1.24. GetSubClassList
procedure GetSubClassList(ACds:TClientDataSet);
说明: 获取下属部门列表
- GetSubClassList 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个下属部门列表数据集对象 | 
- 示例
//获取所有部门列表
  UGMM.GetClassList(cdsClass);
2
# 1.25. GetClassList
procedure GetClassList(ACds:TClientDataSet);//获取部门列表
说明: 获取部门列表
- GetClassList 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个部门列表数据集对象 | 
- 示例
//获取所有部门列表
  UGMM.GetClassList(cdsClass);
2
# 1.26. GetUsers
procedure GetUsers(ACds:TClientDataSet;Const AQueryParams:TStringList = Nil);
说明: 获取用户列表
- GetUsers 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个用户列表数据集对象 | 
| AQueryParams | 指定参数 | 
# 1.27. GetUserPerms
Procedure GetUserPerms(ACds:TClientDataSet;AUserGuid:String);
说明: 获取用户关联角色权限列表
- GetUserPerms 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个用户列表数据集对象 | 
| AUserGuid | 指定用户维一ID | 
# 1.28. GetPrintTemplate
Procedure GetPrintTemplate(ACds:TClientDataSet);
说明: 获取打印模板列表
- GetPrintTemplate 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ACds | 指定一个打印模板列表数据集对象 | 
- 示例
    //刷新模板列表
    UGMM.GetPrintTemplate(cdsPrintTemplate);
2
# 1.29. GetCurrentUserPerms
Procedure GetCurrentUserPerms; 
说明: 获取当前登陆用户权限
# 1.30. GetCurrentData
procedure GetCurrentData;
说明: 获取当前数据
# 1.31. LC
Procedure LC(AObject:TObject);
说明: 界面翻译
- LC 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AObject | 指定需要翻译的模块对象,一般指窗体 | 
- 示例
//JScript
function UGRunFrameOnAfterRunScript(sender){
  //翻译界面
  UGMM.LC(Self);
}
2
3
4
5
//PasScript
procedure UgWebRunFrameOnAfterRunScript(const sender: tobject);
Begin
  //翻译界面
  UGMM.LC(Self);
end;
2
3
4
5
6
// Make sure to add code blocks to your code group
# 1.32. OpenFileManager
Procedure OpenFileManager(Const AFrameGuid,AOrderCode:String;Const ACapacitySpace:int64 = 30 * 1024 * 1024;Const AIsEditor:Boolean = False);
说明:设置模块对象。
- SetBeanRecord 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AFrameGuid | 所属的主ID对象,对应会在文件上传目录下创建与ID同名的子文件夹 | 
| AOrderCode | 所属的主ID下的子ID对象,对应会在文件上传目录的主ID目录下,创建与子ID同名的文件夹 | 
| ACapacitySpace | 设定目录中允许上传的最大文件合计大小,以字节为单位 | 
| AIsEditor | 是否开启管理模式(是否允许上传,修改,删除文件) | 
- 示例
//JScript
UGMM.OpenFileManager("ABC","12123",1000000,true);
2
//PasScript
UGMM.OpenFileManager('ABC','12123',1000000,true);
2
// Make sure to add code blocks to your code group
打开的文件管理界面如下。

# 1.33. SetBeanObject
Procedure SetBeanObject(AGuid:String;AStream:TMemoryStream);
说明:设置模块对象。
- SetBeanRecord 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AGuid | Bean模块的Guid名称 | 
| AStream | 指定的内存流 | 
# 1.34. SetBeanRecord
Procedure SetBeanRecord(AList:TStringList);
说明:设置Bean模块的记录。
- SetBeanRecord 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AList | 指定列表 | 
- 示例
//JScript
l= new TStringList();
l.clear;
l.add("ActionType=Update");
l.add("Guid=" + TUgEdit(F.FindComponent("edGuid")).Text);
l.add("Group=" + TUgEdit(F.FindComponent("edGroup")).Text);
l.add("Code=" + TUgEdit(F.FindComponent("edCode")).Text);
l.add("Caption=" + TUgEdit(F.FindComponent("edCaption")).Text);
l.add("Ver=" + TUgEdit(F.FindComponent("edVer")).Text);
l.add("Developer=" + TUgEdit(F.FindComponent("edDeveloperGuid")).Text);
l.add("Type=WEB");
UGMM.SetBeanRecord(l);
cdsBeans.Append;
cdsBeans.FieldbyName("Guid").asString = l.Values["Guid"];
cdsBeans.FieldbyName("Group").asString = l.Values["Group"];
cdsBeans.FieldbyName("Code").asString = l.Values["Code"];
cdsBeans.FieldbyName("Caption").asString = l.Values["Caption"];
cdsBeans.FieldbyName("Ver").asString = l.Values["Ver"];
cdsBeans.FieldbyName("Developer").asString = TUgCombobox(F.FindComponent("edDeveloperGuid")).Text;
cdsBeans.FieldbyName("DeveloperUser").asString = TUgCombobox(F.FindComponent("edDeveloper")).Text;
cdsBeans.FieldbyName("Type").asString = l.Values["Type"];
cdsBeans.FieldbyName("CreateUser").asString = UGMM.Informations.Values["UserName"];
cdsBeans.FieldbyName("CreateTime").asDateTime = now;
cdsBeans.FieldbyName("EditorUser").asString = UGMM.Informations.Values["UserName"];
cdsBeans.FieldbyName("EditorTime").asDateTime = now;
cdsBeans.Post; 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//PasScript
l := TStringList.Create();
l.clear;
l.add('ActionType=Update');
l.add('Guid=' + TUgEdit(F.FindComponent('edGuid')).Text);
l.add('Group=' + TUgEdit(F.FindComponent('edGroup')).Text);
l.add('Code=' + TUgEdit(F.FindComponent('edCode')).Text);
l.add('Caption=' + TUgEdit(F.FindComponent('edCaption')).Text);
l.add('Ver=' + TUgEdit(F.FindComponent('edVer')).Text);
l.add('Developer=' + TUgEdit(F.FindComponent('edDeveloperGuid')).Text);
l.add('Type=WEB');
UGMM.SetBeanRecord(l);
cdsBeans.Append;
cdsBeans.FieldbyName('Guid').asString := l.Values['Guid'];
cdsBeans.FieldbyName('Group').asString := l.Values['Group'];
cdsBeans.FieldbyName('Code').asString := l.Values['Code'];
cdsBeans.FieldbyName('Caption').asString := l.Values['Caption'];
cdsBeans.FieldbyName('Ver').asString := l.Values['Ver'];
cdsBeans.FieldbyName('Developer').asString := TUgCombobox(F.FindComponent('edDeveloperGuid')).Text;
cdsBeans.FieldbyName('DeveloperUser').asString := TUgCombobox(F.FindComponent('edDeveloper')).Text;
cdsBeans.FieldbyName('Type').asString := l.Values['Type'];
cdsBeans.FieldbyName('CreateUser').asString := UGMM.Informations.Values['UserName'];
cdsBeans.FieldbyName('CreateTime').asDateTime := now;
cdsBeans.FieldbyName('EditorUser').asString := UGMM.Informations.Values['UserName'];
cdsBeans.FieldbyName('EditorTime').asDateTime := now;
cdsBeans.Post; 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Make sure to add code blocks to your code group
# 1.35. SetPrintTemplate
Procedure SetPrintTemplate(AGuid,ATemplateName,ATemplateData,APrintData:String);
说明: 设置打印模板列表
- SetPrintTemplate 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AGuid | 指定打印模板维一ID | 
| ATemplateName | 指定打印模板名称 | 
| ATemplateData | 指定打印模板数据 | 
| APrintData | 指定打印数据 | 
- 示例
//JScript
function btAppendOnClick(Sender)
{
  var F,b,l,e;
  F=GetEditorForm;
  l= new TStringList();
  Try{
    F.Caption = UGMM.LT("Add template name");
    UGMM.LC(f);
    TUgEdit(F.FindComponent("edGuid")).Text = UGMM.CreateGuid;
    TUgMemo(F.FindComponent("edPrintData")).Lines.Text = "var printData = {};";
    e="";
    b=True;
    While (b)
    {
      if (e!="")
      MessageDlg(e,mtError,mbOK);
      if (F.ShowModal == mrOK) 
      {
        Try{
          if (Trim(TUgEdit(F.FindComponent("edTemplateName")).Text) == "") 
            RaiseException(UGMM.LT("Template name cannot be empty"));
            UGMM.SetPrintTemplate(TUgEdit(F.FindComponent("edGuid")).Text,TUgEdit(F.FindComponent("edTemplateName")).Text,"",TUgMemo(F.FindComponent("edPrintData")).Lines.Text); 
          b = False;
        }
        Except{RaiseException(ExceptionMessage);}
        }
      else{
        b=False;
        }
      }
    }  
  Finally{
    l.Free;
    F.Free;
    //刷新模板列表
    UGMM.GetPrintTemplate(cdsPrintTemplate);
  }
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//PasScript
Procedure btAppendOnClick(Sender: TObject);
Var
  F:TUgWebForm;
  b:Boolean;
  l:TStringList;
  e:string;
Begin
  F:=GetEditorForm;
  l:=TStringList.Create;
  Try
    F.Caption := 'Add template name';
    UGMM.LC(f);
    TUgEdit(F.FindComponent('edGuid')).Text := UGMM.CreateGuid;
    TUgMemo(F.FindComponent('edPrintData')).Lines.Text := 'var printData = {};';
    e:='';
    b:=True;
    While b do
    Begin
      if e<>'' then
      MessageDlg(e,mtError,mbOK);
      if F.ShowModal = mrOK then 
      Begin
        Try
          if Trim(TUgEdit(F.FindComponent('edTemplateName')).Text) = '' then
            RaiseException(UGMM.LT('Template name cannot be empty'));
            UGMM.SetPrintTemplate(TUgEdit(F.FindComponent('edGuid')).Text,TUgEdit(F.FindComponent('edTemplateName')).Text,'',TUgMemo(F.FindComponent('edPrintData')).Lines.Text); 
          b := False;
        Except{ExceptionMessage}
          e:=ExceptionMessage;
        end;
      End else
        b:=False;
    End;
  Finally
    l.Free;
    F.Free;
    //刷新模板列表
    UGMM.GetPrintTemplate(cdsPrintTemplate);
  End;
End;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Make sure to add code blocks to your code group
# 1.36. SetFrameRecord
Procedure SetFrameRecord(AList:TStringList);
说明: 设置模块记录
- SetFrameRecord 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AList | 
# 1.37. SetFrameRecord
Procedure SetFrameObject(AGuid:String;AStrame:TMemoryStream);
说明: 设置模块对象
- SetFrameRecord 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AGuid | |
| AStrame | 
# 1.38. SetMenuItem
Procedure SetMenuItem(AList:TStringList);
说明: 设置菜单节点
- 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AList | 指定菜点节点TStringList对象 | 
- 示例
//JScript
//删除
function btDeleteOnClick(Sender)
{
  var l,k,c,g,p,i;
 if (cdsMenus.FieldbyName("Guid").asString == cRoot) then
  RaiseException(UGMM.LT("Disable deletion of menu root node"));
  
//当前节点唯一地址
  g = cdsMenus.FieldByName("Guid").AsString;
  //当前节点上级地址
  p = cdsMenus.FieldByName("Parent").AsString;
  //获取当前节点的下级节点数
  c = CurrentCount(g);
  //获取当前节点的索引值
  i = CurrentIndex(p,g);
  //判断是否有下级字段
  if (c > 0)
  RaiseException(UGMM.LT("Cannot delete records with subordinate nodes"));
  
  l= new TStringList();
  Try{
    if (MessageDlg(UGMM.LT("Whether to delete the menu node"),mtWarning,mbYes + mbNo) == mrYes) 
    {
      l.add("ActionType=Delete");
      l.add("Guid=" + cdsMenus.FieldbyName("Guid").asString);
      UGMM.SetMenuItem(l); 
      cdsMenus.Delete;
      //获取上级级节点数
      c = CurrentCount(g);
      //记忆删除后的游标
      k=cdsMenus.RecNo;
      //更新下层节点排序列
      while (!cdsMenus.Eof)
      {
        if (p == cdsMenus.FieldByName("Parent").AsString)
        {
          l.Clear;
          l.Add("ActionType=Update");
          l.Add("Guid=" + cdsMenus.FieldByName("Guid").AsString);
          l.Add("Serial=" + p + "_" + Format("%.5d", [iif(c==1,0,i)]));
          cdsMenus.Edit;
          cdsMenus.FieldByName("Serial").AsString = p + "_" + Format("%.5d", [iif(c==1,0,i)]);
          cdsMenus.Post;
          UGMM.SetMenuItem(l);
          i = i + 1;
        }
        else{
          Break;//终止
        }
        cdsMenus.Next;
      }
      cdsMenus.RecNo=k;
      TreeMenus.Refresh;
      RefButtons;
    }
  }
  Finally{
    l.Free; 
  }
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//PasScript
//删除
Procedure btDeleteOnClick(Sender: TObject);
Var
  l:TStringList;
  k:Integer;
  c:Integer;
  g:string;
  p:string;
  i:Integer;
Begin
  if cdsMenus.FieldbyName('Guid').asString = cRoot then
  RaiseException(UGMM.LT('Disable deletion of menu root node'));
  
//当前节点唯一地址
  g := cdsMenus.FieldByName('Guid').AsString;
  //当前节点上级地址
  p := cdsMenus.FieldByName('Parent').AsString;
  //获取当前节点的下级节点数
  c := CurrentCount(g);
  //获取当前节点的索引值
  i := CurrentIndex(p,g);
  //判断是否有下级字段
  if c > 0 then
  RaiseException(UGMM.LT('Cannot delete records with subordinate nodes'));
  
  l:=TStringList.Create;
  Try
    if MessageDlg(UGMM.LT('Whether to delete the menu node'),mtWarning,mbYes + mbNo) = mrYes then
    Begin
      l.add('ActionType=Delete');
      l.add('Guid=' + cdsMenus.FieldbyName('Guid').asString);
      UGMM.SetMenuItem(l); 
      cdsMenus.Delete;
      //记忆删除后的游标
      k:=cdsMenus.RecNo;
      //更新下层节点排序列
      while Not cdsMenus.Eof do
      Begin
        if p = cdsMenus.FieldByName('Parent').AsString then
        begin
          l.Clear;
          l.Add('ActionType=Update');
          l.Add('Guid=' + cdsMenus.FieldByName('Guid').AsString);
          l.Add('Serial=' + p + '_' + Format('%.5d', [i]));
          cdsMenus.Edit;
          cdsMenus.FieldByName('Serial').AsString := p + '_' + Format('%.5d', [i]);
          cdsMenus.Post;
          UGMM.SetMenuItem(l);
          i := i + 1;
        end else
          Break;//终止
        cdsMenus.Next;
      End;
      cdsMenus.RecNo:=k;
      TreeMenus.Refresh;
      RefButtons;
    end;
  Finally
    l.Free; 
  end;
End;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Make sure to add code blocks to your code group
# 1.39. SetFramePrems
procedure SetFramePrems(AList:TStringList);
说明: 设置模块权限
- SetFramePrems 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AList | 指定模块权限内容TStringList对象 | 
# 1.40. SetLanguages
Procedure SetLanguages(AList:TStringList);
说明: 设置语言列表
- SetLanguages 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AList | 指定语言列表内容 TStringList 对象 | 
# 1.41. SetUnits
Procedure SetUnits(AGuid,ActionType,AUnitName,AType:String;AStrame:TMemoryStream);
说明: 设置公共单元
- SetUnits 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AGuid | |
| ActionType | |
| AUnitName | |
| AType | |
| AStrame | 
# 1.42. SetTranslations
Procedure SetTranslations(AList:TStringList);
说明: 设置翻译列表
- SetTranslations 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AList | 指定翻译列表内容 TStringList 对象 | 
# 1.43. SetAPIPrems
procedure SetAPIPrems(AList:TStringList);
说明: 设置API权限
- SetAPIPrems 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AList | 指定API权限内容TStringList对象 | 
# 1.44. SetRoles
Procedure SetRoles(ARoles,APermGuids,ATypes:TStringList);
说明: 设置角色
- SetRoles 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ARoles | 指定角色内容TStringList对象 | 
| APermGuids | 指定权限内容TStringList对象 | 
| ATypes | 指定类型内容TStringList对象 | 
- 示例
//JScript
//{修改}
function btEditorOnClick(Sender)
{
  cdsRoles.Edit;
  RefState(tyEditor);
}
//{保存}
function btSaveOnClick(Sender)
{
  var t,r,p,o;
  if (Trim(cdsRoles.FieldByName("RoleName").AsString) == "")
  RaiseException(UGMM.LT("Role name cannot be empty"));
  
  r = new TStringList();
  p = new TStringList();
  o = new TStringList();
  Try{
    t = now;
    //数据集初始化
    if (cdsRoles.FieldByName("CreateUser").IsNull)
    {
      cdsRoles.FieldByName("CreateUser").AsString   = UGMM.Informations.Values["UserName"];
      cdsRoles.FieldByName("CreateTime").AsDateTime = t;
    }    
    cdsRoles.FieldByName("EditorUser").AsString   = UGMM.Informations.Values["UserName"];
    cdsRoles.FieldByName("EditorTime").AsDateTime = t;
    //角色列表
    r.UGValues["ActionType"]  = "Update";
    r.UGValues["Guid"]        = cdsRoles.FieldByName("Guid").AsString;
    r.UGValues["RoleName"]    = cdsRoles.FieldByName("RoleName").AsString;
    r.UGValues["RoleExplain"] = cdsRoles.FieldByName("RoleExplain").AsString;
    r.UGValues["EditorUser"]  = cdsRoles.FieldByName("EditorUser").AsString;
    r.UGValues["EditorTime"]  = cdsRoles.FieldByName("EditorTime").AsString;
    r.UGValues["CreateUser"]  = cdsRoles.FieldByName("CreateUser").AsString;
    r.UGValues["CreateTime"]  = cdsRoles.FieldByName("CreateTime").AsString;
    //角色权限
    cdsRolePerms.First;
    While (!cdsRolePerms.Eof)
    {
      if ((cdsRolePerms.FieldByName("Type").AsString != "Root") 
      && (cdsRolePerms.FieldByName("PermCheck").AsBoolean)
      && (CurrentCount(cdsRolePerms.FieldbyName("Guid").AsString) == 0))
      {
        p.Add(cdsRolePerms.FieldbyName("Guid").AsString);
        o.Add(cdsRolePerms.FieldByName("Type").AsString);
      }
      cdsRolePerms.Next;
    }
    //提交
    UGMM.SetRoles(r,p,o);
    ShowMessage(UGMM.LT("Data saved successfully"));
    //OpenFrom(r.UGValues["Guid"]);
    RefState(tyView);
  }
  Finally{
    r.Free;
    p.Free;
    o.Free;
    }
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//PasScript
Procedure btEditorOnClick(Sender: TObject);
Begin
  cdsRoles.Edit;
  RefState(tyEditor);
End;
{保存}
Procedure btSaveOnClick(Sender: TObject);
Var
  t:TDateTime;
  r:TStringList;
  p:TStringList;
  o:TStringList;
Begin
  if Trim(cdsRoles.FieldByName('RoleName').AsString) = '' then
  RaiseException(UGMM.LT('Role name cannot be empty'));
  
  r := TStringList.Create;
  p := TStringList.Create;
  o := TStringList.Create;
  Try
    t := now;
    //数据集初始化
    if cdsRoles.FieldByName('CreateUser').IsNull then
    Begin
    cdsRoles.FieldByName('CreateUser').AsString   := UGMM.Informations.Values['UserName'];
    cdsRoles.FieldByName('CreateTime').AsDateTime := t;
    End;    
    cdsRoles.FieldByName('EditorUser').AsString   := UGMM.Informations.Values['UserName'];
    cdsRoles.FieldByName('EditorTime').AsDateTime := t;
    //角色列表
    r.UGValues['ActionType']  := 'Update';
    r.UGValues['Guid']        := cdsRoles.FieldByName('Guid').AsString;
    r.UGValues['RoleName']    := cdsRoles.FieldByName('RoleName').AsString;
    r.UGValues['RoleExplain'] := cdsRoles.FieldByName('RoleExplain').AsString;
    r.UGValues['EditorUser']  := cdsRoles.FieldByName('EditorUser').AsString;
    r.UGValues['EditorTime']  := cdsRoles.FieldByName('EditorTime').AsString;
    r.UGValues['CreateUser']  := cdsRoles.FieldByName('CreateUser').AsString;
    r.UGValues['CreateTime']  := cdsRoles.FieldByName('CreateTime').AsString;
    //角色权限
    cdsRolePerms.First;
    While Not cdsRolePerms.Eof do
    Begin
      if (cdsRolePerms.FieldByName('Type').AsString <> 'Root') 
      and(cdsRolePerms.FieldByName('PermCheck').AsBoolean)
      and(CurrentCount(cdsRolePerms.FieldbyName('Guid').AsString) = 0) then
      Begin
        p.Add(cdsRolePerms.FieldbyName('Guid').AsString);
        o.Add(cdsRolePerms.FieldByName('Type').AsString);
      end;
      cdsRolePerms.Next;
    End;
    //提交
    UGMM.SetRoles(r,p,o);
    ShowMessage(UGMM.LT('Data saved successfully'));
    //OpenFrom(r.UGValues['Guid']);
    RefState(tyView);
  Finally
    r.Free;
    p.Free;
    o.Free;
  End;
End;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Make sure to add code blocks to your code group
# 1.45. SetSQLCommandRecord
Procedure SetSQLCommandRecord(AList:TStringList);
说明: 设置预设SQL记录
- SetSQLCommandRecord 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AList | 设置字符串 | 
//JScript
{
  //实现功能的代码片段
  l.clear;
  l.add("ActionType=Update");
  l.add("Guid=" + TUgEdit(F.FindComponent("edGuid")).Text);
  l.add("SQLCommandId=" + TUgEdit(F.FindComponent("edSQLCommandId")).Text);
  l.add("Description=" + TUgEdit(F.FindComponent("edDescription")).Text);
  l.add("ConnectionDefName=" + TUgCombobox(F.FindComponent("edConnectionDefName")).Text);    
  l.Add("SQLCommand=" + TUGMemo(F.FindComponent("edSQLCommand")).Lines.Text);
  //提交数据
  UGMM.SetSQLCommandRecord(l);
  //...
}
2
3
4
5
6
7
8
9
10
11
12
13
14
//PasScript
  //实现功能的代码片段
  l.clear;
  l.add('ActionType=Update');
  l.add('Guid=' + TUgEdit(F.FindComponent('edGuid')).Text);
  l.add('SQLCommandId=' + TUgEdit(F.FindComponent('edSQLCommandId')).Text);
  l.add('Description=' + TUgEdit(F.FindComponent('edDescription')).Text);
  l.add('ConnectionDefName=' + TUgCombobox(F.FindComponent('edConnectionDefName')).Text);    
  l.Add('SQLCommand=' + TUGMemo(F.FindComponent('edSQLCommand')).Lines.Text);
  //提交数据
  UGMM.SetSQLCommandRecord(l);
  //...
2
3
4
5
6
7
8
9
10
11
12
// Make sure to add code blocks to your code group
# 1.46. SetUser
Procedure SetUser(AUsers,ARoleGuids:TStringList);
说明: 设置用户
- SetUser 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AUsers | 指定用户内容TStringList对象 | 
| ARoleGuids | 指定角色内容TStringList对象 | 
- 示例
//JScript
function btEditorOnClick(Sender)
{
  cdsUser.Edit;
  RefState(tyEditor);
}
//{保存}
function btSaveOnClick(Sender)
//var
//  t:TDateTime;
//  r:TStringList;
//  p:TStringList;
{
  var t,r,p;
  if (Trim(cdsUser.FieldByName("UserName").AsString) == "")
  RaiseException(UGMM.LT("Username cannot be empty"));
  
  if (Trim(cdsUser.FieldByName("ClassGuid").AsString) == "")
  RaiseException(UGMM.LT("Department cannot be empty"));
  
  r = new TStringList();
  p = new TStringList();
  Try{
    t = now;
    //数据集初始化
    if (cdsUser.FieldByName("CreateUser").IsNull)
    {
      cdsUser.FieldByName("CreateUser").AsString   = UGMM.Informations.Values["UserName"];
      cdsUser.FieldByName("CreateTime").AsDateTime = t;
    }    
    cdsUser.FieldByName("EditorUser").AsString   = UGMM.Informations.Values["UserName"];
    cdsUser.FieldByName("EditorTime").AsDateTime = t;
    //角色列表
    r.UGValues["ActionType"]          = "Update";
    r.UGValues["Guid"]                = cdsUser.FieldByName("Guid").AsString;
    r.UGValues["UserName"]            = cdsUser.FieldByName("UserName").AsString;
    r.UGValues["PassWord"]            = cdsUser.FieldByName("PassWord").AsString;
    r.UGValues["FullName"]            = cdsUser.FieldByName("FullName").AsString;
    r.UGValues["ClassGuid"]           = cdsUser.FieldByName("ClassGuid").AsString;
    r.UGValues["AllowLandingType"]    = cdsUser.FieldByName("AllowLandingType").AsString;
    r.UGValues["AllowEditorPassWord"] = cdsUser.FieldByName("AllowEditorPassWord").AsString;
    r.UGValues["ConnectionTimedOut"]  = cdsUser.FieldByName("ConnectionTimedOut").AsString;
    r.UGValues["EnclosureMaxSize"]    = cdsUser.FieldByName("EnclosureMaxSize").AsString;
    r.UGValues["EditorUser"]          = cdsUser.FieldByName("EditorUser").AsString;
    r.UGValues["EditorTime"]          = cdsUser.FieldByName("EditorTime").AsString;
    r.UGValues["CreateUser"]          = cdsUser.FieldByName("CreateUser").AsString;
    r.UGValues["CreateTime"]          = cdsUser.FieldByName("CreateTime").AsString;
    r.UGValues["AllowImagesGallery"]  = cdsUser.FieldByName("AllowImagesGallery").asString;
    //角色权限
    cdsUserPerms.First;
    While (!cdsUserPerms.Eof)
    {
      if (cdsUserPerms.FieldByName("Check").AsBoolean)
      p.Add(cdsUserPerms.FieldbyName("RoleGuid").AsString);
      cdsUserPerms.Next;
    }
    //提交
    UGMM.SetUser(r,p);
    ShowMessage(UGMM.LT("Data saved successfully"));
    vGuid=r.UGValues["Guid"];
    //OpenFrom(r.UGValues["Guid"]);
    RefState(tyView);
  }
  Finally{
    r.Free;
    p.Free;
  }
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//PasScript
Procedure btEditorOnClick(Sender: TObject);
Begin
  cdsUser.Edit;
  RefState(tyEditor);
End;
{保存}
Procedure btSaveOnClick(Sender: TObject);
Var
  t:TDateTime;
  r:TStringList;
  p:TStringList;
Begin
  if Trim(cdsUser.FieldByName('UserName').AsString) = '' then
  RaiseException(UGMM.LT('Username cannot be empty'));
  
  if Trim(cdsUser.FieldByName('ClassGuid').AsString) = '' then
  RaiseException(UGMM.LT('Department cannot be empty'));
  
  r := TStringList.Create;
  p := TStringList.Create;
  Try
    t := now;
    //数据集初始化
    if cdsUser.FieldByName('CreateUser').IsNull then
    Begin
    cdsUser.FieldByName('CreateUser').AsString   := UGMM.Informations.Values['UserName'];
    cdsUser.FieldByName('CreateTime').AsDateTime := t;
    End;    
    cdsUser.FieldByName('EditorUser').AsString   := UGMM.Informations.Values['UserName'];
    cdsUser.FieldByName('EditorTime').AsDateTime := t;
    //角色列表
    r.UGValues['ActionType']          := 'Update';
    r.UGValues['Guid']                := cdsUser.FieldByName('Guid').AsString;
    r.UGValues['UserName']            := cdsUser.FieldByName('UserName').AsString;
    r.UGValues['PassWord']            := cdsUser.FieldByName('PassWord').AsString;
    r.UGValues['FullName']            := cdsUser.FieldByName('FullName').AsString;
    r.UGValues['ClassGuid']           := cdsUser.FieldByName('ClassGuid').AsString;
    r.UGValues['AllowLandingType']    := cdsUser.FieldByName('AllowLandingType').AsString;
    r.UGValues['AllowEditorPassWord'] := cdsUser.FieldByName('AllowEditorPassWord').AsString;
    r.UGValues['ConnectionTimedOut']  := cdsUser.FieldByName('ConnectionTimedOut').AsString;
    r.UGValues['EnclosureMaxSize']    := cdsUser.FieldByName('EnclosureMaxSize').AsString;
    r.UGValues['EditorUser']          := cdsUser.FieldByName('EditorUser').AsString;
    r.UGValues['EditorTime']          := cdsUser.FieldByName('EditorTime').AsString;
    r.UGValues['CreateUser']          := cdsUser.FieldByName('CreateUser').AsString;
    r.UGValues['CreateTime']          := cdsUser.FieldByName('CreateTime').AsString;
    r.UGValues['AllowImagesGallery']  := cdsUser.FieldByName('AllowImagesGallery').asString;
    //角色权限
    cdsUserPerms.First;
    While Not cdsUserPerms.Eof Do
    Begin
      if cdsUserPerms.FieldByName('Check').AsBoolean Then
      p.Add(cdsUserPerms.FieldbyName('RoleGuid').AsString);
      cdsUserPerms.Next;
    End;
    //提交
    UGMM.SetUser(r,p);
    ShowMessage(UGMM.LT('Data saved successfully'));
    vGuid:=r.UGValues['Guid'];
    //OpenFrom(r.UGValues['Guid']);
    RefState(tyView);
    
  Finally
    r.Free;
    p.Free;
  End;
End;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Make sure to add code blocks to your code group
# 1.47. SetDataNodes
Procedure SetDataNodes(AGuid,ANodeName,ALinkText:String;APoopCleanupTimeout,APoopExpireTimeout,APoopMaximumItems:Integer;APooled,AllowFrameworkAccess:Boolean);
说明: 设置数据库节点列表
- SetDataNodes 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AGuid | 指定节点数据库的维一ID | 
| ANodeName | 指定节点数据库的名称 | 
| ALinkText | 指定节点数据库套接字内容 | 
| APoopCleanupTimeout | 指定池清理时间 | 
| APoopExpireTimeout | 指定池超时时间 | 
| APoopMaximumItems | 指定池最大连接数 | 
| APooled | 指定是否开启数据池功能(True=是/False=否) | 
| AllowFrameworkAccess | 指定是否支持二层模式(True=是/False=否) | 
- 示例
//JScript
//修改
function btEditorOnClick(sender)
//var
//  F:TUgWebForm;
//  b:Boolean;
//  e:string;
//  m : TMemoryStream;
{
  var F,b,e,m;
  if (cdsDataNodes.IsEmpty)
  RaiseException(UGMM.LT("No record can't be modified"));
  
  f = GetEditorForm;
  m = new TMemoryStream();
  Try{
    F.Caption = UGMM.LT("Modify data node");
    TUgEdit(F.FindComponent("edGuid")).Text   = cdsDataNodes.FieldByName("Guid").AsString;
    TUgEdit(F.FindComponent("edNodeName")).Text = cdsDataNodes.FieldByName("NodeName").AsString;
    m.Clear;
    Tblobfield(cdsDataNodes.FieldByName("LinkText")).SaveToStream(m);
    m.Position=0;
    TUgMemo(F.FindComponent("edLinkText")).Lines.LoadFromStream(m);
    TUgSpinEdit(F.FindComponent("edPoopCleanupTimeout")).Value = cdsDataNodes.FieldByName("PoopCleanupTimeout").AsInteger;
    TUgSpinEdit(F.FindComponent("edPoopExpireTimeout")).Value = cdsDataNodes.FieldByName("PoopExpireTimeout").AsInteger;
    TUgSpinEdit(F.FindComponent("edPoopMaximumItems")).Value = cdsDataNodes.FieldByName("PoopMaximumItems").AsInteger;
    TUgComboBox(F.FindComponent("edPooled")).Text = cdsDataNodes.FieldByName("Pooled").AsString;
    TUgComboBox(F.FindComponent("edAllowFrameworkAccess")).Text = cdsDataNodes.FieldByName("AllowFrameworkAccess").AsString;
    e="";
    b=True;
    While (b)
    {
      if (e!="")
      MessageDlg(e,mtError,mbOK);
      if (F.ShowModal == mrOK) 
      {
        Try{
          //验证数据
          if (Trim(TUgEdit(F.FindComponent("edNodeName")).Text) == "")
            RaiseException(UGMM.LT("Node name cannot be empty"));
          //保存到本地库  
          UGMM.SetDataNodes(TUgEdit(F.FindComponent("edGuid")).Text,
                            TUgEdit(F.FindComponent("edNodeName")).Text,
                            TUgMemo(F.FindComponent("edLinkText")).Lines.Text,
                            TUgSpinEdit(F.FindComponent("edPoopCleanupTimeout")).Value,
                            TUgSpinEdit(F.FindComponent("edPoopExpireTimeout")).Value,
                            TUgSpinEdit(F.FindComponent("edPoopMaximumItems")).Value,
                            StrToBoolDef(TUgComboBox(F.FindComponent("edPooled")).Text,False),
                            StrToBoolDef(TUgComboBox(F.FindComponent("edAllowFrameworkAccess")).Text,False));
          //保存到内存表
          cdsDataNodes.Edit;
          cdsDataNodes.FieldByName("NodeName").AsString = TUgEdit(F.FindComponent("edNodeName")).Text;
          m.Clear;
          TUgMemo(F.FindComponent("edLinkText")).Lines.SaveToStream(m);
          m.Position=0;
          Tblobfield(cdsDataNodes.FieldByName("LinkText")).LoadFromStream(m);
          cdsDataNodes.FieldByName("Pooled").AsBoolean = StrToBoolDef(TUgComboBox(F.FindComponent("edPooled")).Text,False);
          cdsDataNodes.FieldByName("AllowFrameworkAccess").AsBoolean = StrToBoolDef(TUgComboBox(F.FindComponent("edAllowFrameworkAccess")).Text,False);
          cdsDataNodes.FieldByName("PoopCleanupTimeout").AsInteger = TUgSpinEdit(F.FindComponent("edPoopCleanupTimeout")).Value;
          cdsDataNodes.FieldByName("PoopExpireTimeout").AsInteger = TUgSpinEdit(F.FindComponent("edPoopExpireTimeout")).Value;
          cdsDataNodes.FieldByName("PoopMaximumItems").AsInteger = TUgSpinEdit(F.FindComponent("edPoopMaximumItems")).Value;
          cdsDataNodes.FieldByName("EditorUser").AsString          = UGMM.Informations.Values["UserName"];
          cdsDataNodes.FieldByName("EditorTime").AsDateTime        = Now;
          cdsDataNodes.Post;
        }
        Except{
          RaiseException(ExceptionMessage);
        }
      }
      else{
        b=False;
      }
    }
  }
  Finally{
    m.Free;
    f.Free;
  }
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//PasScript
procedure btEditorOnClick(sender: tobject);
Var
  F:TUgWebForm;
  b:Boolean;
  e:string;
  m : TMemoryStream;
begin
  if cdsDataNodes.IsEmpty then
  RaiseException(UGMM.LT('No record can''t be modified'));
  
  f := GetEditorForm;
  m := TMemoryStream.Create;
  Try
    F.Caption := UGMM.LT('Modify data node');
    TUgEdit(F.FindComponent('edGuid')).Text   := cdsDataNodes.FieldByName('Guid').AsString;
    TUgEdit(F.FindComponent('edNodeName')).Text := cdsDataNodes.FieldByName('NodeName').AsString;
    Tblobfield(cdsDataNodes.FieldByName('LinkText')).SaveToStream(m);
    m.Position:=0;
    TUgMemo(F.FindComponent('edLinkText')).Lines.LoadFromStream(m);
    TUgSpinEdit(F.FindComponent('edPoopCleanupTimeout')).Value := cdsDataNodes.FieldByName('PoopCleanupTimeout').AsInteger;
    TUgSpinEdit(F.FindComponent('edPoopExpireTimeout')).Value := cdsDataNodes.FieldByName('PoopExpireTimeout').AsInteger;
    TUgSpinEdit(F.FindComponent('edPoopMaximumItems')).Value := cdsDataNodes.FieldByName('PoopMaximumItems').AsInteger;
    TUgComboBox(F.FindComponent('edPooled')).Text := cdsDataNodes.FieldByName('Pooled').AsString;
    TUgComboBox(F.FindComponent('edAllowFrameworkAccess')).Text := cdsDataNodes.FieldByName('AllowFrameworkAccess').AsString;
    e:='';
    b:=True;
    While b do
    Begin
      if e<>'' then
      MessageDlg(e,mtError,mbOK);
      if F.ShowModal = mrOK then 
      Begin
        Try
          //验证数据
          if Trim(TUgEdit(F.FindComponent('edNodeName')).Text) = '' then
            RaiseException(UGMM.LT('Node name cannot be empty'));
          //保存到本地库  
          UGMM.SetDataNodes(TUgEdit(F.FindComponent('edGuid')).Text,
                            TUgEdit(F.FindComponent('edNodeName')).Text,
                            TUgMemo(F.FindComponent('edLinkText')).Lines.Text,
                            TUgSpinEdit(F.FindComponent('edPoopCleanupTimeout')).Value,
                            TUgSpinEdit(F.FindComponent('edPoopExpireTimeout')).Value,
                            TUgSpinEdit(F.FindComponent('edPoopMaximumItems')).Value,
                            StrToBoolDef(TUgComboBox(F.FindComponent('edPooled')).Text,False),
                            StrToBoolDef(TUgComboBox(F.FindComponent('edAllowFrameworkAccess')).Text,False));
          //保存到内存表
          cdsDataNodes.Edit;
          cdsDataNodes.FieldByName('NodeName').AsString := TUgEdit(F.FindComponent('edNodeName')).Text;
          TUgMemo(F.FindComponent('edLinkText')).Lines.SaveToStream(m);
          m.Position:=0;
          Tblobfield(cdsDataNodes.FieldByName('LinkText')).LoadFromStream(m);
          cdsDataNodes.FieldByName('Pooled').AsBoolean := StrToBoolDef(TUgComboBox(F.FindComponent('edPooled')).Text,False);
          cdsDataNodes.FieldByName('AllowFrameworkAccess').AsBoolean := StrToBoolDef(TUgComboBox(F.FindComponent('edAllowFrameworkAccess')).Text,False);
          cdsDataNodes.FieldByName('PoopCleanupTimeout').AsInteger := TUgSpinEdit(F.FindComponent('edPoopCleanupTimeout')).Value;
          cdsDataNodes.FieldByName('PoopExpireTimeout').AsInteger := TUgSpinEdit(F.FindComponent('edPoopExpireTimeout')).Value;
          cdsDataNodes.FieldByName('PoopMaximumItems').AsInteger := TUgSpinEdit(F.FindComponent('edPoopMaximumItems')).Value;
          cdsDataNodes.FieldByName('EditorUser').AsString          := UGMM.Informations.Values['UserName'];
          cdsDataNodes.FieldByName('EditorTime').AsDateTime        := Now;
          cdsDataNodes.Post;
        Except
          e:=ExceptionMessage;
        End;
      End Else
        b:=False;
    End;
  Finally
    m.Free;
    f.Free;
  End;
end;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Make sure to add code blocks to your code group
# 1.48. SetClassItem
Procedure SetClassItem(AList:TStringList);
说明: 设置部门节点
- SetClassItem 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AList | 指定一个部门节点TStringList对象 | 
- 示例
//JScript
//添加
function btAppendOnClick(sender)
{
  var F,b,l,e,c;
  F=GetEditorForm;
  l= new TStringList();
  Try{
    F.Caption = UGMM.LT("Add department");
    TUgEdit(F.FindComponent("edGuid")).Text   = UGMM.CreateGuid;
    TUgEdit(F.FindComponent("edParent")).Text = cdsClass.FieldbyName("Guid").AsString; 
    c = CurrentCount(cdsClass.FieldByName("Guid").AsString);
    e="";
    b=True;
    While (b)
    {
      if (e !="")
      MessageDlg(e,mtError,mbOK);
      if (F.ShowModal == mrOK) 
      {
        Try{
          if (Trim(TUgEdit(F.FindComponent("edClassName")).Text) == "")
            RaiseException(UGMM.LT("Department name cannot be empty"));
          l.Clear;
          l.add("ActionType=Update");
          l.add("Guid=" + TUgEdit(F.FindComponent("edGuid")).Text);
          l.add("ClassName=" + TUgEdit(F.FindComponent("edClassName")).Text);
          l.add("ClassExplain=" + TUgEdit(F.FindComponent("edClassExplain")).Text);
          l.add("Parent=" + TUgEdit(F.FindComponent("edParent")).Text);
          l.add("Serial=" + TUgEdit(F.FindComponent("edParent")).Text + "_" + Format("%.5d", [c]));
          UGMM.SetClassItem(l);
          cdsClass.Append;
          cdsClass.FieldbyName("Guid").asString = l.Values["Guid"];
          cdsClass.FieldbyName("ClassName").asString = l.Values["ClassName"];
          cdsClass.FieldbyName("ClassExplain").asString = l.Values["ClassExplain"];
          cdsClass.FieldbyName("Parent").asString = l.Values["Parent"];
          cdsClass.FieldbyName("Serial").asString = l.Values["Serial"];
          cdsClass.Post;
          b = False;
          treeClass.Refresh;
          RefButtons;
        }
        Except{RaiseException(ExceptionMessage);}
        }
      else{
        b=False;
        }
      }
    }
  Finally{
    l.Free;
    F.Free;
    }
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//PasScript
Procedure btAppendOnClick(Sender: TObject);
Var
  F:TUgWebForm;
  b:Boolean;
  l:TStringList;
  e:string;
  c:Integer;
Begin
  F:=GetEditorForm;
  l:=TStringList.Create;
  Try
    F.Caption := UGMM.LT('Add department');
    TUgEdit(F.FindComponent('edGuid')).Text   := UGMM.CreateGuid;
    TUgEdit(F.FindComponent('edParent')).Text := cdsClass.FieldbyName('Guid').AsString; 
    c := CurrentCount(cdsClass.FieldByName('Guid').AsString);
    e:='';
    b:=True;
    While b do
    Begin
      if e<>'' then
      MessageDlg(e,mtError,mbOK);
      if F.ShowModal = mrOK then 
      Begin
        Try
          if Trim(TUgEdit(F.FindComponent('edClassName')).Text) = '' then
            RaiseException(UGMM.LT('Department name cannot be empty'));
             l.Clear;
          l.add('ActionType=Update');
          l.add('Guid=' + TUgEdit(F.FindComponent('edGuid')).Text);
          l.add('ClassName=' + TUgEdit(F.FindComponent('edClassName')).Text);
          l.add('ClassExplain=' + TUgEdit(F.FindComponent('edClassExplain')).Text);
          l.add('Parent=' + TUgEdit(F.FindComponent('edParent')).Text);
          l.add('Serial=' + TUgEdit(F.FindComponent('edParent')).Text + '_' + Format('%.5d', [c]));
          UGMM.SetClassItem(l);
          cdsClass.Append;
          cdsClass.FieldbyName('Guid').asString := l.Values['Guid'];
          cdsClass.FieldbyName('ClassName').asString := l.Values['ClassName'];
          cdsClass.FieldbyName('ClassExplain').asString := l.Values['ClassExplain'];
          cdsClass.FieldbyName('Parent').asString := l.Values['Parent'];
          cdsClass.FieldbyName('Serial').asString := l.Values['Serial'];
          cdsClass.Post;
          b := False;
          treeClass.Refresh;
          RefButtons;
        Except{ExceptionMessage}
          e:=ExceptionMessage;
        end;
      End else
        b:=False;
    End;
  Finally
    l.Free;
    F.Free;
  end;
End;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Make sure to add code blocks to your code group
# 1.49. SetRestApiRecord
Procedure SetRestApiRecord(AList:TStringList);
说明: 设置接口记录
- SetRestApiRecord 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AList | 指定一个API数据记录对象 | 
- 示例
//JScript
function btAppendOnClick(sender)
//var
//  F:TUgWebForm;
//  b:Boolean;
//  l:TStringList;
//  e:string;
{
  var F,b,l,e;
  F=GetEditorForm;
  l= new TStringList();
  Try{
    F.Caption = UGMM.LT("Add interface");
    TUgEdit(F.FindComponent("edGuid")).Text   = UGMM.CreateGuid;
    e="";
    b=True;
    While (b)
    {
      if (e!="")
      MessageDlg(e,mtError,mbOK);
      if (F.ShowModal == mrOK) 
      {
        Try{
          //设置模块唯一地址
          if (TUgCombobox(F.FindComponent("edDeveloper")).itemindex != -1){
            TUgCombobox(F.FindComponent("edDeveloperGuid")).Text = TUgCombobox(F.FindComponent("edDeveloperGuid")).items[TUgCombobox(F.FindComponent("edDeveloper")).itemindex];
          }
          else{
            TUgCombobox(F.FindComponent("edDeveloperGuid")).Text ="";
          }
          
          if (Trim(TUgEdit(F.FindComponent("edAPIName")).Text) == "")
            RaiseException(UGMM.LT("Interface name cannot be empty"));
          l.clear;
          l.add("ActionType=Update");
          l.add("Guid=" + TUgEdit(F.FindComponent("edGuid")).Text);
          l.add("APIName=" + TUgEdit(F.FindComponent("edAPIName")).Text);
          l.add("Authenticationfreetoken=" + TUgComboBox(F.FindComponent("edAuthenticationfreetoken")).Text);
          l.add("APIPerm=" + TUgEdit(F.FindComponent("edAPIPerm")).Text);
          l.add("Developer=" + TUgEdit(F.FindComponent("edDeveloperGuid")).Text);
          l.Add("APIRemark=" + TUGMemo(F.FindComponent("edAPIRemark")).Lines.Text);
          UGMM.SetRestApiRecord(l); 
          cdsRestAPIs.Append;
          cdsRestAPIs.FieldbyName("Guid").asString = l.Values["Guid"];
          cdsRestAPIs.FieldbyName("APIName").asString = l.Values["APIName"];
          cdsRestAPIs.FieldbyName("Authenticationfreetoken").asString = l.Values["Authenticationfreetoken"];
          cdsRestAPIs.FieldbyName("APIPerm").asString = TUgEdit(F.FindComponent("edAPIPerm")).Text;
          cdsRestAPIs.FieldbyName("APIPermPath").asString = TUgEdit(F.FindComponent("edAPIPermPath")).Text;
          cdsRestAPIs.FieldbyName("Developer").asString = TUgCombobox(F.FindComponent("edDeveloperGuid")).Text;
          cdsRestAPIs.FieldbyName("DeveloperUser").asString = TUgCombobox(F.FindComponent("edDeveloper")).Text;
          cdsRestAPIs.FieldByName("APIRemark").AsString = TUGMemo(F.FindComponent("edAPIRemark")).Lines.Text;
          cdsRestAPIs.FieldbyName("CreateUser").asString = UGMM.Informations.Values["UserName"];
          cdsRestAPIs.FieldbyName("CreateTime").asDateTime = now;
          cdsRestAPIs.FieldbyName("EditorUser").asString = UGMM.Informations.Values["UserName"];
          cdsRestAPIs.FieldbyName("EditorTime").asDateTime = now;
          cdsRestAPIs.Post;
          b = False;
        }
        Except{
          RaiseException(ExceptionMessage);
        }
      }
      else{
        b=False;
      }
    }
  }
  Finally{
    l.Free;
    F.Free;
  }
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//PasScript
procedure btAppendOnClick(sender: tobject);
Var
  F:TUgWebForm;
  b:Boolean;
  l:TStringList;
  e:string;
Begin
  F:=GetEditorForm;
  l:=TStringList.Create;
  Try
    F.Caption := UGMM.LT('Add interface');
    TUgEdit(F.FindComponent('edGuid')).Text   := UGMM.CreateGuid;
    e:='';
    b:=True;
    While b do
    Begin
      if e<>'' then
      MessageDlg(e,mtError,mbOK);
      if F.ShowModal = mrOK then 
      Begin
        Try
          //设置模块唯一地址
          if TUgCombobox(F.FindComponent('edDeveloper')).itemindex <> -1 then
          TUgCombobox(F.FindComponent('edDeveloperGuid')).Text := TUgCombobox(F.FindComponent('edDeveloperGuid')).items[TUgCombobox(F.FindComponent('edDeveloper')).itemindex]
          else
          TUgCombobox(F.FindComponent('edDeveloperGuid')).Text :='';
          
          if Trim(TUgEdit(F.FindComponent('edAPIName')).Text) = '' then
            RaiseException(UGMM.LT('Interface name cannot be empty'));
          l.clear;
          l.add('ActionType=Update');
          l.add('Guid=' + TUgEdit(F.FindComponent('edGuid')).Text);
          l.add('APIName=' + TUgEdit(F.FindComponent('edAPIName')).Text);
          l.add('APIPerm=' + TUgEdit(F.FindComponent('edAPIPerm')).Text);
          l.add('Developer=' + TUgEdit(F.FindComponent('edDeveloperGuid')).Text);
          UGMM.SetRestApiRecord(l); 
          cdsRestAPIs.Append;
          cdsRestAPIs.FieldbyName('Guid').asString := l.Values['Guid'];
          cdsRestAPIs.FieldbyName('APIName').asString := l.Values['APIName'];
          cdsRestAPIs.FieldbyName('APIPerm').asString := TUgEdit(F.FindComponent('edAPIPerm')).Text;
          cdsRestAPIs.FieldbyName('APIPermPath').asString := TUgEdit(F.FindComponent('edAPIPermPath')).Text;
          cdsRestAPIs.FieldbyName('Developer').asString := TUgCombobox(F.FindComponent('edDeveloperGuid')).Text;
          cdsRestAPIs.FieldbyName('DeveloperUser').asString := TUgCombobox(F.FindComponent('edDeveloper')).Text;
          cdsRestAPIs.FieldbyName('CreateUser').asString := UGMM.Informations.Values['UserName'];
          cdsRestAPIs.FieldbyName('CreateTime').asDateTime := now;
          cdsRestAPIs.FieldbyName('EditorUser').asString := UGMM.Informations.Values['UserName'];
          cdsRestAPIs.FieldbyName('EditorTime').asDateTime := now;
          cdsRestAPIs.Post;
          b := False;
        Except{ExceptionMessage}
          e:=ExceptionMessage;
        end;
      End else
        b:=False;
    End;
  Finally
    l.Free;
    F.Free;
  end;
end;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Make sure to add code blocks to your code group
# 1.50. SetRestApiCode
Procedure SetRestApiCode(AGuid:String;AStrame:TMemoryStream);
说明: 设置接口代码
- SetRestApiCode 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AGuid | 指定一个API接口的Guid | 
| AStrame | 指定一个API接口的程序流 | 
# 1.51. VerifyRunFramePerm
Procedure VerifyRunFramePerm(ARunFarme:TComponent);
说明: 验证运行模块权限
- VerifyRunFramePerm 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| ARunFarme | 指定一个窗体对象 | 
- 示例
//JScript
function UgWebRunFrameOnAfterRunScript(sender){
//验证模块权限
  UGMM.VerifyRunFramePerm(Self);
}
2
3
4
5
//PasScript
Procedure UgWebRunFrameOnAfterRunScript(Const Sender: TObject);
Begin
//验证模块权限
  UGMM.VerifyRunFramePerm(Self);
end;
2
3
4
5
6
// Make sure to add code blocks to your code group
# 2. UGSM类副程序
UGSM类副程序在程序中调用时,必须以UGSM.开头。
# 2.1. RefCurrentTranslations
procedure RefCurrentTranslations;//
说明: 刷新当前翻译列表
# 2.2. RefDataNodes
Procedure RefDataNodes;
说明: 刷新节点数据库连接
# 3. UGCM类副程序
UGCM类副程序在程序中调用时,必须以UGCM.开头。
# 3.1. AudioPlay
procedure AudioPlay(QFile: string);
说明: 使用音频播放指定的文件。
- 示例
//JScript
UGCM.AudioPlay("https://120.26.167.36:1443/files/alohahejahe.mp3");
2
//PasScript
UGCM.AudioPlay('https://120.26.167.36:1443/files/alohahejahe.mp3');
2
// Make sure to add code blocks to your code group
# 3.2. ExitFullscreen
procedure ExitFullscreen;
说明: 退出全屏幕
- 示例
//JScript
  //退出全屏幕
  UGCM.ExitFullscreen;
2
3
//PasScript
begin
  //退出全屏幕
  UGCM.ExitFullscreen;
end;
2
3
4
5
// Make sure to add code blocks to your code group
# 3.3. Fullscreen
procedure Fullscreen;
说明: 全屏幕
- 示例
//JScript
  //全屏幕
  UGCM.Fullscreen;
2
3
//PasScript
begin
  //全屏幕
  UGCM.Fullscreen;
end;
2
3
4
5
// Make sure to add code blocks to your code group
# 3.4. HexToJPG
procedure HexToJPG(AHex: string; AFileName: string); 
说明: 16进制转JPG
- HexToJPG 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| AHex | 指定16进制字符阿串 | 
| AFileName | 指定转换为的文件名 | 
- 示例
//JScript
function ugMQTTws01OnMessage(atopic,apayload){
  //接收到的16进制数据转换为图片
  UGCM.HexToJPG(apayload,"profile-image.jpg");
  UgImage01.Picture.LoadFromFile("profile-image.jpg");
}
2
3
4
5
6
//PasScript
procedure ugMQTTws01OnMessage(const atopic: string;apayload: string);
begin
  //接收到的16进制数据转换为图片
  UGCM.HexToJPG(apayload,'profile-image.jpg');
  UgImage01.Picture.LoadFromFile('profile-image.jpg');
end;
2
3
4
5
6
7
// Make sure to add code blocks to your code group
# 3.5. TTS
procedure TTS(QSpeak: string;QLang:string='zh-CN');
说明: 语音合成
- TTS 程序语法中各部分说明
| 部分 | 说明 | 
|---|---|
| QSpeak | 指定要进行发音的文本 | 
| QLang | 指定发音的语言类型 | 
//JScript
  TTS("你好","zh-CN");
2
//PasScript
begin
  TTS("你好","zh-CN");
end.
2
3
4
5
// Make sure to add code blocks to your code group
