| Quintiq file version 2.0 | 
| #parent: #root | 
| Method MPSyncFeedbackPeriodTaskOperation ( | 
|   Boolean isoverwritemanualconfig, | 
|   IOFeedbackPeriodTaskOperations iofeedbackperiodtaskoperations | 
| ) | 
| { | 
|   Description: 'Synchronization of FeedbackPeriodTaskOperation for MPSync' | 
|   TextBody: | 
|   [* | 
|     // Select a set of existing FeedbackPeriodTaskOperation | 
|     existing := selectset( this, Feedback.astype( FeedbackPeriodTaskOperation ), item, true ); | 
|     updates := construct( FeedbackPeriodTaskOperations ); | 
|      | 
|     // Traverse the new set of valid FeedbackPeriodTaskOperation | 
|     traverse( iofeedbackperiodtaskoperations , Elements, io, io.IsValid() ) | 
|     { | 
|       indexkey := io.ID(); | 
|       // Find existing FeedbackPeriodTaskOperation | 
|       objectinstance := FeedbackPeriodTaskOperation::FindFeedbackPeriodTaskOperationTypeIndex( indexkey ); | 
|        | 
|       // If no existing FeedbackPeriodTaskOperation is found, create one | 
|       if( isnull( objectinstance ) ) | 
|       { | 
|           objectinstance := FeedbackPeriodTaskOperation::Create( this, | 
|                                                                  io.ID(), | 
|                                                                  io.OperationID(), | 
|                                                                  io.DateTime(), | 
|                                                                  io.FeedbackQuantity(), | 
|                                                                  io.Description(), | 
|                                                                  io.IsLocked(), | 
|                                                                  true ); | 
|       } | 
|        | 
|       // If the FeedbackPeriodTaskOperation is not manually configured or the imported instance should overwrite manual configuration, | 
|       // update the existing FeedbackPeriodTaskOperation | 
|       if( guard( not objectinstance.IsManuallyConfigured() or isoverwritemanualconfig, false ) ) | 
|       { | 
|         // Update FeedbackPeriodTaskOperation | 
|         objectinstance.Update( io.OperationID(), | 
|                                io.DateTime(), | 
|                                io.FeedbackQuantity(),  | 
|                                io.Description(),  | 
|                                io.IsLocked(),  | 
|                                true ); | 
|         objectinstance.CustomUpdate( io, isoverwritemanualconfig ); | 
|         updates.Add( objectinstance ); | 
|       } | 
|     } | 
|      | 
|     // Get the set of old FeedbackPeriodTaskOperation to be deleted | 
|     tobedeleteset := existing.Difference( updates ); | 
|      | 
|     // Traverse the set of FeedbackPeriodTaskOperation to be deleted | 
|     // Only delete FeedbackPeriodTaskOperation that is not manually configured or the imported instance should overwrite manual configuration | 
|     traverse( tobedeleteset, Elements, ele, | 
|               not ele.IsManuallyConfigured() or isoverwritemanualconfig ) | 
|     { | 
|       ele.Delete(); | 
|     } | 
|   *] | 
| } |