Esempio n. 1
0
		internal static RecurrenceInfo GetInfo(Recurrence recurrenceObject)
		{
			RecurrenceInfo recurrenceInfo = null;
			InternalRecurrence internalRecurrence = recurrenceObject as InternalRecurrence;
			if (internalRecurrence != null)
			{
				recurrenceInfo = new RecurrenceInfo();
				recurrenceInfo.StartDate = internalRecurrence.Range.StartDate;
				recurrenceInfo.EndDate = internalRecurrence.EndDate;
				if (internalRecurrence.Range is EndDateRecurrenceRange)
				{
					recurrenceInfo.Range = RecurrenceRangeType.End;
					recurrenceInfo.EndDate = ((EndDateRecurrenceRange)internalRecurrence.Range).EndDate;
				}
				else if (internalRecurrence.Range is NumberedRecurrenceRange)
				{
					recurrenceInfo.Range = RecurrenceRangeType.AfterNOccur;
					recurrenceInfo.NumberOfOccurrences = ((NumberedRecurrenceRange)internalRecurrence.Range).NumberOfOccurrences;
				}
				else
				{
					recurrenceInfo.Range = RecurrenceRangeType.NoEnd;
				}
				recurrenceInfo.SetPatternSpecificProperties(internalRecurrence.Pattern);
				recurrenceInfo.Anomalies = internalRecurrence.Anomalies;
				recurrenceInfo.ModifiedOccurrences = internalRecurrence.GetModifiedOccurrences();
				recurrenceInfo.DeletedOccurrences = internalRecurrence.GetDeletedOccurrences();
			}
			return recurrenceInfo;
		}
Esempio n. 2
0
 private void DemoteVEvents(IList <Item> items)
 {
     foreach (Item item in items)
     {
         ExTimeZone exTimeZone = item.PropertyBag.ExTimeZone;
         try
         {
             REG_TIMEZONE_INFO reg_TIMEZONE_INFO = TimeZoneHelper.RegTimeZoneInfoFromExTimeZone(TimeZoneHelper.GetExTimeZoneFromItem(item));
             string            text = this.demotingTimeZones[reg_TIMEZONE_INFO];
             item.PropertyBag.ExTimeZone = TimeZoneHelper.CreateCustomExTimeZoneFromRegTimeZoneInfo(reg_TIMEZONE_INFO, text, text);
             VEvent vevent = new VEvent(this);
             vevent.Demote(item);
             if (!base.OutboundContext.SuppressExceptionAndAttachmentDemotion && (base.Context.Method == CalendarMethod.Request || base.Context.Method == CalendarMethod.Cancel || base.Context.Method == CalendarMethod.Publish))
             {
                 InternalRecurrence recurrenceFromItem = CalendarItem.GetRecurrenceFromItem(item);
                 if (recurrenceFromItem != null)
                 {
                     IList <OccurrenceInfo> modifiedOccurrences = recurrenceFromItem.GetModifiedOccurrences();
                     foreach (OccurrenceInfo occurrenceInfo in modifiedOccurrences)
                     {
                         ExceptionInfo exceptionInfo = (ExceptionInfo)occurrenceInfo;
                         VEvent        vevent2       = new VEvent(this);
                         vevent2.DemoteException(exceptionInfo, vevent);
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             ExTraceGlobals.ICalTracer.TraceError <Exception>((long)this.GetHashCode(), "VCalendar::DemoteVEvents. Skipping item due to {0}", ex);
             base.Context.AddError(ServerStrings.InvalidICalElement(ex.ToString()));
         }
         finally
         {
             item.PropertyBag.ExTimeZone = exTimeZone;
         }
     }
 }