hongji.li
2023-11-05 2713c338a98325cad21ebec2085802a5e49a98ef
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Quintiq file version 2.0
#parent: #root
Method PTF_CheckPreconditionOK (
  Boolean singleeditmode,
  output String feedback_o
) as Boolean id:Method_LibPTF_dlgCreateEditTestScript_PTF_CheckPreconditionOK
{
  #keys: '[103546.0.59539049]'
  Body:
  [*
    // Checks various precondition before user allow to press OK button
    this.PTF_IsReadyToRun( feedback_o );
    
    if( edtTotalNrOfSessions.Text().TrimBoth().Length() > 0
        and edtNrOfSimultaneousSessions.Text().TrimBoth().Length() > 0 )
    {
      session    := [Number]edtTotalNrOfSessions.Text();
      concurrent := [Number]edtNrOfSimultaneousSessions.Text();
    
      if( not session >= concurrent )
      {
        feedback_o := feedback_o + "The number of concurrent sessions should be less than or equal to the total number of sessions" + String::NewLine();
      }
    }
    
    if( durMinStartClientDelay.Duration() > durMaxStartClientDelay.Duration() )
    {
      feedback_o := feedback_o + "Start client delay range is invalid" + String::NewLine();
    }
    
    if( singleeditmode )
    {
      if( edtUser.Text().TrimBoth().Length() = 0 )
      {
        feedback_o := feedback_o + "User name cannot be empty" + String::NewLine();
      }
    
      if( not selClientType.BoundValue().Length() > 0 )
      {
        feedback_o := feedback_o + "Client type cannot be empty" + String::NewLine();
      }
    
      if( not selLogging.BoundValue().Length() > 0 )
      {
        feedback_o := feedback_o + "Logging cannot be empty" + String::NewLine();
      }
    
      if( edtDatasetKind.Text().TrimBoth().Length() = 0 )
      {
        feedback_o := feedback_o + "Dataset kind cannot be empty" + String::NewLine();
      }
    
      if( edtDatasetFolder.Text().TrimBoth().Length() = 0 )
      {
        feedback_o := feedback_o + "Dataset folder cannot be empty" + String::NewLine();
      }
    
      if( edtDataset.Text().TrimBoth().Length() = 0 )
      {
        feedback_o := feedback_o + "Dataset instance cannot be empty" + String::NewLine();
      }
    
      if( not selProject.BoundValue().Length() > 0 )
      {
        feedback_o := feedback_o + "Project cannot be empty" + String::NewLine();
      }
    
      if( edtTotalNrOfSessions.Text().TrimBoth().Length() = 0 )
      {
        feedback_o := feedback_o + "Sessions cannot be empty" + String::NewLine();
      }
    
      if( edtNrOfSimultaneousSessions.Text().TrimBoth().Length() = 0 )
      {
        feedback_o := feedback_o + "Concurrent sessions cannot be empty" + String::NewLine();
      }
    
      if( edtActionScript.Text().TrimBoth().Length() = 0 )
      {
        feedback_o := feedback_o + "Test script cannot be empty" + String::NewLine();
      }
    }
    else
    {
      requiredtotalnrofsession := edtTotalNrOfSessions.Text().TrimBoth().Length() = 0
                                  and edtNrOfSimultaneousSessions.Text().TrimBoth().Length() > 0;
    
      requirednrofsimultaneoussession := edtTotalNrOfSessions.Text().TrimBoth().Length() > 0
                                         and edtNrOfSimultaneousSessions.Text().TrimBoth().Length() = 0;
    
      if( requiredtotalnrofsession )
      {
        feedback_o := feedback_o + "Sessions cannot be empty" + String::NewLine();
      }
    
      if( requirednrofsimultaneoussession )
      {
        feedback_o := feedback_o + "Concurrent sessions cannot be empty" + String::NewLine();
      }
    
    }
    
    return feedback_o = "";
  *]
}