コード例 #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)
                 ));
        }
コード例 #2
0
        /// <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"));
            }
        }
コード例 #7
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 (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;
 }
コード例 #10
0
 public ResourceReservationFailed(BookingRequestId requestId, string reason)
 {
     RequestId = requestId;
     Reason    = reason;
 }