// Token: 0x060001C5 RID: 453 RVA: 0x00010C5C File Offset: 0x0000EE5C
        public static bool CheckNeedPatternChangeConfirmation(UserContext userContext, CalendarItemData calendarItemData)
        {
            Recurrence           recurrence        = null;
            CalendarItemBaseData userContextData   = EditCalendarItemHelper.GetUserContextData(userContext);
            CalendarItemData     calendarItemData2 = userContextData as CalendarItemData;

            if (calendarItemData2 != null)
            {
                recurrence = calendarItemData2.Recurrence;
            }
            RecurrencePattern p = null;

            if (recurrence != null)
            {
                p = recurrence.Pattern;
            }
            bool flag  = !CalendarItemData.IsRecurrencePatternEqual(calendarItemData.Recurrence.Pattern, p);
            bool flag2 = false;

            if (flag && calendarItemData.Id != null)
            {
                using (CalendarItem item = Utilities.GetItem <CalendarItem>(userContext, calendarItemData.Id, new PropertyDefinition[0]))
                {
                    if (item != null && item.Recurrence != null)
                    {
                        IList <OccurrenceInfo> modifiedOccurrences = item.Recurrence.GetModifiedOccurrences();
                        if (modifiedOccurrences != null)
                        {
                            flag2 = (modifiedOccurrences.Count > 0);
                        }
                    }
                }
            }
            return(flag && flag2);
        }
Exemple #2
0
 public CalendarItemBaseData(CalendarItemBaseData other)
 {
     if (other.attachmentIds != null)
     {
         this.attachmentIds = new List <AttachmentId>();
         foreach (AttachmentId item in other.attachmentIds)
         {
             this.attachmentIds.Add(item);
         }
     }
     if (other.attendees != null)
     {
         this.attendees = new List <AttendeeData>();
         foreach (AttendeeData other2 in other.attendees)
         {
             this.attendees.Add(new AttendeeData(other2));
         }
     }
     this.bodyText         = other.bodyText;
     this.bodyFormat       = other.bodyFormat;
     this.calendarItemType = other.calendarItemType;
     this.endTime          = other.endTime;
     this.freeBusyStatus   = other.freeBusyStatus;
     try
     {
         if (other.folderId != null)
         {
             this.folderId = StoreObjectId.Deserialize(other.folderId.GetBytes());
         }
         if (other.id != null)
         {
             this.id = StoreObjectId.Deserialize(other.id.GetBytes());
         }
     }
     catch (ArgumentException)
     {
         throw new OwaInvalidRequestException("Invalid store object id");
     }
     catch (FormatException)
     {
         throw new OwaInvalidRequestException("Invalid store object id");
     }
     this.changeKey             = other.changeKey;
     this.importance            = other.importance;
     this.isAllDayEvent         = other.isAllDayEvent;
     this.isMeeting             = other.isMeeting;
     this.isOrganizer           = other.isOrganizer;
     this.isResponseRequested   = other.isResponseRequested;
     this.location              = other.location;
     this.meetingRequestWasSent = other.meetingRequestWasSent;
     this.organizer             = other.organizer;
     this.parentId              = other.parentId;
     this.sensitivity           = other.sensitivity;
     this.startTime             = other.startTime;
     this.subject = other.subject;
 }
Exemple #3
0
        public static void SetIsResponseRequested(CalendarItemBase calendarItemBase, bool value)
        {
            bool flag = CalendarItemBaseData.GetIsResponseRequested(calendarItemBase);

            if (flag != value)
            {
                calendarItemBase.SetProperties(CalendarItemBaseData.isResponseRequestedPropertyDefinition, new object[]
                {
                    value
                });
            }
        }
Exemple #4
0
        public static bool SyncAttendeesToCalendarItem(CalendarItemBaseData data, CalendarItemBase calendarItemBase)
        {
            bool flag = !data.IsAttendeesEqual(calendarItemBase);

            if (flag)
            {
                calendarItemBase.AttendeeCollection.Clear();
                foreach (AttendeeData attendeeData in data.attendees)
                {
                    calendarItemBase.AttendeeCollection.Add(attendeeData.Participant, attendeeData.AttendeeType, null, null, false);
                }
            }
            return(flag);
        }
