// 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);
        }
Exemplo n.º 2
0
        public override void SetFrom(CalendarItemBase calendarItemBase)
        {
            base.SetFrom(calendarItemBase);
            CalendarItem calendarItem = calendarItemBase as CalendarItem;

            if (calendarItem != null)
            {
                this.recurrence = CalendarItemData.CloneRecurrence(calendarItem.Recurrence);
            }
        }
Exemplo n.º 3
0
        public override EditCalendarItemHelper.CalendarItemUpdateFlags CopyTo(CalendarItemBase calendarItemBase)
        {
            EditCalendarItemHelper.CalendarItemUpdateFlags calendarItemUpdateFlags = base.CopyTo(calendarItemBase);
            CalendarItem calendarItem = calendarItemBase as CalendarItem;

            if (calendarItem != null && !CalendarItemData.IsRecurrenceEqual(calendarItem.Recurrence, this.recurrence))
            {
                calendarItem.Recurrence  = CalendarItemData.CloneRecurrence(this.recurrence);
                calendarItemUpdateFlags |= EditCalendarItemHelper.CalendarItemUpdateFlags.OtherChanged;
            }
            return(calendarItemUpdateFlags);
        }
        // Token: 0x060001CA RID: 458 RVA: 0x000111AC File Offset: 0x0000F3AC
        private static CalendarItemData CreateCalendarItemDataFromRequest(HttpRequest request, UserContext userContext)
        {
            CalendarItemData calendarItemData = new CalendarItemData();
            string           formParameter    = Utilities.GetFormParameter(request, "hidid");
            string           formParameter2   = Utilities.GetFormParameter(request, "hidfid");

            try
            {
                if (!string.IsNullOrEmpty(formParameter))
                {
                    calendarItemData.Id = StoreObjectId.Deserialize(formParameter);
                }
                else
                {
                    calendarItemData.Id = null;
                }
                if (!string.IsNullOrEmpty(formParameter2))
                {
                    calendarItemData.FolderId = StoreObjectId.Deserialize(formParameter2);
                }
                else
                {
                    calendarItemData.FolderId = null;
                }
            }
            catch (ArgumentException)
            {
                throw new OwaInvalidRequestException("Invalid store object id");
            }
            catch (FormatException)
            {
                throw new OwaInvalidRequestException("Invalid store object id");
            }
            ExDateTime startDate        = CalendarUtilities.ParseDateTimeFromForm(request, "selSY", "selSM", "selSD", null, userContext);
            TimeSpan   value            = CalendarUtilities.ParseTimeFromForm(request, "sttm");
            int        intValueFromForm = RequestParser.GetIntValueFromForm(request, "drtn");

            calendarItemData.StartTime = startDate.Add(value);
            calendarItemData.EndTime   = calendarItemData.StartTime.AddMinutes((double)intValueFromForm);
            if (calendarItemData.EndTime < calendarItemData.StartTime)
            {
                calendarItemData.EndTime = calendarItemData.StartTime.AddHours(1.0);
            }
            calendarItemData.Subject    = Utilities.GetFormParameter(request, "hidsubj", false);
            calendarItemData.Location   = Utilities.GetFormParameter(request, "hidloc", false);
            calendarItemData.Recurrence = EditRecurrencePreFormAction.CreateRecurrenceFromRequest(request, startDate, userContext);
            if (calendarItemData.Recurrence != null)
            {
                calendarItemData.IsAllDayEvent = Utilities.IsAllDayEvent(calendarItemData.StartTime, calendarItemData.EndTime);
            }
            return(calendarItemData);
        }
 // Token: 0x060001C9 RID: 457 RVA: 0x0001109C File Offset: 0x0000F29C
 private static bool ValidateCalendarItemData(UserContext userContext, CalendarItemData calendarItemData, out InfobarMessage infobarMessage)
 {
     infobarMessage = null;
     if (calendarItemData == null)
     {
         throw new ArgumentNullException("calendarItemData");
     }
     if (calendarItemData.FolderId == null)
     {
         throw new ArgumentNullException("calendarItemData", "calendarItemData.FolderId is null");
     }
     if (userContext == null)
     {
         throw new ArgumentNullException("userContext");
     }
     if (userContext.MailboxSession == null)
     {
         throw new ArgumentNullException("userContext", "userContext.MailboxSession is null");
     }
     using (CalendarItem calendarItem = CalendarItem.Create(userContext.MailboxSession, userContext.CalendarFolderId))
     {
         LocalizedException ex = null;
         try
         {
             calendarItemData.CopyTo(calendarItem);
             calendarItem.Validate();
         }
         catch (StoragePermanentException ex2)
         {
             ex = ex2;
         }
         catch (StorageTransientException ex3)
         {
             ex = ex3;
         }
         if (ex != null)
         {
             ErrorInformation exceptionHandlingInformation = Utilities.GetExceptionHandlingInformation(ex, userContext.MailboxIdentity);
             string           messageText = exceptionHandlingInformation.Message;
             if (ex is CorruptDataException && calendarItemData.EndTime < calendarItemData.StartTime)
             {
                 messageText = LocalizedStrings.GetNonEncoded(2047223147);
             }
             infobarMessage = InfobarMessage.CreateText(messageText, InfobarMessageType.Error);
         }
     }
     return(infobarMessage == null);
 }
