Exemplo n.º 1
0
 public static bool IsRecurrencePatternEqual(RecurrencePattern p1, RecurrencePattern p2)
 {
     if (p1 == null != (p2 == null))
     {
         return(false);
     }
     if (p1 != null)
     {
         if (!p1.GetType().Equals(p2.GetType()))
         {
             return(false);
         }
         DailyRecurrencePattern dailyRecurrencePattern = p1 as DailyRecurrencePattern;
         if (dailyRecurrencePattern != null)
         {
             DailyRecurrencePattern dailyRecurrencePattern2 = p2 as DailyRecurrencePattern;
             return(dailyRecurrencePattern.RecurrenceInterval == dailyRecurrencePattern2.RecurrenceInterval);
         }
         WeeklyRecurrencePattern weeklyRecurrencePattern = p1 as WeeklyRecurrencePattern;
         if (weeklyRecurrencePattern != null)
         {
             WeeklyRecurrencePattern weeklyRecurrencePattern2 = p2 as WeeklyRecurrencePattern;
             return(weeklyRecurrencePattern.DaysOfWeek == weeklyRecurrencePattern2.DaysOfWeek && weeklyRecurrencePattern.FirstDayOfWeek == weeklyRecurrencePattern2.FirstDayOfWeek && weeklyRecurrencePattern.RecurrenceInterval == weeklyRecurrencePattern2.RecurrenceInterval);
         }
         MonthlyRecurrencePattern monthlyRecurrencePattern = p1 as MonthlyRecurrencePattern;
         if (monthlyRecurrencePattern != null)
         {
             MonthlyRecurrencePattern monthlyRecurrencePattern2 = p2 as MonthlyRecurrencePattern;
             return(monthlyRecurrencePattern.CalendarType == monthlyRecurrencePattern2.CalendarType && monthlyRecurrencePattern.DayOfMonth == monthlyRecurrencePattern2.DayOfMonth && monthlyRecurrencePattern.RecurrenceInterval == monthlyRecurrencePattern2.RecurrenceInterval);
         }
         MonthlyThRecurrencePattern monthlyThRecurrencePattern = p1 as MonthlyThRecurrencePattern;
         if (monthlyThRecurrencePattern != null)
         {
             MonthlyThRecurrencePattern monthlyThRecurrencePattern2 = p2 as MonthlyThRecurrencePattern;
             return(monthlyThRecurrencePattern.CalendarType == monthlyThRecurrencePattern2.CalendarType && monthlyThRecurrencePattern.DaysOfWeek == monthlyThRecurrencePattern2.DaysOfWeek && monthlyThRecurrencePattern.Order == monthlyThRecurrencePattern2.Order && monthlyThRecurrencePattern.RecurrenceInterval == monthlyThRecurrencePattern2.RecurrenceInterval);
         }
         YearlyRecurrencePattern yearlyRecurrencePattern = p1 as YearlyRecurrencePattern;
         if (yearlyRecurrencePattern != null)
         {
             YearlyRecurrencePattern yearlyRecurrencePattern2 = p2 as YearlyRecurrencePattern;
             return(yearlyRecurrencePattern.CalendarType == yearlyRecurrencePattern2.CalendarType && yearlyRecurrencePattern.DayOfMonth == yearlyRecurrencePattern2.DayOfMonth && yearlyRecurrencePattern.IsLeapMonth == yearlyRecurrencePattern2.IsLeapMonth && yearlyRecurrencePattern.Month == yearlyRecurrencePattern2.Month);
         }
         YearlyThRecurrencePattern yearlyThRecurrencePattern = p1 as YearlyThRecurrencePattern;
         if (yearlyThRecurrencePattern != null)
         {
             YearlyThRecurrencePattern yearlyThRecurrencePattern2 = p2 as YearlyThRecurrencePattern;
             return(yearlyThRecurrencePattern.CalendarType == yearlyThRecurrencePattern2.CalendarType && yearlyThRecurrencePattern.DaysOfWeek == yearlyThRecurrencePattern2.DaysOfWeek && yearlyThRecurrencePattern.IsLeapMonth == yearlyThRecurrencePattern2.IsLeapMonth && yearlyThRecurrencePattern.Month == yearlyThRecurrencePattern2.Month && yearlyThRecurrencePattern.Order == yearlyThRecurrencePattern2.Order);
         }
     }
     return(true);
 }