public override void Run() { DatesManager manager = new DatesManager(); string formattedDate = EnterTheDate(); DateTime date = DateTime.ParseExact(formattedDate, Constants.Format, CultureInfo.InvariantCulture); int workingDays = CalculateWorkingDays(manager, date); PrintTheResult(formattedDate, workingDays); }
private static int CalculateWorkingDays(DatesManager manager, DateTime date) { int workingDays = 0; for (DateTime day = DateTime.Now; DateTime.Compare(date, day) > 0; day = day.AddDays(1)) { if (!manager.IsDayHoliday(day)) { workingDays++; } } return(workingDays); }