예제 #1
0
        /// <summary>
        /// Returns true if BookingConfirmedEvent instances are equal
        /// </summary>
        /// <param name="other">Instance of BookingConfirmedEvent to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(BookingConfirmedEvent other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     BookingRequestId == other.BookingRequestId ||
                     BookingRequestId != null &&
                     BookingRequestId.Equals(other.BookingRequestId)
                     ) &&
                 (
                     BookingId == other.BookingId ||
                     BookingId != null &&
                     BookingId.Equals(other.BookingId)
                 ) &&
                 (
                     AgencyId == other.AgencyId ||
                     AgencyId != null &&
                     AgencyId.Equals(other.AgencyId)
                 ) &&
                 (
                     Cost == other.Cost ||

                     Cost.Equals(other.Cost)
                 ));
        }
        /// <summary>
        /// Returns true if WorkerOfferedEvent instances are equal
        /// </summary>
        /// <param name="other">Instance of WorkerOfferedEvent to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(WorkerOfferedEvent other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ObjectType == other.ObjectType ||
                     ObjectType != null &&
                     ObjectType.Equals(other.ObjectType)
                     ) &&
                 (
                     BookingRequestId == other.BookingRequestId ||
                     BookingRequestId != null &&
                     BookingRequestId.Equals(other.BookingRequestId)
                 ) &&
                 (
                     Agency == other.Agency ||
                     Agency != null &&
                     Agency.Equals(other.Agency)
                 ));
        }
예제 #3
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (Id != null)
                {
                    hashCode = hashCode * 59 + Id.GetHashCode();
                }
                if (BookingRequestId != null)
                {
                    hashCode = hashCode * 59 + BookingRequestId.GetHashCode();
                }
                if (Worker != null)
                {
                    hashCode = hashCode * 59 + Worker.GetHashCode();
                }
                if (Agency != null)
                {
                    hashCode = hashCode * 59 + Agency.GetHashCode();
                }

                hashCode = hashCode * 59 + QualificationStatus.GetHashCode();
                return(hashCode);
            }
        }
예제 #4
0
 public BookingRequestCreated(BookingRequestId id, UserId userId, ResourceId resourceId, BookingInterval interval)
 {
     UserId           = userId;
     BookingRequestId = id;
     ResourceId       = resourceId;
     Interval         = interval;
 }
예제 #5
0
 public ResourceReserved(
     BookingRequestId requestId,
     UserId approvedByUserId,
     BookingInterval interval
     )
 {
     RequestId        = requestId;
     ApprovedByUserId = approvedByUserId;
     Interval         = interval;
 }
예제 #6
0
        public void AddReservation(
            BookingRequestId requestId,
            UserId approvedByUserId,
            BookingInterval interval
            )
        {
            if (!State.IsManager(approvedByUserId))
            {
                return;
            }

            if (State.IsResourceAvailable(interval))
            {
                RaiseEvent(new ResourceReserved(requestId, approvedByUserId, interval));
            }
            else
            {
                RaiseEvent(new ResourceReservationFailed(requestId, "Unavailable"));
            }
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ObjectType != null)
         {
             hashCode = hashCode * 59 + ObjectType.GetHashCode();
         }
         if (BookingRequestId != null)
         {
             hashCode = hashCode * 59 + BookingRequestId.GetHashCode();
         }
         if (Agency != null)
         {
             hashCode = hashCode * 59 + Agency.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #8
0
        /// <summary>
        /// Returns true if WorkerOffer instances are equal
        /// </summary>
        /// <param name="other">Instance of WorkerOffer to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(WorkerOffer other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     BookingRequestId == other.BookingRequestId ||
                     BookingRequestId != null &&
                     BookingRequestId.Equals(other.BookingRequestId)
                 ) &&
                 (
                     Worker == other.Worker ||
                     Worker != null &&
                     Worker.Equals(other.Worker)
                 ) &&
                 (
                     Agency == other.Agency ||
                     Agency != null &&
                     Agency.Equals(other.Agency)
                 ) &&
                 (
                     QualificationStatus == other.QualificationStatus ||

                     QualificationStatus.Equals(other.QualificationStatus)
                 ));
        }
예제 #9
0
 public Reservation(BookingRequestId requestId, BookingInterval interval)
 {
     RequestId = requestId;
     Interval  = interval;
 }
 public ResourceReservationFailed(BookingRequestId requestId, string reason)
 {
     RequestId = requestId;
     Reason    = reason;
 }