Incorrect RecurrenceRule creating - URGENT

2 posts, 0 answers
  1. Joakim Linnarsson
    Joakim Linnarsson avatar
    10 posts
    Member since:
    Nov 2009

    Posted 01 Apr 2015 Link to this post

    Hi,

    We are facing critical issue here with Calender control and which needs to be fixed TODAY itself. Seeking urgent support in this.

    We are passing parameter as Interval :14 and Recurrence is DailyPattern as seen in the screenshot but the rule is creating as DailyPattern and Interval: 1 which is incorrect.

    Interval must be 14 as we have passed but the function :

    var rrule = RecurrenceRule.FromPatternAndRange(schedulerPattern, schedulerRange); >> Creating Interval as 1 instead of 14. 

    Complete function code is attached:

     
    private RecurrenceRule CreateRecurrenceRule(Appointment appq, ExchangeService service)
           {
               var pattern = (Microsoft.Exchange.WebServices.Data.Recurrence.IntervalPattern)appq.Recurrence;
               var interval = pattern.Interval;
               var schedulerPattern = new RecurrencePattern();
               var schedulerRange = new RecurrenceRange { Start = appq.Start, EventDuration = appq.Duration };
               if (!appq.Recurrence.HasEnd) { }
               else
               {
                   if (appq.Recurrence.NumberOfOccurrences != null)
                       schedulerRange.MaxOccurrences = Convert.ToInt32(appq.Recurrence.NumberOfOccurrences);
                   else if (appq.Recurrence.EndDate != null)
                       schedulerRange.RecursUntil = Convert.ToDateTime(appq.Recurrence.EndDate).Date.AddMinutes(appq.Duration.Minutes);
                   if (appq.Recurrence.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Recurrence.DailyPattern) || appq.Recurrence.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Recurrence.DailyRegenerationPattern))
                   {
                       schedulerPattern.Frequency = RecurrenceFrequency.Daily;
                       schedulerPattern.Interval = interval;
                   }
                   else if (appq.Recurrence.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Recurrence.WeeklyPattern) || appq.Recurrence.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Recurrence.WeeklyRegenerationPattern))
                   {
                       var weekpattern = (Microsoft.Exchange.WebServices.Data.Recurrence.WeeklyPattern)appq.Recurrence;
                       schedulerPattern.Frequency = RecurrenceFrequency.Weekly;
                       schedulerPattern.Interval = interval;
                       var dayOfWeekMask = new RecurrenceDay();
                       foreach (var day in weekpattern.DaysOfTheWeek)
                       {
                           switch (day)
                           {
                               case DayOfTheWeek.Monday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Monday; break;
                               case DayOfTheWeek.Tuesday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Tuesday; break;
                               case DayOfTheWeek.Wednesday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Wednesday; break;
                               case DayOfTheWeek.Thursday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Thursday; break;
                               case DayOfTheWeek.Friday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Friday; break;
                               case DayOfTheWeek.Saturday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Saturday; break;
                               case DayOfTheWeek.Sunday: dayOfWeekMask = dayOfWeekMask | RecurrenceDay.Sunday; break;
                           }
                       }
                       schedulerPattern.DaysOfWeekMask = dayOfWeekMask;
                   }
                   else if (appq.Recurrence.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Recurrence.MonthlyPattern) || appq.Recurrence.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Recurrence.MonthlyRegenerationPattern))
                   {
                       var monthpattern = (Microsoft.Exchange.WebServices.Data.Recurrence.MonthlyPattern)appq.Recurrence;
                       schedulerPattern.Frequency = RecurrenceFrequency.Monthly;
                       schedulerPattern.Interval = interval;
                       schedulerPattern.DayOfMonth = monthpattern.DayOfMonth;
                   }
                   else if (appq.Recurrence.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Recurrence.RelativeMonthlyPattern))
                   {
                       var monthpattern = (Microsoft.Exchange.WebServices.Data.Recurrence.RelativeMonthlyPattern)appq.Recurrence;
                       schedulerPattern.Frequency = RecurrenceFrequency.Monthly;
                       schedulerPattern.Interval = interval;
                       schedulerPattern.DaysOfWeekMask = GetDayOfWeekMask(monthpattern.DayOfTheWeek);
                       schedulerPattern.DayOrdinal = GetDayOfTheWeekIndex(monthpattern.DayOfTheWeekIndex);
                   }
                   else if (appq.Recurrence.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Recurrence.YearlyPattern) || appq.Recurrence.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Recurrence.YearlyRegenerationPattern))
                   {
                       var yearpattern = (Microsoft.Exchange.WebServices.Data.Recurrence.YearlyPattern)appq.Recurrence;
                       schedulerPattern.Frequency = RecurrenceFrequency.Yearly;
                       schedulerPattern.DayOfMonth = yearpattern.DayOfMonth;
                       schedulerPattern.Month = GetRecurrenceMonth(yearpattern.Month);
                   }
                   else if (appq.Recurrence.GetType() == typeof(Microsoft.Exchange.WebServices.Data.Recurrence.RelativeYearlyPattern))
                   {
                       var yearpattern = (Microsoft.Exchange.WebServices.Data.Recurrence.RelativeYearlyPattern)appq.Recurrence;
                       schedulerPattern.Frequency = RecurrenceFrequency.Yearly;
                       schedulerPattern.DaysOfWeekMask = GetDayOfWeekMask(yearpattern.DayOfTheWeek);
                       schedulerPattern.DayOrdinal = GetDayOfTheWeekIndex(yearpattern.DayOfTheWeekIndex);
                       schedulerPattern.Month = GetRecurrenceMonth(yearpattern.Month);
                   }
                   var rrule = RecurrenceRule.FromPatternAndRange(schedulerPattern, schedulerRange);
                    
                   if (appq.ModifiedOccurrences != null)
                   {
                       foreach (var item in appq.ModifiedOccurrences)
                       {
                           rrule.Exceptions.Add(new DateTime(Convert.ToInt32(item.OriginalStart.Year), Convert.ToInt32(item.OriginalStart.Month), Convert.ToInt32(item.OriginalStart.Day), Convert.ToInt32(item.OriginalStart.Hour), Convert.ToInt32(item.OriginalStart.Minute), Convert.ToInt32(item.OriginalStart.Second)).ToLocalTime());
                       }
                   }
                   if (appq.DeletedOccurrences == null) return rrule;
                   foreach (var item in appq.DeletedOccurrences)
                   {
                       rrule.Exceptions.Add(new DateTime(Convert.ToInt32(item.OriginalStart.Year), Convert.ToInt32(item.OriginalStart.Month), Convert.ToInt32(item.OriginalStart.Day), Convert.ToInt32(item.OriginalStart.Hour), Convert.ToInt32(item.OriginalStart.Minute), Convert.ToInt32(item.OriginalStart.Second)).ToLocalTime());
                   }
                   return rrule;
               }
               return null;
           }

    Please help us in this   URGENT as we need to fix today.
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 03 Apr 2015 Link to this post

    Hi Joakim,

    We are not aware of this issue. Is it possible that you attach sample page that we can debug locally. Please make sure that it is runnable and does not depends on other code that we don't have.

    Thanks.

    Regards,
    Hristo Valyavicharski
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top