Exemple #5
0
        public bool SetLocation(CalendarItemBase calendarItemBase)
        {
            bool result = false;

            if (string.IsNullOrEmpty(calendarItemBase.Location))
            {
                Attendee firstResourceAttendee = CalendarItemBaseData.GetFirstResourceAttendee(calendarItemBase);
                if (firstResourceAttendee != null)
                {
                    this.Location = firstResourceAttendee.Participant.DisplayName;
                    result        = true;
                }
            }
            return(result);
        }
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = string.Empty;
            state  = string.Empty;
            action = string.Empty;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.Type = owaContext.FormsRegistryContext.Type;
            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            bool flag  = false;
            bool flag2 = false;
            CalendarItemBaseData calendarItemBaseData = EditCalendarItemHelper.GetUserContextData(owaContext.UserContext);
            StoreObjectId        storeObjectId        = QueryStringUtilities.CreateItemStoreObjectId(owaContext.UserContext.MailboxSession, owaContext.HttpContext.Request, false);

            if (calendarItemBaseData != null && calendarItemBaseData.Id != null && storeObjectId != null && !calendarItemBaseData.Id.Equals(storeObjectId))
            {
                EditCalendarItemHelper.ClearUserContextData(owaContext.UserContext);
                calendarItemBaseData = null;
            }
            if (calendarItemBaseData != null)
            {
                flag  = calendarItemBaseData.IsOrganizer;
                flag2 = calendarItemBaseData.IsMeeting;
            }
            else
            {
                if (storeObjectId == null)
                {
                    throw new OwaLostContextException("Lost changes since last save.");
                }
                CalendarItemBase calendarItemBase2;
                CalendarItemBase calendarItemBase = calendarItemBase2 = CalendarItemBase.Bind(owaContext.UserContext.MailboxSession, storeObjectId);
                try
                {
                    flag  = calendarItemBase.IsOrganizer();
                    flag2 = calendarItemBase.IsMeeting;
                }
                finally
                {
                    if (calendarItemBase2 != null)
                    {
                        ((IDisposable)calendarItemBase2).Dispose();
                    }
                }
            }
            if (flag2 && !flag)
            {
                preFormActionResponse.Action = "Read";
            }
            else
            {
                preFormActionResponse.Action = "Open";
            }
            string text = "ae,a,t,s";

            for (int i = 0; i < owaContext.HttpContext.Request.QueryString.Count; i++)
            {
                string text2 = owaContext.HttpContext.Request.QueryString.Keys[i];
                if (text.IndexOf(text2, StringComparison.Ordinal) == -1)
                {
                    preFormActionResponse.AddParameter(text2, owaContext.HttpContext.Request.QueryString[text2]);
                }
            }
            return(preFormActionResponse);
        }
        public PreFormActionResponse Execute(OwaContext owaContext, out ApplicationElement applicationElement, out string type, out string state, out string action)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext", "owaContext is null.");
            }
            if (owaContext.HttpContext == null)
            {
                throw new ArgumentNullException("owaContext", "owaContext.HttpContext is null.");
            }
            applicationElement = ApplicationElement.NotSet;
            type   = null;
            state  = null;
            action = null;
            PreFormActionResponse preFormActionResponse = new PreFormActionResponse();

            preFormActionResponse.ApplicationElement = ApplicationElement.Item;
            preFormActionResponse.Type   = "IPM.Appointment";
            preFormActionResponse.Action = string.Empty;
            preFormActionResponse.State  = string.Empty;
            this.request     = owaContext.HttpContext.Request;
            this.userContext = owaContext.UserContext;
            InfobarMessage infobarMessage = null;
            StoreObjectId  storeObjectId  = null;
            string         changeKey      = null;
            string         action2        = owaContext.FormsRegistryContext.Action;
            string         text;

            if (string.Equals(action2, "New", StringComparison.Ordinal))
            {
                text = "new";
            }
            else
            {
                if (!Utilities.IsPostRequest(this.request))
                {
                    return(this.userContext.LastClientViewState.ToPreFormActionResponse());
                }
                text = Utilities.GetFormParameter(this.request, "hidcmdpst");
                string formParameter = Utilities.GetFormParameter(this.request, "hidid", false);
                changeKey = Utilities.GetFormParameter(this.request, "hidchk", false);
                if (!string.IsNullOrEmpty(formParameter))
                {
                    storeObjectId = Utilities.CreateStoreObjectId(this.userContext.MailboxSession, formParameter);
                }
            }
            StoreObjectId calendarFolderId = EditCalendarItemHelper.GetCalendarFolderId(this.request, this.userContext);
            bool          syncCalendarItem = true;

            if (text.Equals("attch", StringComparison.Ordinal))
            {
                syncCalendarItem = false;
            }
            bool flag = true;

            try
            {
                EditCalendarItemHelper.CalendarItemUpdateFlags storeUpdateFlags = EditCalendarItemHelper.CalendarItemUpdateFlags.None;
                if (!text.Equals("cls", StringComparison.Ordinal))
                {
                    storeUpdateFlags = EditCalendarItemHelper.GetCalendarItem(this.userContext, storeObjectId, calendarFolderId, changeKey, syncCalendarItem, out this.calendarItemBase);
                }
                switch (this.DoAction(text, storeUpdateFlags, ref preFormActionResponse, out infobarMessage))
                {
                case EditCalendarItemPreFormAction.RedirectTo.None:
                    throw new OwaInvalidRequestException("Unhandled redirection.");

                case EditCalendarItemPreFormAction.RedirectTo.AddressBook:
                    preFormActionResponse = EditMessageHelper.RedirectToPeoplePicker(owaContext, this.calendarItemBase, AddressBook.Mode.EditCalendar);
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.ADPage:
                    preFormActionResponse = EditMessageHelper.RedirectToRecipient(owaContext, this.calendarItemBase, AddressBook.Mode.EditCalendar);
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.AttachmentManager:
                    if (this.calendarItemBase.Id == null)
                    {
                        CalendarUtilities.SaveCalendarItem(this.calendarItemBase, this.userContext, out infobarMessage);
                    }
                    using (CalendarItemBase calendarItemBase = EditCalendarItemHelper.CreateDraft(this.userContext, null))
                    {
                        CalendarItemBaseData userContextData = EditCalendarItemHelper.GetUserContextData(this.userContext);
                        userContextData.CopyTo(calendarItemBase);
                        string text2;
                        EditCalendarItemHelper.UpdateCalendarItemValues(calendarItemBase, this.userContext, this.request, out text2);
                        EditCalendarItemHelper.CreateUserContextData(this.userContext, calendarItemBase);
                        if (this.calendarItemBase.Id != null)
                        {
                            CalendarItemBaseData userContextData2 = EditCalendarItemHelper.GetUserContextData(this.userContext);
                            userContextData2.Id        = this.calendarItemBase.Id.ObjectId;
                            userContextData2.ChangeKey = this.calendarItemBase.Id.ChangeKeyAsBase64String();
                        }
                    }
                    if (infobarMessage == null)
                    {
                        this.RedirectToAttachmentManager(owaContext, preFormActionResponse);
                    }
                    else
                    {
                        owaContext.PreFormActionData = this.calendarItemBase;
                        flag = false;
                        this.RedirectToEdit(owaContext, infobarMessage, preFormActionResponse);
                    }
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.CalendarDailyView:
                    EditCalendarItemHelper.ClearUserContextData(this.userContext);
                    preFormActionResponse = this.userContext.LastClientViewState.ToPreFormActionResponse();
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.EditCalendarItem:
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    owaContext.PreFormActionData = this.calendarItemBase;
                    flag = false;
                    this.RedirectToEdit(owaContext, infobarMessage, preFormActionResponse);
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.EditRecurrence:
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    owaContext.PreFormActionData = CalendarItemBaseData.Create(this.calendarItemBase);
                    preFormActionResponse.Action = "EditRecurrence";
                    if (this.calendarItemBase.IsDirty)
                    {
                        preFormActionResponse.AddParameter("cd", "1");
                    }
                    break;

                case EditCalendarItemPreFormAction.RedirectTo.SchedulingTab:
                    EditCalendarItemHelper.CreateUserContextData(this.userContext, this.calendarItemBase);
                    owaContext.PreFormActionData = this.calendarItemBase;
                    this.RedirectToSchedulingTab(owaContext, infobarMessage, preFormActionResponse);
                    flag = false;
                    break;

                default:
                    throw new OwaInvalidRequestException("Unhandled redirection enum value in EditCalendarItemPreFormAction.");
                }
            }
            catch
            {
                flag = true;
                EditCalendarItemHelper.ClearUserContextData(this.userContext);
                throw;
            }
            finally
            {
                if (flag && this.calendarItemBase != null)
                {
                    this.calendarItemBase.Dispose();
                    this.calendarItemBase = null;
                }
            }
            return(preFormActionResponse);
        }
