Beispiel #1
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);
        }
Beispiel #2
0
        // Token: 0x060004BA RID: 1210 RVA: 0x00027480 File Offset: 0x00025680
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            string action = this.Action;

            if (Utilities.IsPostRequest(base.Request) && string.Equals(action, "Delete", StringComparison.Ordinal))
            {
                this.isBeingCanceled = true;
            }
            CalendarItemBase calendarItemBase = base.OwaContext.PreFormActionData as CalendarItemBase;

            this.folderId = EditCalendarItemHelper.GetCalendarFolderId(base.Request, base.UserContext);
            if (calendarItemBase != null)
            {
                this.CalendarItemBase             = calendarItemBase;
                base.OwaContext.PreFormActionData = null;
            }
            else
            {
                this.LoadCalendarItem(this.folderId);
                bool flag = string.Equals(action, "New", StringComparison.Ordinal) && string.IsNullOrEmpty(Utilities.GetQueryStringParameter(base.Request, "id", false));
                if (flag)
                {
                    bool isMeeting = Utilities.GetQueryStringParameter(base.Request, "mr", false) != null;
                    this.CalendarItemBase.IsMeeting = isMeeting;
                }
            }
            if (Utilities.GetQueryStringParameter(base.Request, "sndpt", false) != null)
            {
                CalendarItemUtilities.BuildSendConfirmDialogPrompt(this.calendarItemBase, out this.sendIssuesPrompt);
            }
            if (!this.IsUnsaved && !this.isBeingCanceled)
            {
                CalendarUtilities.AddCalendarInfobarMessages(base.Infobar, this.CalendarItemBase, null, base.UserContext);
            }
            if (!this.IsUnsaved && this.IsOccurrence && !this.isBeingCanceled && this.CalendarItemBase.IsOrganizer())
            {
                SanitizedHtmlString messageHtml = SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(538626087), new object[]
                {
                    "<a href=\"#\" onClick=\"return onClkES()\">",
                    "</a>"
                });
                base.Infobar.AddMessageHtml(messageHtml, InfobarMessageType.Informational);
            }
            this.recipientWell = new CalendarItemRecipientWell(base.UserContext, this.CalendarItemBase);
            this.toolbar       = new EditCalendarItemToolbar(this.IsUnsaved, this.IsMeeting, this.CalendarItemBase.MeetingRequestWasSent, this.CalendarItemBase.Importance, this.CalendarItemBase.CalendarItemType, base.Response.Output, true, this.isBeingCanceled);
            base.CreateAttachmentHelpers(AttachmentWellType.ReadWrite);
            CalendarModuleViewState calendarModuleViewState = base.UserContext.LastClientViewState as CalendarModuleViewState;

            if (calendarModuleViewState != null)
            {
                this.lastAccessedYear = calendarModuleViewState.DateTime.Year;
            }
        }