/// <summary> /// The check nth weekday by month. /// </summary> /// <param name="weekday"> /// The weekday. /// </param> /// <param name="nthWeekday"> /// The nth Weekday. /// </param> /// <param name="currentDate"> /// The current Date. /// </param> /// <returns> /// Check if the current day of week is correct. /// </returns> private bool CheckNthWeekdayByMonth(Weekdays weekday, WeekdaySequences nthWeekday, DateTime currentDate) { var dates = this.GetDates(currentDate.Year, currentDate.Month) .Where(date => date.DayOfWeek.ToString() == weekday.ToString()) .ToList(); switch (nthWeekday) { case WeekdaySequences.First: return(dates[((int)WeekdaySequences.First - 1)] == currentDate); case WeekdaySequences.Second: return(dates[((int)WeekdaySequences.Second - 1)] == currentDate); case WeekdaySequences.Third: return(dates[((int)WeekdaySequences.Third - 1)] == currentDate); case WeekdaySequences.Fourth: return(dates[((int)WeekdaySequences.Fourth - 1)] == currentDate); case WeekdaySequences.Last: return(dates[dates.Count() - 1] == currentDate); } return(false); }
public DayCardViewModel(Weekdays day) { Day = day.ToString(); }