public bool IsDupulicatedReservation(Reservation reservation)
        {
            Assertion.ArgumentNotNull(reservation, nameof(reservation));
            var reservations = _reservationRepository.FindByEquipmentId(reservation.EquipmentId, ReservationStatus.Reserved);

            return(reservations.Where(_ => !_.Equals(reservation)).Any(_ => _.IsDupulicated(reservation)));
        }
        public bool IsRangeOverlapping(ReservationDateTime other)
        {
            Assertion.ArgumentNotNull(other, nameof(other));
            var compareResultStart = Start.CompareTo(other.Start);
            var compareResultEnd   = End.CompareTo(other.End);

            return(Start.CompareTo(other.End) < 0 && other.Start.CompareTo(End) < 0);
        }
Ejemplo n.º 3
0
        public Tenant(TenantId tenantId, string name, string description, bool active = false)
        {
            Assertion.ArgumentNotNull(nameof(tenantId), tenantId);
            Assertion.ArgumentNotNullOrEmpty(nameof(name), name);
            Assertion.AssertArgumentLength(nameof(name), name, 1, 100);
            Assertion.ArgumentNotNullOrEmpty(nameof(description), description);
            Assertion.AssertArgumentLength(nameof(description), description, 1, 200);

            this.TenantId    = tenantId;
            this.Name        = name;
            this.Description = description;
            this.Active      = active;
        }
 public bool IsDupulicated(Reservation other)
 {
     Assertion.ArgumentNotNull(other, nameof(other));
     if (!EquipmentId.Equals(other.EquipmentId))
     {
         return(false);
     }
     if (!ReservationDateTime.IsRangeOverlapping(other.ReservationDateTime))
     {
         return(false);
     }
     return(true);
 }
 public ReservationService(IReservationRepository reservationRepository)
 {
     Assertion.ArgumentNotNull(reservationRepository, nameof(reservationRepository));
     _reservationRepository = reservationRepository;
 }