Exemple #8
0
 public virtual EditCalendarItemHelper.CalendarItemUpdateFlags CopyTo(CalendarItemBase calendarItemBase)
 {
     if (calendarItemBase.Id != null && (this.id == null || this.id.CompareTo(calendarItemBase.Id.ObjectId) != 0))
     {
         throw new OwaLostContextException("Lost changes since last save.");
     }
     EditCalendarItemHelper.CalendarItemUpdateFlags calendarItemUpdateFlags = EditCalendarItemHelper.CalendarItemUpdateFlags.None;
     if (EditCalendarItemHelper.BodyChanged(this.bodyText, calendarItemBase))
     {
         if (!string.IsNullOrEmpty(this.bodyText))
         {
             if (this.bodyFormat == BodyFormat.TextHtml)
             {
                 ItemUtility.SetItemBody(calendarItemBase, BodyFormat.TextHtml, this.bodyText);
                 calendarItemUpdateFlags |= EditCalendarItemHelper.CalendarItemUpdateFlags.OtherChanged;
             }
             else
             {
                 if (this.bodyFormat != BodyFormat.TextPlain)
                 {
                     throw new ArgumentOutOfRangeException("calendarItemBase", "Unhandled body format type : " + this.bodyFormat);
                 }
                 ItemUtility.SetItemBody(calendarItemBase, BodyFormat.TextPlain, this.bodyText);
                 calendarItemUpdateFlags |= EditCalendarItemHelper.CalendarItemUpdateFlags.OtherChanged;
             }
         }
         else
         {
             ItemUtility.SetItemBody(calendarItemBase, BodyFormat.TextPlain, string.Empty);
             calendarItemUpdateFlags |= EditCalendarItemHelper.CalendarItemUpdateFlags.OtherChanged;
         }
     }
     if (this.freeBusyStatus != calendarItemBase.FreeBusyStatus)
     {
         calendarItemBase.FreeBusyStatus = this.freeBusyStatus;
         calendarItemUpdateFlags        |= EditCalendarItemHelper.CalendarItemUpdateFlags.OtherChanged;
     }
     if (calendarItemBase.Importance != this.importance)
     {
         calendarItemBase.Importance = this.importance;
         calendarItemUpdateFlags    |= EditCalendarItemHelper.CalendarItemUpdateFlags.OtherChanged;
     }
     if (calendarItemBase.IsAllDayEvent != this.isAllDayEvent)
     {
         calendarItemBase.IsAllDayEvent = this.isAllDayEvent;
         calendarItemUpdateFlags       |= EditCalendarItemHelper.CalendarItemUpdateFlags.TimeChanged;
     }
     if (calendarItemBase.IsMeeting != this.isMeeting)
     {
         calendarItemBase.IsMeeting = this.isMeeting;
         calendarItemUpdateFlags   |= EditCalendarItemHelper.CalendarItemUpdateFlags.OtherChanged;
     }
     if (CalendarItemBaseData.GetIsResponseRequested(calendarItemBase) != this.isResponseRequested)
     {
         CalendarItemBaseData.SetIsResponseRequested(calendarItemBase, this.isResponseRequested);
         calendarItemUpdateFlags |= EditCalendarItemHelper.CalendarItemUpdateFlags.OtherChanged;
     }
     if (!CalendarUtilities.StringsEqualNullEmpty(calendarItemBase.Location, this.location, StringComparison.CurrentCulture))
     {
         calendarItemUpdateFlags  |= EditCalendarItemHelper.CalendarItemUpdateFlags.LocationChanged;
         calendarItemBase.Location = ((this.location != null) ? this.location : string.Empty);
     }
     CalendarItemBaseData.SyncAttendeesToCalendarItem(this, calendarItemBase);
     if (calendarItemBase.AttendeesChanged)
     {
         calendarItemUpdateFlags |= EditCalendarItemHelper.CalendarItemUpdateFlags.AttendeesChanged;
     }
     if (calendarItemBase.Sensitivity != this.sensitivity)
     {
         calendarItemBase.Sensitivity = this.sensitivity;
         calendarItemUpdateFlags     |= EditCalendarItemHelper.CalendarItemUpdateFlags.OtherChanged;
     }
     if (calendarItemBase.EndTime != this.endTime)
     {
         calendarItemUpdateFlags |= EditCalendarItemHelper.CalendarItemUpdateFlags.TimeChanged;
         calendarItemBase.EndTime = this.endTime;
     }
     if (calendarItemBase.StartTime != this.startTime)
     {
         calendarItemUpdateFlags   |= EditCalendarItemHelper.CalendarItemUpdateFlags.TimeChanged;
         calendarItemBase.StartTime = this.startTime;
     }
     if (!CalendarUtilities.StringsEqualNullEmpty(calendarItemBase.Subject, this.subject, StringComparison.CurrentCulture))
     {
         calendarItemBase.Subject = ((this.subject != null) ? this.subject : string.Empty);
         calendarItemUpdateFlags |= EditCalendarItemHelper.CalendarItemUpdateFlags.OtherChanged;
     }
     return(calendarItemUpdateFlags);
 }
