愛招飛幫助手冊 愛招飛幫助手冊
  • FastERP-1
  • Smart
  • PinToo
  • FastWeb
  • FastERP-2 企業管理系統 (opens new window)
  • 印染業ERP (opens new window)
  • 工廠終端機 (opens new window)
  • TARS
  • MARS
  • TaskRunner
  • Flying
  • FastDesk
  • HiDesk
  • HiNAT
  • FastBPM
  • 設備故障診斷 (opens new window)
  • 設備最佳運轉效益 (opens new window)
  • 企業智能助手SmeGPT (opens new window)
  • 燈號管理 (opens new window)
  • 戰情室 (opens new window)
  • 能源管理 (opens new window)
  • 人車定位 (opens new window)
  • 戰情指揮系統 (opens new window)
  • FastERP-1
  • FastWeb
  • Smart
  • PinToo
  • Flying
  • TARS
  • 通用功能

    • Report
    • Script
    • Echarts
    • Chart
    • DB Install
  • FastERP-1
  • Smart
  • PinToo
  • FastWeb
  • FastERP-2 企業管理系統 (opens new window)
  • 印染業ERP (opens new window)
  • 工廠終端機 (opens new window)
  • TARS
  • MARS
  • TaskRunner
  • Flying
  • FastDesk
  • HiDesk
  • HiNAT
  • FastBPM
  • 設備故障診斷 (opens new window)
  • 設備最佳運轉效益 (opens new window)
  • 企業智能助手SmeGPT (opens new window)
  • 燈號管理 (opens new window)
  • 戰情室 (opens new window)
  • 能源管理 (opens new window)
  • 人車定位 (opens new window)
  • 戰情指揮系統 (opens new window)
  • FastERP-1
  • FastWeb
  • Smart
  • PinToo
  • Flying
  • TARS
  • 通用功能

    • Report
    • Script
    • Echarts
    • Chart
    • DB Install
  • FastWeb幫助主頁
  • 學習手冊

    • 基本入門

    • 功能介紹

    • 控制元件說明

    • 系統工具

    • 系統管理

    • 云服務工具

    • 資料庫工具

    • 專用模板

    • 外部功能

    • 開發流程

    • 函式程式

      • 系統函式
      • 系統程式
      • 自定函式
      • 自定程式
        • 1. UGMM類副程式
          • 1.1. AddLog
          • 1.2. DelBeans
          • 1.3. DelWebSubForm
          • 1.4. DelAppSubForm
          • 1.5. DelDataNodes
          • 1.6. DelPrintTemplate
          • 1.7. EditorPassWord
          • 1.8. FileUpload
          • 1.9. GetAllMenuList
          • 1.10. GetObjectEntrys
          • 1.11. GetAllBeanList
          • 1.12. GetAllRestApiList
          • 1.13. GetAllSQLCommandList
          • 1.14. GetUserMenuList
          • 1.15. GetDeveloperList
          • 1.16. GetAllFrameList
          • 1.17. GetLanguages
          • 1.18. GetTranslations
          • 1.19. GetUnits
          • 1.20. GetFramePerms
          • 1.21. GetAPIPerms
          • 1.22. GetRoles
          • 1.23. GetRolePerms
          • 1.24. GetSubClassList
          • 1.25. GetClassList
          • 1.26. GetUsers
          • 1.27. GetUserPerms
          • 1.28. GetPrintTemplate
          • 1.29. GetCurrentUserPerms
          • 1.30. GetCurrentData
          • 1.31. LC
          • 1.32. OpenFileManager
          • 1.33. SetBeanObject
          • 1.34. SetBeanRecord
          • 1.35. SetPrintTemplate
          • 1.36. SetFrameRecord
          • 1.37. SetFrameRecord
          • 1.38. SetMenuItem
          • 1.39. SetFramePrems
          • 1.40. SetLanguages
          • 1.41. SetUnits
          • 1.42. SetTranslations
          • 1.43. SetAPIPrems
          • 1.44. SetRoles
          • 1.45. SetSQLCommandRecord
          • 1.46. SetUser
          • 1.47. SetDataNodes
          • 1.48. SetClassItem
          • 1.49. SetRestApiRecord
          • 1.50. SetRestApiCode
          • 1.51. VerifyRunFramePerm
        • 2. UGSM類副程式
          • 2.1. RefCurrentTranslations
          • 2.2. RefDataNodes
        • 3. UGCM類副程式
          • 3.1. AudioPlay
          • 3.2. ExitFullscreen
          • 3.3. Fullscreen
          • 3.4. HexToJPG
          • 3.5. TTS
  • 開發手冊

