public bool IsEquivalent(IRecurrenceProvider compareProvider) { RecurringProvider compareRP = compareProvider as RecurringProvider; if (compareRP == null) { return(false); } var thisTime = string.IsNullOrWhiteSpace(Time) ? "" : Time.Trim().ToLowerInvariant(); var compareTime = string.IsNullOrWhiteSpace(compareRP.Time) ? "" : compareRP.Time.Trim().ToLowerInvariant(); var thisExpected = string.IsNullOrWhiteSpace(Expected) ? "" : Expected.Trim().ToLowerInvariant(); var compareExpected = string.IsNullOrWhiteSpace(compareRP.Expected) ? "" : compareRP.Expected.Trim().ToLowerInvariant(); var thisExpectedWhen = string.IsNullOrWhiteSpace(ExpectedWhen) ? "" : ExpectedWhen.Trim().ToLowerInvariant(); var compareExpectedWhen = string.IsNullOrWhiteSpace(compareRP.ExpectedWhen) ? "" : compareRP.ExpectedWhen.Trim().ToLowerInvariant(); var thisExpectedEveryDays = ExpectedEveryDays == null ? new List <int>() : ExpectedEveryDays; var compareExpectedEveryDays = compareRP.ExpectedEveryDays == null ? new List <int>() : compareRP.ExpectedEveryDays; var thisExpectedEveryMonths = ExpectedEveryMonths == null ? new List <int>() : ExpectedEveryMonths; var compareExpectedEveryMonths = compareRP.ExpectedEveryMonths == null ? new List <int>() : compareRP.ExpectedEveryMonths; var thisExpectedEveryMonthsOnDays = ExpectedEveryMonthsOnDays == null ? new List <int>() : ExpectedEveryMonthsOnDays; var compareExpectedEveryMonthsOnDays = compareRP.ExpectedEveryMonthsOnDays == null ? new List <int>() : compareRP.ExpectedEveryMonthsOnDays; return(thisTime == compareTime && thisExpected == compareExpected && thisExpectedWhen == compareExpectedWhen && thisExpectedEveryDays.HasSameContent(compareExpectedEveryDays) && thisExpectedEveryMonths.HasSameContent(compareExpectedEveryMonths) && thisExpectedEveryMonthsOnDays.HasSameContent(compareExpectedEveryMonthsOnDays)); }
public bool IsEquivalent(IRecurrenceProvider compareProvider) { NonRecurringProvider compareNRP = compareProvider as NonRecurringProvider; if (compareNRP == null) { return(false); } var thisTime = string.IsNullOrWhiteSpace(Time) ? "" : Time.Trim().ToLowerInvariant(); var compareTime = string.IsNullOrWhiteSpace(compareNRP.Time) ? "" : compareNRP.Time.Trim().ToLowerInvariant(); return(thisTime == compareTime); }