Exemple #9
0
 public virtual void SetFrom(CalendarItemBase calendarItemBase)
 {
     if (this.attachmentIds == null)
     {
         this.attachmentIds = new List <AttachmentId>();
     }
     else
     {
         this.attachmentIds.Clear();
     }
     if (this.attendees == null)
     {
         this.attendees = new List <AttendeeData>();
     }
     else
     {
         this.attendees.Clear();
     }
     if (calendarItemBase.AttachmentCollection != null)
     {
         foreach (AttachmentHandle handle in calendarItemBase.AttachmentCollection)
         {
             using (Attachment attachment = calendarItemBase.AttachmentCollection.Open(handle))
             {
                 if (attachment.Id == null)
                 {
                     throw new ArgumentNullException("attachment.Id");
                 }
                 this.attachmentIds.Add(attachment.Id);
             }
         }
     }
     if (calendarItemBase.Body != null)
     {
         this.bodyText   = ItemUtility.GetItemBody(calendarItemBase, BodyFormat.TextPlain);
         this.bodyFormat = BodyFormat.TextPlain;
     }
     this.calendarItemType = calendarItemBase.CalendarItemType;
     this.endTime          = calendarItemBase.EndTime;
     this.freeBusyStatus   = calendarItemBase.FreeBusyStatus;
     try
     {
         if (calendarItemBase.ParentId != null)
         {
             this.folderId = StoreObjectId.Deserialize(calendarItemBase.ParentId.GetBytes());
         }
         else
         {
             this.folderId = null;
         }
         if (calendarItemBase.Id != null && calendarItemBase.Id.ObjectId != null)
         {
             this.id = StoreObjectId.Deserialize(calendarItemBase.Id.ObjectId.GetBytes());
         }
         else
         {
             this.id = null;
         }
     }
     catch (ArgumentException)
     {
         throw new OwaInvalidRequestException("Invalid store object id");
     }
     catch (FormatException)
     {
         throw new OwaInvalidRequestException("Invalid store object id");
     }
     if (calendarItemBase.Id != null)
     {
         this.changeKey = calendarItemBase.Id.ChangeKeyAsBase64String();
     }
     else
     {
         this.changeKey = null;
     }
     this.importance            = calendarItemBase.Importance;
     this.isAllDayEvent         = calendarItemBase.IsAllDayEvent;
     this.isMeeting             = calendarItemBase.IsMeeting;
     this.isOrganizer           = calendarItemBase.IsOrganizer();
     this.isResponseRequested   = CalendarItemBaseData.GetIsResponseRequested(calendarItemBase);
     this.location              = calendarItemBase.Location;
     this.meetingRequestWasSent = calendarItemBase.MeetingRequestWasSent;
     this.organizer             = AttendeeData.CloneParticipant(calendarItemBase.Organizer);
     if (calendarItemBase.ParentId != null)
     {
         this.parentId = StoreObjectId.FromProviderSpecificId(calendarItemBase.ParentId.ProviderLevelItemId);
     }
     if (calendarItemBase.AttendeeCollection != null)
     {
         foreach (Attendee attendee in calendarItemBase.AttendeeCollection)
         {
             this.attendees.Add(new AttendeeData(attendee));
         }
     }
     this.sensitivity = calendarItemBase.Sensitivity;
     this.startTime   = calendarItemBase.StartTime;
     this.subject     = calendarItemBase.Subject;
 }