目录

自定程式

# FastWeb 自定程式

  • 適用平臺:WEB(桌面),APP(移動)

# 1. UGMM類副程式

  UGMM類副程式在程式中呼叫時,必須以UGMM.開頭。

# 1.1. AddLog

procedure AddLog(const msg: string; ACategory: string); 
1

說明:向FastWeb的日誌檔案中寫入日誌資訊。

# 1.2. DelBeans

procedure DelBeans;
1

說明: 刪除所有Bean模組。

# 1.3. DelWebSubForm

Procedure DelWebSubForm(ACaption:String);
1

說明: 從記憶體中釋放子窗體(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");
      }
    }
    
    1
    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;
    
    1
    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);
    
    1

    說明: 從記憶體中釋放子窗體(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");
        }
      }
      
      1
      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;
      
      1
      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);
      
      1

      說明: 刪除資料庫節點

      • 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;
          }
        }
        
        1
        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;
        
        1
        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);
        
        1

        說明: 刪除列印模板

        • 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;
            }
          }
          
          1
          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;
          
          1
          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);
          
          1

          說明: 修改密碼

          • 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;
              }
            }
            
            1
            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;
            
            1
            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');
            
            1

            說明: 打開檔案上傳的對話方塊

            • 程式語法中各部分說明
            部分 說明
            path 設定檔案上傳的目標目錄地址
            singlemode 是否為單檔案上傳模式
            maxfilesize 設定上傳檔案的最大大小,超出限制的檔案上傳無效
            fileexts 設定上傳的檔案後綴名型別
            filedesc 設定目標檔案
            • 示例
              //JScript
              function UGRunFrameOnAfterRunScript(sender){
                UGMM.FileUpload(UGSM.StartPath);
              }
              
              1
              2
              3
              4
              //PasScript
              Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
              Begin
                UGMM.FileUpload(UGSM.StartPath);
              end;
              
              1
              2
              3
              4
              5
              // Make sure to add code blocks to your code group

              # 1.9. GetAllMenuList

              procedure GetAllMenuList(ACds:TClientDataSet;Const AType:String);
              
              1

              說明: 獲取所有功能表列表

              • 程式語法中各部分說明
              部分 說明
              ACds 指定一個數據集對像
              AType 指定功能表型別(Web或APP)
              • 示例
                //JScript
                  //獲取所有功能表列表
                function UGRunFrameOnAfterRunScript(sender){
                  UGMM.GetAllMenuList(cdsMenus,"WEB");
                }
                
                1
                2
                3
                4
                5
                //PasScript
                Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
                Begin
                  //獲取所有功能表列表
                  UGMM.GetAllMenuList(cdsMenus,'WEB');
                end;
                
                1
                2
                3
                4
                5
                6
                // Make sure to add code blocks to your code group

                # 1.10. GetObjectEntrys

                Procedure GetObjectEntrys(AObject:TObject;AEntrys:TStrings);
                
                1

                說明: 獲取翻譯詞條

                • GetObjectEntrys 程式語法中各部分說明
                部分 說明
                AObject 指定需要需要獲取翻譯詞條的窗體對像
                AEntrys 指定一個儲存翻譯詞條的TStrings對像

                # 1.11. GetAllBeanList

                procedure GetAllBeanList(ACds:TClientDataSet;Const AType:String);
                
                1

                說明: 獲取所有Bean模組的列表

                • GetAllBeanList 程式語法中各部分說明
                部分 說明
                ACds 指定一個數據集對像
                AType 指定獲取的Bean模板型別,分為 WEB 與 APP 兩種
                • 示例
                  //JScript
                  UGMM.GetAllBeanList(cdsBeans,"WEB");
                  
                  1
                  2
                  //PasScript
                  UGMM.GetAllBeanList(cdsBeans,'WEB');
                  
                  1
                  2
                  // Make sure to add code blocks to your code group

                  # 1.12. GetAllRestApiList

                  procedure GetAllRestApiList(ACds:TClientDataSet);
                  
                  1

                  說明: 獲取所有介面列表

                  • GetAllRestApiList 程式語法中各部分說明
                  部分 說明
                  ACds 指定一個數據集對像
                  • 示例
                    //JScript
                    function UGRunFrameOnAfterRunScript(sender){
                      //獲取所有API列表
                      UGMM.GetAllRestApiList(cdsRestAPIs);
                    }
                    
                    1
                    2
                    3
                    4
                    5
                    //PasScript
                    procedure UgWebRunFrameOnAfterRunScript(const sender: tobject);
                    Begin
                      //獲取所有API列表
                      UGMM.GetAllRestApiList(cdsRestAPIs);
                    end;
                    
                    1
                    2
                    3
                    4
                    5
                    6
                    // Make sure to add code blocks to your code group

                    # 1.13. GetAllSQLCommandList

                    procedure GetAllSQLCommandList(ACds:TClientDataSet);
                    
                    1

                    說明:獲取所有預設SQL資訊至數據集。

                    • GetAllSQLCommandList 程式語法中各部分說明
                    部分 說明
                    ACds 指定一個數據集對像
                    • 示例
                      //JScript
                      function UGRunFrameOnAfterRunScript(sender){
                        //獲取目前使用者功能表列表
                        UGMM.GetAllSQLCommandList(cdsSQLCommands);
                      }
                      
                      1
                      2
                      3
                      4
                      5
                      //PasScript
                      Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
                      Begin
                        //獲取目前使用者功能表列表
                        UGMM.GetAllSQLCommandList(cdsSQLCommands);
                      end;
                      
                      1
                      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);
                      
                      1

                      說明: 獲取目前使用者功能表列表

                      • GetUserMenuList 程式語法中各部分說明
                      部分 說明
                      ACds 指定一個數據集對像
                      AType 指定功能表型別(Web或APP)
                      • 示例
                        //JScript
                        function UGRunFrameOnAfterRunScript(sender){
                          //獲取目前使用者功能表列表
                          UGMM.GetUserMenuList(cdsMenus,"WEB");
                        }
                        
                        1
                        2
                        3
                        4
                        5
                        //PasScript
                        Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
                        Begin
                          //獲取目前使用者功能表列表
                          UGMM.GetUserMenuList(cdsMenus,'WEB');
                        end;
                        
                        1
                        2
                        3
                        4
                        5
                        6
                        // Make sure to add code blocks to your code group

                        # 1.15. GetDeveloperList

                        Procedure GetDeveloperList(ACds:TClientDataSet);
                        
                        1

                        說明: 獲取開發使用者列表

                        • GetDeveloperList 程式語法中各部分說明
                        部分 說明
                        ACds 指定一個數據集對像
                        • 示例
                          //JScript
                          function UGRunFrameOnAfterRunScript(sender){
                            //獲取開發使用者列表
                            UGMM.GetDeveloperList(cdsDeveloper);
                          }
                          
                          1
                          2
                          3
                          4
                          5
                          //PasScript
                          Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
                          Begin
                            //獲取開發使用者列表
                            UGMM.GetDeveloperList(cdsDeveloper);
                          end;
                          
                          1
                          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);
                          
                          1

                          說明: 獲取所有模組列表

                          • GetAllFrameList 程式語法中各部分說明
                          部分 說明
                          ACds 指定一個數據集對像
                          AType 指定模組型別(Web或APP)
                          • 示例
                            //JScript
                            function UGRunFrameOnAfterRunScript(sender){
                              //獲取所有模組列表
                              UGMM.GetAllFrameList(cdsFrame);
                            }
                            
                            1
                            2
                            3
                            4
                            5
                            //PasScript
                            Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
                            Begin
                              //獲取所有模組列表
                              UGMM.GetAllFrameList(cdsFrame);
                            end;
                            
                            1
                            2
                            3
                            4
                            5
                            6
                            // Make sure to add code blocks to your code group

                            # 1.17. GetLanguages

                            Procedure GetLanguages(ACds:TClientDataSet);
                            
                            1

                            說明: 獲取語言列表

                            • GetLanguages 程式語法中各部分說明
                            部分 說明
                            ACds 指定一個數據集對像
                            • 示例
                              //JScript
                              function UGRunFrameOnAfterRunScript(sender){
                                //獲取語言列表
                                UGMM.GetAllFrameList(cdsLanguages);
                              }
                              
                              1
                              2
                              3
                              4
                              5
                              //PasScript
                              Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
                              Begin
                                //獲取語言列表
                                UGMM.GetAllFrameList(cdsLanguages);
                              end;
                              
                              1
                              2
                              3
                              4
                              5
                              6
                              // Make sure to add code blocks to your code group

                              # 1.18. GetTranslations

                              Procedure GetTranslations(ACds:TClientDataSet);
                              
                              1

                              說明: 獲取翻譯列表

                              • GetTranslations 程式語法中各部分說明
                              部分 說明
                              ACds 指定一個數據集對像
                              • 示例
                                //JScript
                                function UGRunFrameOnAfterRunScript(sender){
                                  //獲取翻譯列表
                                  UGMM.GetAllFrameList(cdsTranslations);
                                }
                                
                                1
                                2
                                3
                                4
                                5
                                //PasScript
                                Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
                                Begin
                                  //獲取翻譯列表
                                  UGMM.GetAllFrameList(cdsTranslations);
                                end;
                                
                                1
                                2
                                3
                                4
                                5
                                6
                                // Make sure to add code blocks to your code group

                                # 1.19. GetUnits

                                Procedure GetUnits(ACds:TClientDataSet;AType:String);
                                
                                1

                                說明: 獲取公共單元列表

                                • GetUnits 程式語法中各部分說明
                                部分 說明
                                ACds 指定一個數據集對像
                                AType 指定模組型別(Web或APP)

                                # 1.20. GetFramePerms

                                procedure GetFramePerms(ACds:TClientDataSet;AFrameGuid:String);
                                
                                1

                                說明: 獲取模組許可權列表

                                • GetFramePerms 程式語法中各部分說明
                                部分 說明
                                ACds 指定一個數據集對像
                                AFrameGuid 指定模組的唯一ID

                                # 1.21. GetAPIPerms

                                procedure GetAPIPerms(ACds:TClientDataSet);
                                
                                1

                                說明: 獲取API模組許可權列表

                                • GetAPIPerms 程式語法中各部分說明
                                部分 說明
                                ACds 指定一個數據集對像
                                • 示例
                                  //JScript
                                  function UGRunFrameOnAfterRunScript(sender){
                                    //獲取翻譯列表
                                    UGMM.GetAPIPerms(cdsAPIPerms);
                                  }
                                  
                                  1
                                  2
                                  3
                                  4
                                  5
                                  //PasScript
                                  Procedure UGRunFrameOnAfterRunScript(Const Sender: TObject);
                                  Begin
                                    //獲取翻譯列表
                                    UGMM.GetAPIPerms(cdsAPIPerms);
                                  end;
                                  
                                  1
                                  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);
                                  
                                  1

                                  說明: 獲取角色列表

                                  • GetRoles 程式語法中各部分說明
                                  部分 說明
                                  ACds 指定一個數據集對像
                                  AQueryParams 指定參數列表

                                  # 1.23. GetRolePerms

                                  Procedure GetRolePerms(ACds:TClientDataSet;ARoleGuid:String;Const AModeType:String = '');
                                  
                                  1

                                  說明: 獲取角色許可權列表,帶樹形

                                  • AModeType 程式語法中各部分說明
                                  部分 說明
                                  ACds 指定一個角色許可權數據集對像
                                  ARoleGuid 指定一個角色唯一ID
                                  AModeType

                                  # 1.24. GetSubClassList

                                  procedure GetSubClassList(ACds:TClientDataSet);
                                  
                                  1

                                  說明: 獲取下屬部門列表

                                  • GetSubClassList 程式語法中各部分說明
                                  部分 說明
                                  ACds 指定一個下屬部門列表數據集對像
                                  • 示例
                                  //獲取所有部門列表
                                    UGMM.GetClassList(cdsClass);
                                  
                                  1
                                  2

                                  # 1.25. GetClassList

                                  procedure GetClassList(ACds:TClientDataSet);//獲取部門列表
                                  
                                  1

                                  說明: 獲取部門列表

                                  • GetClassList 程式語法中各部分說明
                                  部分 說明
                                  ACds 指定一個部門列表數據集對像
                                  • 示例
                                  //獲取所有部門列表
                                    UGMM.GetClassList(cdsClass);
                                  
                                  1
                                  2

                                  # 1.26. GetUsers

                                  procedure GetUsers(ACds:TClientDataSet;Const AQueryParams:TStringList = Nil);
                                  
                                  1

                                  說明: 獲取使用者列表

                                  • GetUsers 程式語法中各部分說明
                                  部分 說明
                                  ACds 指定一個使用者列表數據集對像
                                  AQueryParams 指定參數

                                  # 1.27. GetUserPerms

                                  Procedure GetUserPerms(ACds:TClientDataSet;AUserGuid:String);
                                  
                                  1

                                  說明: 獲取使用者關聯角色許可權列表

                                  • GetUserPerms 程式語法中各部分說明
                                  部分 說明
                                  ACds 指定一個使用者列表數據集對像
                                  AUserGuid 指定使用者維一ID

                                  # 1.28. GetPrintTemplate

                                  Procedure GetPrintTemplate(ACds:TClientDataSet);
                                  
                                  1

                                  說明: 獲取列印模板列表

                                  • GetPrintTemplate 程式語法中各部分說明
                                  部分 說明
                                  ACds 指定一個列印模板列表數據集對像
                                  • 示例
                                      //重新整理模板列表
                                      UGMM.GetPrintTemplate(cdsPrintTemplate);
                                  
                                  1
                                  2

                                  # 1.29. GetCurrentUserPerms

                                  Procedure GetCurrentUserPerms; 
                                  
                                  1

                                  說明: 獲取目前登陸使用者許可權


                                  # 1.30. GetCurrentData

                                  procedure GetCurrentData;
                                  
                                  1

                                  說明: 獲取目前數據


                                  # 1.31. LC

                                  Procedure LC(AObject:TObject);
                                  
                                  1

                                  說明: 界面翻譯

                                  • LC 程式語法中各部分說明
                                  部分 說明
                                  AObject 指定需要翻譯的模組對象,一般指窗體
                                  • 示例
                                    //JScript
                                    function UGRunFrameOnAfterRunScript(sender){
                                      //翻譯界面
                                      UGMM.LC(Self);
                                    }
                                    
                                    1
                                    2
                                    3
                                    4
                                    5
                                    //PasScript
                                    procedure UgWebRunFrameOnAfterRunScript(const sender: tobject);
                                    Begin
                                      //翻譯界面
                                      UGMM.LC(Self);
                                    end;
                                    
                                    1
                                    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);
                                    
                                    1

                                    說明:設定模組對象。

                                    • SetBeanRecord 程式語法中各部分說明
                                    部分 說明
                                    AFrameGuid 所屬的主ID對象,對應會在檔案上傳目錄下建立與ID同名的子資料夾
                                    AOrderCode 所屬的主ID下的子ID對象,對應會在檔案上傳目錄的主ID目錄下,建立與子ID同名的資料夾
                                    ACapacitySpace 設定目錄中允許上傳的最大檔案合計大小,以位元組為單位
                                    AIsEditor 是否開啟管理模式(是否允許上傳,修改,刪除檔案)
                                    • 示例
                                      //JScript
                                      UGMM.OpenFileManager("ABC","12123",1000000,true);
                                      
                                      1
                                      2
                                      //PasScript
                                      UGMM.OpenFileManager('ABC','12123',1000000,true);
                                      
                                      1
                                      2
                                      // Make sure to add code blocks to your code group

                                        打開的檔案管理界面如下。

                                      # 1.33. SetBeanObject

                                      Procedure SetBeanObject(AGuid:String;AStream:TMemoryStream);
                                      
                                      1

                                      說明:設定模組對象。

                                      • SetBeanRecord 程式語法中各部分說明
                                      部分 說明
                                      AGuid Bean模組的Guid名稱
                                      AStream 指定的記憶體流

                                      # 1.34. SetBeanRecord

                                      Procedure SetBeanRecord(AList:TStringList);
                                      
                                      1

                                      說明:設定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; 
                                        
                                        1
                                        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; 
                                        
                                        1
                                        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);
                                        
                                        1

                                        說明: 設定列印模板列表

                                        • 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);
                                            }
                                          }
                                          
                                          1
                                          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;
                                          
                                          1
                                          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);
                                          
                                          1

                                          說明: 設定模組記錄

                                          • SetFrameRecord 程式語法中各部分說明
                                          部分 說明
                                          AList

                                          # 1.37. SetFrameRecord

                                          Procedure SetFrameObject(AGuid:String;AStrame:TMemoryStream);
                                          
                                          1

                                          說明: 設定模組對像

                                          • SetFrameRecord 程式語法中各部分說明
                                          部分 說明
                                          AGuid
                                          AStrame

                                          # 1.38. SetMenuItem

                                          Procedure SetMenuItem(AList:TStringList);
                                          
                                          1

                                          說明: 設定功能表節點

                                          • 程式語法中各部分說明
                                          部分 說明
                                          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; 
                                              }
                                            }
                                            
                                            1
                                            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;
                                            
                                            1
                                            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);
                                            
                                            1

                                            說明: 設定模組許可權

                                            • SetFramePrems 程式語法中各部分說明
                                            部分 說明
                                            AList 指定模組許可權內容TStringList對像

                                            # 1.40. SetLanguages

                                            Procedure SetLanguages(AList:TStringList);
                                            
                                            1

                                            說明: 設定語言列表

                                            • SetLanguages 程式語法中各部分說明
                                            部分 說明
                                            AList 指定語言列表內容 TStringList 對像

                                            # 1.41. SetUnits

                                            Procedure SetUnits(AGuid,ActionType,AUnitName,AType:String;AStrame:TMemoryStream);
                                            
                                            1

                                            說明: 設定公共單元

                                            • SetUnits 程式語法中各部分說明
                                            部分 說明
                                            AGuid
                                            ActionType
                                            AUnitName
                                            AType
                                            AStrame

                                            # 1.42. SetTranslations

                                            Procedure SetTranslations(AList:TStringList);
                                            
                                            1

                                            說明: 設定翻譯列表

                                            • SetTranslations 程式語法中各部分說明
                                            部分 說明
                                            AList 指定翻譯列表內容 TStringList 對像

                                            # 1.43. SetAPIPrems

                                            procedure SetAPIPrems(AList:TStringList);
                                            
                                            1

                                            說明: 設定API許可權

                                            • SetAPIPrems 程式語法中各部分說明
                                            部分 說明
                                            AList 指定API許可權內容TStringList對像

                                            # 1.44. SetRoles

                                            Procedure SetRoles(ARoles,APermGuids,ATypes:TStringList);
                                            
                                            1

                                            說明: 設定角色

                                            • 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;
                                                  }
                                              }
                                              
                                              1
                                              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;
                                              
                                              1
                                              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);
                                              
                                              1

                                              說明: 設定預設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);
                                                  //...
                                                }
                                                
                                                1
                                                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);
                                                  //...
                                                
                                                1
                                                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);
                                                
                                                1

                                                說明: 設定使用者

                                                • 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;
                                                    }
                                                  }
                                                  
                                                  1
                                                  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;
                                                  
                                                  1
                                                  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);
                                                  
                                                  1

                                                  說明: 設定資料庫節點列表

                                                  • 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;
                                                      }
                                                    }
                                                    
                                                    1
                                                    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;
                                                    
                                                    1
                                                    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);
                                                    
                                                    1

                                                    說明: 設定部門節點

                                                    • 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;
                                                          }
                                                      }
                                                      
                                                      1
                                                      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;
                                                      
                                                      1
                                                      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);
                                                      
                                                      1

                                                      說明: 設定介面記錄

                                                      • 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;
                                                          }
                                                        }
                                                        
                                                        1
                                                        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;
                                                        
                                                        1
                                                        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);
                                                        
                                                        1

                                                        說明: 設定介面程式碼

                                                        • SetRestApiCode 程式語法中各部分說明
                                                        部分 說明
                                                        AGuid 指定一個API介面的Guid
                                                        AStrame 指定一個API介面的程式流

                                                        # 1.51. VerifyRunFramePerm

                                                        Procedure VerifyRunFramePerm(ARunFarme:TComponent);
                                                        
                                                        1

                                                        說明: 驗證運行模組許可權

                                                        • VerifyRunFramePerm 程式語法中各部分說明
                                                        部分 說明
                                                        ARunFarme 指定一個窗體對像
                                                        • 示例
                                                          //JScript
                                                          function UgWebRunFrameOnAfterRunScript(sender){
                                                          //驗證模組許可權
                                                            UGMM.VerifyRunFramePerm(Self);
                                                          }
                                                          
                                                          1
                                                          2
                                                          3
                                                          4
                                                          5
                                                          //PasScript
                                                          Procedure UgWebRunFrameOnAfterRunScript(Const Sender: TObject);
                                                          Begin
                                                          //驗證模組許可權
                                                            UGMM.VerifyRunFramePerm(Self);
                                                          end;
                                                          
                                                          1
                                                          2
                                                          3
                                                          4
                                                          5
                                                          6
                                                          // Make sure to add code blocks to your code group

                                                          # 2. UGSM類副程式

                                                            UGSM類副程式在程式中呼叫時,必須以UGSM.開頭。

                                                          # 2.1. RefCurrentTranslations

                                                          procedure RefCurrentTranslations;//
                                                          
                                                          1

                                                          說明: 重新整理目前翻譯列表


                                                          # 2.2. RefDataNodes

                                                          Procedure RefDataNodes;
                                                          
                                                          1

                                                          說明: 重新整理節點資料庫連線


                                                          # 3. UGCM類副程式

                                                            UGCM類副程式在程式中呼叫時,必須以UGCM.開頭。

                                                          # 3.1. AudioPlay

                                                          procedure AudioPlay(QFile: string);
                                                          
                                                          1

                                                          說明: 使用音訊播放指定的檔案。

                                                          • 示例
                                                            //JScript
                                                            UGCM.AudioPlay("https://120.26.167.36:1443/files/alohahejahe.mp3");
                                                            
                                                            1
                                                            2
                                                            //PasScript
                                                            UGCM.AudioPlay('https://120.26.167.36:1443/files/alohahejahe.mp3');
                                                            
                                                            1
                                                            2
                                                            // Make sure to add code blocks to your code group

                                                            # 3.2. ExitFullscreen

                                                            procedure ExitFullscreen;
                                                            
                                                            1

                                                            說明: 退出全螢幕

                                                            • 示例
                                                              //JScript
                                                                //退出全螢幕
                                                                UGCM.ExitFullscreen;
                                                              
                                                              1
                                                              2
                                                              3
                                                              //PasScript
                                                              begin
                                                                //退出全螢幕
                                                                UGCM.ExitFullscreen;
                                                              end;
                                                              
                                                              1
                                                              2
                                                              3
                                                              4
                                                              5
                                                              // Make sure to add code blocks to your code group

                                                              # 3.3. Fullscreen

                                                              procedure Fullscreen;
                                                              
                                                              1

                                                              說明: 全螢幕

                                                              • 示例
                                                                //JScript
                                                                  //全螢幕
                                                                  UGCM.Fullscreen;
                                                                
                                                                1
                                                                2
                                                                3
                                                                //PasScript
                                                                begin
                                                                  //全螢幕
                                                                  UGCM.Fullscreen;
                                                                end;
                                                                
                                                                1
                                                                2
                                                                3
                                                                4
                                                                5
                                                                // Make sure to add code blocks to your code group

                                                                # 3.4. HexToJPG

                                                                procedure HexToJPG(AHex: string; AFileName: string); 
                                                                
                                                                1

                                                                說明: 16進位制轉JPG

                                                                • HexToJPG 程式語法中各部分說明
                                                                部分 說明
                                                                AHex 指定16進位制字元阿串
                                                                AFileName 指定轉換為的檔名
                                                                • 示例
                                                                  //JScript
                                                                  function ugMQTTws01OnMessage(atopic,apayload){
                                                                    //接收到的16進位制數據轉換為圖片
                                                                    UGCM.HexToJPG(apayload,"profile-image.jpg");
                                                                    UgImage01.Picture.LoadFromFile("profile-image.jpg");
                                                                  }
                                                                  
                                                                  1
                                                                  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;
                                                                  
                                                                  1
                                                                  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');
                                                                  
                                                                  1

                                                                  說明: 語音合成

                                                                  • TTS 程式語法中各部分說明
                                                                  部分 說明
                                                                  QSpeak 指定要進行發音的文字
                                                                  QLang 指定發音的語言型別
                                                                    //JScript
                                                                      TTS("你好","zh-CN");
                                                                    
                                                                    1
                                                                    2
                                                                    //PasScript
                                                                    begin
                                                                      TTS("你好","zh-CN");
                                                                    end.
                                                                    
                                                                    
                                                                    1
                                                                    2
                                                                    3
                                                                    4
                                                                    5
                                                                    // Make sure to add code blocks to your code group
                                                                    自定函式
                                                                    通訊埠印表機

                                                                    ← 自定函式 通訊埠印表機→

                                                                    Copyright © 2021-2025 愛招飛IsoFace | ALL Rights Reserved
                                                                    • 跟随系统
                                                                    • 浅色模式
                                                                    • 深色模式
                                                                    • 阅读模式