public static List <dtoWorkingDayHour> GetDefaultWorkingDayHours(FlagDayOfWeek days, long idCalendar = 0) { List <dtoWorkingDayHour> items = new List <dtoWorkingDayHour>(); foreach (FlagDayOfWeek fEnum in (from e in Enum.GetValues(typeof(FlagDayOfWeek)).OfType <FlagDayOfWeek>() where e != FlagDayOfWeek.Weekend && e != FlagDayOfWeek.None && e != FlagDayOfWeek.WorkWeek && e != FlagDayOfWeek.AllWeek select e)) { if (days.HasFlag(fEnum)) { items.Add(new dtoWorkingDayHour(8, 0, 12, 0) { DayOfWeek = fEnum, IdCalendar = idCalendar }); items.Add(new dtoWorkingDayHour(13, 0, 17, 0) { DayOfWeek = fEnum, IdCalendar = idCalendar }); } } return(items); }
private void Display(Func <DayMenu, bool> customFilter) { for (int i = 0; i < Scrapper.RestaurantsCount; i++) { if (selectedRestaurant.HasFlag((Restaurants)(1 << i))) { try { Restaurant restaurant = scrapper[i]; var dayMenus = restaurant. Where((menu) => selectedDay.HasFlag(menu.Day.FlagDayOfWeek())). Where(customFilter); if (dayMenus.Count() > 0) { PrintRestaurant(restaurant); } foreach (DayMenu menu in dayMenus) { Console.WriteLine(menu); } } catch (WebException e) { PrintLine(); Console.WriteLine(e.Message); Console.WriteLine("Zkontrolujte své připojení k internetu. Poté zkuste zobrazit menu znovu."); } catch (WeekendEmptyException e) { PrintLine(); Console.WriteLine(e.Message); } } } Init(); }