From 7f68c5b2e96c6707be1589ff8b5fbdcdab53f412 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期一, 27 五月 2024 20:57:52 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev

---
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent#778.def |   75 +++++++++++++++++++++++++++++++++++++
 1 files changed, 75 insertions(+), 0 deletions(-)

diff --git "a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent\043778.def" "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent\043778.def"
new file mode 100644
index 0000000..ac27f5c
--- /dev/null
+++ "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent\043778.def"
@@ -0,0 +1,75 @@
+Quintiq file version 2.0
+#parent: #root
+Method CreateEvent (
+  LibCal_Calendar owner_i,
+  LibCal_EventCategory category_i,
+  DateTime start_i,
+  DateTime end_i
+) id:Method_LibCal_dlgMultipleEvent_CreateEvent_778
+{
+  #keys: '[415136.0.645530672]'
+  Body:
+  [*
+    timezone := owner_i.GetTimeZone();
+    
+    // Create a new Event...
+    sEvent := owner_i.Event( relshadow,
+                             EventID        := [String]Key::NextPersistentKey(),
+                             StartTimeOfDay := start_i.TimeOfDay( timezone ),
+                             EndTimeOfDay   := end_i  .TimeOfDay( timezone ),
+                             EventCategory  := category_i,
+                             IsDefault      := owner_i.istype( LibCal_CommonCalendar ) );
+    
+    // Special case: by default the EventType is 'Unavailable', but when an event is created for
+    // category 'Available' or 'Partial' then set the Type to 'Available' resp 'Partial'. 
+    if( guard( category_i.Name() = LibCal_Event::TYPE_AVAILABLE(), false ) )
+    {
+      sEvent.Type( LibCal_Event::TYPE_AVAILABLE() );
+    }
+    else if( guard( category_i.Name() = LibCal_Event::TYPE_PARTIAL(), false ) )
+    {
+      sEvent.Type( LibCal_Event::TYPE_PARTIAL() );
+    }
+    
+    // Set the Event and the related controls...
+    // The values are explicitly assigned here 'at the beginning' to the controls,
+    // so that the values can be used by the rest of the logic. Databinding is executed too late for that.
+    // Further initialization is done in the OnCreated of the Dialog.
+    dhEvent.Data( &sEvent );
+    this.SetEventData();
+    
+    // ...and an accompanying LeadingParticipation.
+    // Only set the dates, the times will be updated from the Event later if necessary.
+    sLeadPart := owner_i.Participation( relshadow, LibCal_LeadingParticipation,
+                                        ParticipationID := [String]Key::NextPersistentKey(),
+                                        StartDate       := start_i.Date( timezone ),
+                                        EndDate         := end_i  .Date( timezone ) );
+    //info( '----------------------', isnull( sLeadPart ) );
+    // Set the Participation and the related controls
+    // (only the DataHolders, the Date-controls are set later on, after the recurrence has been initialized)
+    dhStartDate.Data( sLeadPart.StartDate() );
+    //dhEndDate.Data(   sLeadPart.EndDate()   );
+    dhLeadingParticipation.Data( &sLeadPart );
+    dhCategory.Data(category_i);
+    //info( '-----------------------', isnull( dhLeadingParticipation.Data() ) );
+    
+    // Initialize the capacity here, when done in the OnCreate() edtCapacity is not disabled correctly.
+    this.InitializeCapacity();
+    
+    // Initialize the category here, when done in the OnCreate() there is no selection in the DropDownList.
+    // Select the general category for new events.
+    //this.InitializeCategories();
+    //ddlCategory.Data( owner_i.CalendarRegistry().GetGeneralEventCategory() );
+    
+    // Must be done here, when done in the OnCreate() the checkmarks are not always set when the dialog is opened for editing an event.
+    // Pre-select all resources as subscriber when creating a common event.
+    this.InitializeSubscribers();
+    if( owner_i.istype( LibCal_CommonCalendar ) )
+    {
+      lstSubscribers.CheckAll();
+    }
+    
+    // Open the dialog.
+    this.Show( "modal" );
+  *]
+}

--
Gitblit v1.9.3