コード例 #1
0
        private EditCalendarItemPreFormAction.RedirectTo DoAction(string commandPost, EditCalendarItemHelper.CalendarItemUpdateFlags storeUpdateFlags, ref PreFormActionResponse response, out InfobarMessage infobarMessage)
        {
            infobarMessage = null;
            EditCalendarItemHelper.CalendarItemUpdateFlags calendarItemUpdateFlags = EditCalendarItemHelper.CalendarItemUpdateFlags.None;
            string text = null;

            EditCalendarItemPreFormAction.CalendarTab calendarTab = (EditCalendarItemPreFormAction.CalendarTab)RequestParser.TryGetIntValueFromForm(this.request, "hidtab", 0);
            if (Utilities.IsPostRequest(this.request) && !string.Equals(commandPost, "new", StringComparison.Ordinal) && !string.Equals(commandPost, "cls", StringComparison.Ordinal))
            {
                if (calendarTab == EditCalendarItemPreFormAction.CalendarTab.Scheduling)
                {
                    calendarItemUpdateFlags = EditCalendarItemHelper.UpdateImportance(this.calendarItemBase, this.request);
                }
                else
                {
                    calendarItemUpdateFlags = EditCalendarItemHelper.UpdateCalendarItemValues(this.calendarItemBase, this.userContext, this.request, out text);
                }
                if (!string.IsNullOrEmpty(text))
                {
                    infobarMessage = InfobarMessage.CreateText(text, InfobarMessageType.Error);
                    return(EditCalendarItemPreFormAction.RedirectTo.EditCalendarItem);
                }
                if (this.calendarItemBase.AttendeesChanged)
                {
                    calendarItemUpdateFlags |= EditCalendarItemHelper.CalendarItemUpdateFlags.AttendeesChanged;
                }
            }
            EditCalendarItemHelper.CalendarItemUpdateFlags calendarItemUpdateFlags2 = calendarItemUpdateFlags | storeUpdateFlags;
            EditCalendarItemHelper.CancelRangeType         cancelRangeType          = EditCalendarItemHelper.CancelRangeType.None;
            ExDateTime cancelFromDateTime = ExDateTime.MinValue;
            string     formParameter      = Utilities.GetFormParameter(this.request, "delprompt", false);

            if (!string.IsNullOrEmpty(formParameter))
            {
                if (string.Equals(formParameter, "2", StringComparison.Ordinal))
                {
                    cancelRangeType = EditCalendarItemHelper.CancelRangeType.All;
                }
                else if (string.Equals(formParameter, "1", StringComparison.Ordinal))
                {
                    cancelRangeType    = EditCalendarItemHelper.CancelRangeType.FromDate;
                    cancelFromDateTime = CalendarUtilities.ParseDateTimeFromForm(this.request, "seldelY", "seldelM", "seldelD", null, this.userContext);
                }
                else
                {
                    if (!string.Equals(formParameter, "0", StringComparison.Ordinal))
                    {
                        throw new OwaInvalidRequestException("Invalid cancel prompt radio button value.");
                    }
                    cancelRangeType = EditCalendarItemHelper.CancelRangeType.Occurrence;
                }
            }
            EditCalendarItemPreFormAction.RedirectTo result = EditCalendarItemPreFormAction.RedirectTo.None;
            if (commandPost != null)
            {
                if (< PrivateImplementationDetails > { 83F 8DD 10 - 61AE - 4283 - B829 - 2F 464F 055E61 }.$$method0x600016f - 1 == null)
コード例 #2
0
        internal static bool CancelCalendarItem(UserContext userContext, CalendarItemBase calendarItemBase, EditCalendarItemHelper.CancelRangeType cancelRange, ExDateTime cancelFromDateTime, out InfobarMessage infobarMessage)
        {
            bool result = true;

            infobarMessage = null;
            CalendarItem calendarItem = calendarItemBase as CalendarItem;

            try
            {
                if (calendarItem == null)
                {
                    StoreObjectId masterStoreObjectId = CalendarUtilities.GetMasterStoreObjectId(calendarItemBase);
                    calendarItem = Utilities.GetItem <CalendarItem>(userContext, masterStoreObjectId, new PropertyDefinition[0]);
                    if (calendarItem != null)
                    {
                        calendarItem.OpenAsReadWrite();
                    }
                }
                if (cancelRange == EditCalendarItemHelper.CancelRangeType.Occurrence || cancelRange == EditCalendarItemHelper.CancelRangeType.None)
                {
                    EditCalendarItemHelper.CancelCalendarItem(userContext, calendarItemBase);
                }
                else if (cancelRange == EditCalendarItemHelper.CancelRangeType.All)
                {
                    EditCalendarItemHelper.CancelCalendarItem(userContext, calendarItem);
                }
                else if (cancelRange == EditCalendarItemHelper.CancelRangeType.FromDate)
                {
                    int cancelRecurrenceCount = CalendarItemUtilities.GetCancelRecurrenceCount(calendarItem, cancelFromDateTime);
                    if (cancelRecurrenceCount == 0)
                    {
                        EditCalendarItemHelper.CancelCalendarItem(userContext, calendarItem);
                    }
                    else if (cancelRecurrenceCount > 0)
                    {
                        calendarItem.Recurrence = new Recurrence(calendarItem.Recurrence.Pattern, new EndDateRecurrenceRange(calendarItem.Recurrence.Range.StartDate, cancelFromDateTime.IncrementDays(-1)));
                        if (calendarItem.IsMeeting && calendarItem.MeetingRequestWasSent)
                        {
                            result = CalendarUtilities.SendMeetingMessages(userContext, calendarItem, true, out infobarMessage);
                        }
                        else
                        {
                            result = CalendarUtilities.SaveCalendarItem(calendarItem, userContext, out infobarMessage);
                        }
                    }
                }
            }
            finally
            {
                if (calendarItem != null && calendarItem != calendarItemBase)
                {
                    calendarItem.Dispose();
                }
            }
            return(result);
        }