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
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  StaticMethod Create ( 
 |    ScenarioManager owner, 
 |    ScenarioNode scenarionode, 
 |    String datasetname, 
 |    String name, 
 |    String comment, 
 |    String storagestate, 
 |    String scenariodescription, 
 |    String snopusername 
 |  ) as ScenarioMP 
 |  { 
 |    Description: 'Create a scenario which is mapped to macro plan dataset' 
 |    TextBody: 
 |    [* 
 |      // desmondt Sep-29-2014 (created) 
 |       
 |      macroplan := owner.CreateMacroPlanMDS( datasetname, storagestate ); 
 |      mdsid := macroplan.MDSID(); 
 |       
 |      currentusername := GlobalParameters_MP::GetUserName(); 
 |       
 |      //create a new scenario 
 |      scenario := construct( ScenarioMP, 
 |                             AsScenarioMP            := owner, 
 |                             Name                    := name, 
 |                             CreatedBy               := currentusername, 
 |                             CreatedOn               := DateTime::Now(), 
 |                             DatasetMDSID            := mdsid, 
 |                             DatasetName             := datasetname, 
 |                             Comment                 := comment, 
 |                             IsLoaded                := true, 
 |                             State                   := storagestate, 
 |                             KBDescription           := scenariodescription, 
 |                             CreatedBySnOPUsername   := snopusername 
 |                            ); 
 |       
 |      scenario.UpdateLastChanged(); 
 |       
 |      MacroPlan::JobUpdateCompany( macroplan.MDSMacroPlan().ID(), scenario ); 
 |       
 |      scn := owner.AddLeaf( scenarionode, &scenario ).astype( ScenarioMP ); 
 |       
 |      return scn; 
 |    *] 
 |    InterfaceProperties { Accessibility: 'Extensible' } 
 |  } 
 |  
  |