public string ToText() { var frequency = BuildFrequency(); var day = ""; var count = ""; switch (recurrencePattern.Frequency) { case FrequencyType.Daily: break; case FrequencyType.Weekly: if (recurrencePattern.IsWeekdays()) { frequency = ""; day = Language.WeeklyEveryWeekday; } else if (recurrencePattern.IsEveryDay()) { frequency = ""; day = Language.WeeklyEveryDay; } else { day += BuildWeeklyDays(); } break; case FrequencyType.Monthly: if (recurrencePattern.ByMonthDay.Count > 0) { day += BuildMonthlyOnDay(); } else if (recurrencePattern.BySetPosition.Count > 0 && recurrencePattern.ByDay.Count > 0) { day += BuildMonthlyOnNumberedDay(); } else if (recurrencePattern.ByDay.Count > 0) { day += BuildMonthlyOnWeekDay(); } break; case FrequencyType.Yearly: if (recurrencePattern.ByMonth.Count > 0 && recurrencePattern.ByMonthDay.Count > 0) { day += BuildYearlyOnDay(); } else if (recurrencePattern.BySetPosition.Count > 0 && recurrencePattern.ByDay.Count > 0 && recurrencePattern.ByMonth.Count > 0) { day += BuildYearlyOnNumbered(); } else if (recurrencePattern.ByMonth.Count > 0) { day += BuildYearlyOnMonth(); } break; } // Endings if (recurrencePattern.Until != DateTime.MinValue) { String ending = BuildUntilDateEnding(); if (ending != null) { count = ending; } } else if (recurrencePattern.Count != int.MinValue) { String ending = BuildCountEnding(); if (ending != null) { count = ending; } } var result = String.Format(Language.PhraseStructure, frequency, day, count).Replace(" ", " ").Trim(); try { return(bool.Parse(Language.PhraseFirstCharToUpper) ? FirstCharToUpper(result) : result); } catch (Exception) { return(result); } }