chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
Quintiq file version 2.0
#parent: #root
Method Edit (GUIComponent parent) id:Method_LibDEF_DialogEditIntegrationEventCleanupDaemon_Edit
{
  #keys: '[116086.0.427277469]'
  Body:
  [*
    // Edit cleanup integration event daemon properties
    daemonName := LibDEF_DataBroker::DAEMONNAME_CleanupIntegrationEvent();
    daemon     := select( LibDEF_DataBroker.MDSLibDEF_DataBroker(), MDSObjectDaemons, daemon,
                          daemon.Name() = daemonName );
    
    if( not isnull( daemon ) )
    {
      // the daemon is enabled if the frequency is not zero
      if( daemon.LocalFrequency() <> Duration::Zero() )
      {
        chkEnableDaemon.Checked             ( daemon.LocalFrequency() <> Duration::Zero() );
        Dialog.durDaemonFrequency().Duration( daemon.LocalFrequency() );
        if( TimeZone::HasTimeZoneSupport() )
        {
          // For timezone-aware, GMT time is needed for the selector.
          Dialog.dtDaemonStartTime().DateTime( daemon.LocalStartGMTTime() );
        }
        else
        {
          // For legacy mode, the correct datetime is constructed from StartDate and StartTimeOfDay.
          timezone  := TimeZone::Construct( this.GetUserTimeZoneID() );
          startTime := daemon.LocalStartDate().Add( timezone, daemon.LocalStartTimeOfDay() );
          Dialog.dtDaemonStartTime().DateTime( startTime );
        }
      }
      else
      {
        // set the default values
        Dialog.durDaemonFrequency().Duration( LibDEF_DataBroker::DAEMONDEFAULTFREQUENCY_CleanupIntegrationEvent() );
        Dialog.dtDaemonStartTime().DateTime ( this.GetLastSundayOfDataBroker() );
      }
    
      Dialog.Data( LibDEF_DataBroker );
    
      result := this.DoModal( parent );
    
      if( result > 0 )
      {
        LibDEF_DataBroker.EditDaemonProperties( daemonName,
                                                chkEnableDaemon.Checked(),
                                                durDaemonFrequency.Duration(),
                                                dtDaemonStartTime.DateTime() );
      }
    }
    else
    {
      MessageBox::Warning( parent,
                           "Daemon '" + daemonName + "' is not found in LibDMF_DataBroker dataset." + String::NewLine() +
                           "Please make sure it is created.",
                           "&OK" );
    }
  *]
}