Exemplo n.º 6
0
        public static Recurrence CloneRecurrence(Recurrence recurrence)
        {
            Recurrence result = null;

            if (recurrence != null)
            {
                if (recurrence.CreatedExTimeZone != ExTimeZone.UtcTimeZone && recurrence.ReadExTimeZone != ExTimeZone.UtcTimeZone)
                {
                    result = new Recurrence(CalendarItemData.CloneRecurrencePattern(recurrence.Pattern), CalendarItemData.CloneRecurrenceRange(recurrence.Range), recurrence.CreatedExTimeZone, recurrence.ReadExTimeZone);
                }
                else
                {
                    result = new Recurrence(CalendarItemData.CloneRecurrencePattern(recurrence.Pattern), CalendarItemData.CloneRecurrenceRange(recurrence.Range));
                }
            }
            return(result);
        }
Exemplo n.º 7
0
 public static bool IsRecurrenceEqual(Recurrence r1, Recurrence r2)
 {
     if (r1 == null != (r2 == null))
     {
         return(false);
     }
     if (r1 != null)
     {
         if (!CalendarItemData.IsRecurrencePatternEqual(r1.Pattern, r2.Pattern))
         {
             return(false);
         }
         if (!CalendarItemData.IsRecurrenceRangeEqual(r1.Range, r2.Range))
         {
             return(false);
         }
     }
     return(true);
 }
        // Token: 0x060001C6 RID: 454 RVA: 0x00010D1C File Offset: 0x0000EF1C
        public static Recurrence ChangeRecurrenceType(Recurrence recurrence, OwaRecurrenceType newRecurrenceType)
        {
            OwaRecurrenceType owaRecurrenceType = CalendarUtilities.MapRecurrenceType(recurrence);

            if (owaRecurrenceType == newRecurrenceType)
            {
                return(recurrence);
            }
            RecurrencePattern pattern = CalendarUtilities.CreateDefaultRecurrencePattern(newRecurrenceType, recurrence.Range.StartDate);
            RecurrenceRange   range   = CalendarItemData.CloneRecurrenceRange(recurrence.Range);
            Recurrence        result;

            if (recurrence.CreatedExTimeZone != ExTimeZone.UtcTimeZone && recurrence.ReadExTimeZone != ExTimeZone.UtcTimeZone)
            {
                result = new Recurrence(pattern, range, recurrence.CreatedExTimeZone, recurrence.ReadExTimeZone);
            }
            else
            {
                result = new Recurrence(pattern, range);
            }
            return(result);
        }
        // Token: 0x060001C8 RID: 456 RVA: 0x00010DA0 File Offset: 0x0000EFA0
        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");
            }
            if (owaContext.HttpContext.Request == null)
            {
                throw new ArgumentNullException("owaContext", "owaContext.HttpContext.Request 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;
            if (!Utilities.IsPostRequest(this.request))
            {
                return(this.userContext.LastClientViewState.ToPreFormActionResponse());
            }
            InfobarMessage   value = null;
            string           queryStringParameter = Utilities.GetQueryStringParameter(this.request, "a", false);
            CalendarItemData calendarItemData     = EditRecurrencePreFormAction.CreateCalendarItemDataFromRequest(this.request, this.userContext);
            bool             flag = false;
            string           a;

            EditRecurrencePreFormAction.RedirectTo redirectTo;
            if ((a = queryStringParameter) != null)
            {
                if (a == "ChangeRecurrenceMode")
                {
                    if (!string.IsNullOrEmpty(Utilities.GetQueryStringParameter(this.request, "d", false)))
                    {
                        preFormActionResponse.AddParameter("d", "1");
                    }
                    string formParameter = Utilities.GetFormParameter(this.request, "hidcidrt", true);
                    int    num;
                    if (!string.IsNullOrEmpty(formParameter) && int.TryParse(formParameter, out num) && num > 0)
                    {
                        preFormActionResponse.AddParameter("cd", "1");
                    }
                    redirectTo = EditRecurrencePreFormAction.RedirectTo.EditRecurrence;
                    goto IL_217;
                }
                if (a == "CloseRecurrence")
                {
                    redirectTo = EditRecurrencePreFormAction.RedirectTo.EditCalendarItem;
                    goto IL_217;
                }
                if (a == "RemoveRecurrence")
                {
                    calendarItemData.Recurrence = null;
                    flag       = true;
                    redirectTo = EditRecurrencePreFormAction.RedirectTo.EditCalendarItem;
                    goto IL_217;
                }
                if (!(a == "SaveRecurrence"))
                {
                    if (a == "ConfirmedSaveRecurrence")
                    {
                        flag       = true;
                        redirectTo = EditRecurrencePreFormAction.RedirectTo.EditCalendarItem;
                        goto IL_217;
                    }
                }
                else
                {
                    bool flag2 = EditRecurrencePreFormAction.ValidateCalendarItemData(this.userContext, calendarItemData, out value);
                    if (!flag2)
                    {
                        redirectTo = EditRecurrencePreFormAction.RedirectTo.EditRecurrence;
                        goto IL_217;
                    }
                    if (EditRecurrencePreFormAction.CheckNeedPatternChangeConfirmation(this.userContext, calendarItemData))
                    {
                        redirectTo = EditRecurrencePreFormAction.RedirectTo.EditRecurrence;
                        preFormActionResponse.AddParameter("pcp", "1");
                        goto IL_217;
                    }
                    flag       = true;
                    redirectTo = EditRecurrencePreFormAction.RedirectTo.EditCalendarItem;
                    goto IL_217;
                }
            }
            redirectTo = EditRecurrencePreFormAction.RedirectTo.EditRecurrence;
IL_217:
            if (flag)
            {
                CalendarItemData calendarItemData2 = EditCalendarItemHelper.GetUserContextData(this.userContext) as CalendarItemData;
                if (calendarItemData2 == null)
                {
                    throw new OwaInvalidRequestException("UserContext didn't have a CalendarItemData object.");
                }
                calendarItemData2.Recurrence = calendarItemData.Recurrence;
                if (calendarItemData.Recurrence != null)
                {
                    calendarItemData2.StartTime     = calendarItemData.StartTime;
                    calendarItemData2.EndTime       = calendarItemData.EndTime;
                    calendarItemData2.IsAllDayEvent = calendarItemData.IsAllDayEvent;
                }
            }
            switch (redirectTo)
            {
            case EditRecurrencePreFormAction.RedirectTo.None:
                throw new OwaInvalidRequestException("Unhandled redirection in EditRecurrencePreFormAction.");

            case EditRecurrencePreFormAction.RedirectTo.EditRecurrence:
                owaContext.PreFormActionData = calendarItemData;
                preFormActionResponse.Action = "EditRecurrence";
                break;

            case EditRecurrencePreFormAction.RedirectTo.EditCalendarItem:
                preFormActionResponse.Action = "Open";
                if (calendarItemData.Id != null)
                {
                    owaContext.PreFormActionId = OwaStoreObjectId.CreateFromMailboxItemId(calendarItemData.Id);
                }
                break;

            default:
                throw new OwaInvalidRequestException("Unhandled redirection enum value in EditRecurrencePreFormAction.");
            }
            owaContext[OwaContextProperty.InfobarMessage] = value;
            return(preFormActionResponse);
        }
Exemplo n.º 10
0
 public CalendarItemData(CalendarItemData other) : base(other)
 {
     this.recurrence = CalendarItemData.CloneRecurrence(other.recurrence);
 }