public FromToTime(DateTime?from, DateTime?to, SpecialOpenState state) { var now = DateTime.Now; From = from ?? new DateTime(now.Year, now.Month, now.Day, 0, 0, 0); To = to ?? new DateTime(now.Year, now.Month, now.Day, 23, 59, 59); State = state; }
public async Task <TContract> SetOpenStateAsync(int id, SpecialOpenState openState, int value) { var customerRestaurant = await LoadCustomerRestaurantAsync(id).ConfigureAwait(false); if (customerRestaurant != null) { //var timeTable = Time. } return(customerRestaurant); }
public FromToTime(TimeSpan from, TimeSpan to, SpecialOpenState state) { var now = DateTime.Now; From = new DateTime(now.Year, now.Month, now.Day, from.Hours, from.Minutes, 0); To = new DateTime(now.Year, now.Month, now.Day, to.Hours, to.Minutes, 0); if (To < From) { To = To.AddDays(1); } State = state; }
public Task <ICustomerRestaurant> SetOpenStateAsync(SpecialOpenState openState, int value) { throw new NotImplementedException(); }
public static FromToTime Create(IEnumerable <FromToTime> timeTable, DateTime now, SpecialOpenState openState) { timeTable.CheckArgument(nameof(timeTable)); var result = default(FromToTime); var timeList = new List <FromToTime>(timeTable); var index = timeList.FindIndex(e => e.IsBetween(now) && e.State != openState); if (index > -1) { var entry = timeList[index]; result = new FromToTime(now, entry.To, openState); } else { result = new FromToTime(now, new DateTime(now.Year, now.Month, now.Day, 23, 59, 59), openState); } return(result); }