| Quintiq file version 2.0 | 
| #parent: #root | 
| Method OnOK () id:Method_DialogCreateEditTransitionType_OnOK | 
| { | 
|   #keys: '[139394.0.1557805857]' | 
|   Body: | 
|   [* | 
|     // On ok | 
|     this.ApplyChanges(); | 
|      | 
|     data := DataHolderDialogData.Data(); | 
|      | 
|     // Manually ApplyChanges for HasInputMaxQuantity and HasInputMaxDuration ( Workaround: no data binding on actionlink ) | 
|     quantitybased := RadioButtonGroupQuantityDuration.BoundValue() = GlobalParameters_MP::GetCampaignTransitionsTypeQuantity(); | 
|     data.HasInputMaxQuantity( quantitybased and EditFieldDefaultMaxQty.Enabled() ) | 
|     data.HasInputMaxDuration( not quantitybased and DurationSelectorMaxDuration.Enabled() ); | 
|      | 
|     // New | 
|     if( isnull( data.WrappedInstance() ) ) | 
|     { | 
|       newtransitiontype := TransitionType_MP::Create( DropDownListUnit.Data(), | 
|                                                       data.DefaultMinQuantity(), | 
|                                                       data.DefaultMaxQuantity(), | 
|                                                       data.DefaultMinDuration(), | 
|                                                       data.DefaultMaxDuration(), | 
|                                                       DropDownListFromCampaignType.Data(), | 
|                                                       DropDownListToCampaignType.Data(), | 
|                                                       data.HasInputMaxQuantity(), | 
|                                                       data.HasInputMaxDuration(), | 
|                                                       false /*isfromdb*/ ); | 
|       // Access the form, select the new transition type | 
|       DataHolderForm.Data().ListTransitionType().SelectByKey( newtransitiontype.Key() ); | 
|     } | 
|     else | 
|     { | 
|       data.WrappedInstance().Update( DropDownListUnit.Data(), | 
|                                      data.DefaultMinQuantity(), | 
|                                      data.DefaultMaxQuantity(), | 
|                                      data.DefaultMinDuration(), | 
|                                      data.DefaultMaxDuration(), | 
|                                      DropDownListFromCampaignType.Data(), | 
|                                      DropDownListToCampaignType.Data(), | 
|                                      RadioButtonGroupQuantityDuration.BoundValue().TrimBoth(), | 
|                                      data.HasInputMaxQuantity(), | 
|                                      data.HasInputMaxDuration(), | 
|                                      false /*isfromdb*/ );   | 
|     } | 
|      | 
|     this.Close(); | 
|   *] | 
| } |