private IEnumerable <string> AddMonthlyAddIns(MonthlyFrequency monthlyFrequency) { var addIns = new List <string>(); if (monthlyFrequency.IsDefinedByDay) { addIns.Add(monthlyFrequency.Period == 1 ? @"каждый" : string.Format(DescriptionFormattingString, @"каждые", monthlyFrequency.Period)); addIns.Add(DeclinableForDates(monthlyFrequency.Occurs, monthlyFrequency.Period)); if (monthlyFrequency.DayOffset.HasValue) { addIns.Add(string.Format(DescriptionFormattingString, "на", StringNumericEndOfWord(monthlyFrequency.DayOffset.Value, 'm'))); } addIns.Add(DeclinableForDates(RhythmByDate.Daily, 1)); } else { const string format = @"{0}"; KeyValuePair <RhythmByWeek, DayOfWeek>?weekDetalization = monthlyFrequency.DayOfWeek; if (weekDetalization.HasValue) { CultureInfo russi = new CultureInfo("ru-RU"); DayOfWeek currWeek = weekDetalization.Value.Value; RhythmByWeek currWeekPart = weekDetalization.Value.Key; //string masculine = GetMasculineDayOfWeek(currWeek); addIns.Add(string.Format(format, "каждый")); //, masculine));//evry addIns.Add(string.Format(format, GetNameRhythmByWeek(currWeekPart))); //, masculine));//currWeekPart.ToString().ToLower() addIns.Add(string.Format("{0}", russi.DateTimeFormat.DayNames[(int)currWeek])); } addIns.Add(monthlyFrequency.Period == 1 ? @"каждый" : string.Format(DescriptionFormattingString, @"каждые", monthlyFrequency.Period)); addIns.Add(DeclinableForDates(monthlyFrequency.Occurs, monthlyFrequency.Period == 1 ? 2 : monthlyFrequency.Period)); } return(addIns); }
private string GetNameRhythmByWeek(RhythmByWeek id) { switch (id) { case RhythmByWeek.First: return("первый"); case RhythmByWeek.Second: return("второй"); case RhythmByWeek.Third: return("третий"); case RhythmByWeek.Fourth: return("четвертый"); case RhythmByWeek.Last: return("последний"); default: return("первый"); } }