陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Quintiq file version 2.0
#parent: #root
Method CreateUpdateEventAndParticipation () as LibCal_Event id:Method_LibCal_dlgEvent_CreateUpdateEventAndParticipation
{
  #keys: '[131094.1.135028056]'
  Body:
  [*
    sEvent    := dhEvent.Data();
    sLeadPart := dhLeadingParticipation.Data();
    
    // Get the values from the controls.
    
    // Event and LeadingParticipation
    subject        := edtName.Text();
    description    := edtDescription.Text();
    category       := ddlCategory.Data();
    isDefault      := ckbApplyToNewResources.Checked();
    startDate      := dsStartDate.Date();
    startTimeOfDay := durStartTimeOfDay.Duration();
    endDate        := dsEndDate.Date();
    endTimeOfDay   := durEndTimeOfDay.Duration();
    isAllDay       := ckbIsAllDay.Checked();
    
    eventType := ddslType.Text();
    capacity  := this.StringToReal( edtCapacity.Text() );  // Always fill the capacity.
    
    // RecurrencePattern
    isRecurring        := not btnOnce.IsPressed();
    recurrenceInterval := this.GetRecurrenceInterval();
    patternType        := this.GetPatternType();
    
    // Daily
    daily_IsEveryWeekday := ckbEveryWeekday.Checked();
    
    // Weekly
    weekly_Weekdays := ifexpr( btnMonday   .IsPressed(), "Mon;", "" )
                     + ifexpr( btnTuesday  .IsPressed(), "Tue;", "" )
                     + ifexpr( btnWednesday.IsPressed(), "Wed;", "" )
                     + ifexpr( btnThursday .IsPressed(), "Thu;", "" )
                     + ifexpr( btnFriday   .IsPressed(), "Fri;", "" )
                     + ifexpr( btnSaturday .IsPressed(), "Sat;", "" )
                     + ifexpr( btnSunday   .IsPressed(), "Sun;", "" );
    
    // Monthly
    monthly_IsDay       := ckbMonthlyDay.Checked();
    monthly_Day         := [Number]edtMonthlyDay.Text();
    monthly_WeekOfMonth := ssMonthlyPatternWeekOfMonth.Text();
    monthly_DayOfWeek   := ssMonthlyPatternDayOfWeek.Text();
    
    // Yearly
    yearly_IsDate      := ckbYearlyDay.Checked();
    month              := ifexpr( yearly_IsDate, ssYearlyMonth.Text(), ssYearlyPatternMonth.Text() );
    yearly_Month       := this.GetNrOfMonth( month );
    yearly_Day         := [Number]ssYearlyDayOfMonth.Text();
    yearly_WeekOfMonth := ssYearlyPatternWeekOfMonth.Text();
    yearly_DayOfWeek   := ssYearlyPatternDayOfWeek.Text();
    
    // RecurrencePeriod
    periodType      := this.GetPeriodType();
    periodStartDate := dsStartOfPeriod.Date();
    periodEndDate   := dsEndOfPeriod.Date();
    nrOfOccurrences := [Number]edtNrOfOccurrences.Text();
    
    // All values are passed to the Server, only the relevant values are used there.
    event := LibCal_Event::CreateUpdateFromUI( sEvent.Calendar(), sLeadPart.WrappedInstance(),
                                               subject, description, eventType, capacity, category, isDefault,
                                               startDate, startTimeOfDay, endDate, endTimeOfDay, isAllDay,
                                               // RecurrencePattern
                                               isRecurring, recurrenceInterval, patternType,
                                               daily_IsEveryWeekday,
                                               weekly_Weekdays,
                                               monthly_IsDay, monthly_Day,  monthly_WeekOfMonth, monthly_DayOfWeek,
                                               yearly_IsDate, yearly_Month, yearly_Day, yearly_WeekOfMonth, yearly_DayOfWeek,
                                               // RecurrencePeriod
                                               periodType, periodStartDate, nrOfOccurrences, periodEndDate,
                                               // Subscribers
                                               dhSubscribers.Data() );
    return event;
  *]
}