Exemple #1
0
 public Shop(IRepository <Appointment> appointmentRepository, ShopHours hours, IBarbersRepository barbersRepository)
 {
     Hours = hours;
     minimumTimeBeforeClose     = ShopHours.AppointmentMiddleLength;
     this.appointmentRepository = appointmentRepository;
     this.barbersRepository     = barbersRepository;
     Barbers = new List <Barber>();
 }
Exemple #2
0
        public async Task <bool> CanAcceptCustomersAsync(DateTime dateTime)
        {
            if (!await IsOpenAsync(dateTime))
            {
                return(false);
            }

            DateTime  nowDateTime = DateTime.UtcNow.AddHours(ShopHours.UTC_to_PST_Hours);
            ShopHours nowHours    = new ShopHours(Hours);
            await nowHours.LoadAsync(this, nowDateTime);

            if (dateTime < nowDateTime)
            {
                return(false);
            }
            return(true);
        }
Exemple #3
0
        public string FormattedWeekHours()
        {
            DateTime      opening       = OpeningDateTime();
            StringBuilder stringBuilder = new StringBuilder();

            int beginningEnumCounter = (int)opening.DayOfWeek;
            int daysToSubtract       = 0;

            while (beginningEnumCounter > 0)
            {
                daysToSubtract++;
                beginningEnumCounter--;
            }

            for (int days = daysToSubtract; days >= 0; days--)
            {
                ShopHours day           = new ShopHours(this);
                DateTime  dateTimeCheck = opening.AddDays(-1 * days);
                stringBuilder.AppendLine(day.FormattedDayHours());
            }

            return(stringBuilder.ToString());
        }