lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
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
Quintiq file version 2.0
#parent: #root
Method OnOk () id:Method_DialogCreateEditFeedbackOperation_OnOk
{
  #keys: '[146140.0.186944172]'
  Body:
  [*
    // When the user click OK, we either create or edit a feedback operation
    
    data := DataHolderDialogData.Data();
    selection := DataHolderFeedbackOperations.Data().Copy();
    isbatchedit := selection.Size() > 1;
    
    // Not using Data.Attributes because ApplyChanges is not used for feedbacks
    quantity := ApplicationMacroPlanner.FormatStringToReal( EditFieldQuantity.Text(), 0.0 );
    description := EditFieldDescription.Text();
    operationid := DropDownListOperation.Data().ID(); 
    datetime := DateTimeSelectorDateTime.DateTime();
    isLocked := CheckBoxIsLocked.Checked();
    
    // New
    if( isnull( data.WrappedInstance() ) )
    {
      FeedbackPeriodTaskOperation::Create( MacroPlan, 
                                           '',  // ID of the feedback. If ID = '', the ID will take MacroPan.IDHolder().GetFeedbackID()                             
                                           operationid, 
                                           datetime, 
                                           quantity,
                                           description,
                                           isLocked,   // is planned exact
                                           false );// is from db
    }
    else 
    { // Edit
      if( isbatchedit ) // Multiple feedback seleted
      {
        FeedbackPeriodTaskOperation::Update( selection,
                                             isLocked, 
                                             CheckBoxBatchEditIsLocked.Checked(), 
                                             quantity,
                                             CheckBoxBatchEditQuantity.Checked(),
                                             description,
                                             CheckBoxBatchEditDescription.Checked() );
      } 
      else // Only one feedback
      {
         data.WrappedInstance().Update( operationid,
                                        datetime,
                                        quantity,
                                        description,
                                        isLocked,    // is planned exact
                                        false );  // is from db
      }
    }
    
    Form.Close();
  *]
}