Ejemplo n.º 1
0
        private static Dictionary <REG_TIMEZONE_INFO, string> CollectTimeZones(IList <Item> items)
        {
            Dictionary <REG_TIMEZONE_INFO, string> dictionary = new Dictionary <REG_TIMEZONE_INFO, string>();

            foreach (Item item in items)
            {
                ExTimeZone        exTimeZoneFromItem = TimeZoneHelper.GetExTimeZoneFromItem(item);
                REG_TIMEZONE_INFO key  = TimeZoneHelper.RegTimeZoneInfoFromExTimeZone(exTimeZoneFromItem);
                string            text = CalendarUtil.RemoveDoubleQuotes(string.IsNullOrEmpty(exTimeZoneFromItem.AlternativeId) ? exTimeZoneFromItem.DisplayName : exTimeZoneFromItem.AlternativeId);
                if (!string.IsNullOrEmpty(text) && text.EndsWith("\r\n"))
                {
                    text = text.Substring(0, text.Length - 2);
                }
                string value = text;
                if (!dictionary.ContainsKey(key))
                {
                    int num = 0;
                    while (string.IsNullOrEmpty(value) || dictionary.ContainsValue(value))
                    {
                        value = string.Format("{0} {1}", text, ++num);
                    }
                    dictionary.Add(key, value);
                }
            }
            return(dictionary);
        }
Ejemplo n.º 2
0
        public static ExTimeZone GetPromotedTimeZoneFromItem(Item item)
        {
            ExTimeZone exTimeZoneFromItem = TimeZoneHelper.GetExTimeZoneFromItem(item);
            ExTimeZone exTimeZone         = null;

            if (exTimeZoneFromItem != null)
            {
                exTimeZone = TimeZoneHelper.PromoteCustomizedTimeZone(exTimeZoneFromItem);
            }
            return(exTimeZone ?? exTimeZoneFromItem);
        }
Ejemplo n.º 3
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;
         }
     }
 }