Как пропустить день, когда в C нет открытия магазина#
I am trying to create a program that will skip the days when there is no store opening on that day.
Ex: Day 1 -> Friday DAy 2 -> Saturday Day 3 -> Sunday (no store opening) Day 4 -> Monday
Currently my program will skip and add 1 day when there is no store opening. so it will be like this: Day 3 -> Sunday + 1day = Monday,
but my problem is.. the Day 4 which also scheduled on Monday,. so my actual result will become : Day 3 -> Monday Day 4 -> Monday (which must be move on Tuesday)
What can I do to achieve that?
Что я уже пробовал:
Here is my code: var dayOne = td.MinutesFromAttached.Value - 1; for (var i = 0; i <= 3; i++) { var possibleDate = context.FirstDay.AddDays(dayOne + i); if (!_storeScheduleService.IsStoreOpenForDate(storeId, possibleDate)) continue; var scheduleCheck = _storeScheduleService.IsStoreOpen(context.TaskParam.Customer.StoreId.Value, possibleDate); var tsDispatch = td.DispatchTime ?? new TimeSpan(9, 0, 0); if (tsDispatch < scheduleCheck.Schedule.Open) { tsDispatch = scheduleCheck.Schedule.Open.Value; } else if (tsDispatch > scheduleCheck.Schedule.Close) { tsDispatch = scheduleCheck.Schedule.Close.Value; } var dateTimeSchedule = new DateTime(possibleDate.Year, possibleDate.Month, possibleDate.Day, tsDispatch.Hours, tsDispatch.Minutes, tsDispatch.Seconds); aTaskExec.ScheduledDispatchedDateTime = dateTimeSchedule; break; } ```