Esempio n. 1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (LocationId.Length != 0)
            {
                hash ^= LocationId.GetHashCode();
            }
            if (Type != global::Google.Cloud.Firestore.Admin.V1.Database.Types.DatabaseType.Unspecified)
            {
                hash ^= Type.GetHashCode();
            }
            if (ConcurrencyMode != global::Google.Cloud.Firestore.Admin.V1.Database.Types.ConcurrencyMode.Unspecified)
            {
                hash ^= ConcurrencyMode.GetHashCode();
            }
            if (Etag.Length != 0)
            {
                hash ^= Etag.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public override int GetHashCode()
        {
            int hashCode = -400983667;

            if (Cursor != null)
            {
                hashCode += Cursor.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (ProductType != null)
            {
                hashCode += ProductType.GetHashCode();
            }

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            return(hashCode);
        }
Esempio n. 3
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is DeviceCode other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Code == null && other.Code == null) || (Code?.Equals(other.Code) == true)) &&
                   ((DeviceId == null && other.DeviceId == null) || (DeviceId?.Equals(other.DeviceId) == true)) &&
                   ((ProductType == null && other.ProductType == null) || (ProductType?.Equals(other.ProductType) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((PairBy == null && other.PairBy == null) || (PairBy?.Equals(other.PairBy) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((StatusChangedAt == null && other.StatusChangedAt == null) || (StatusChangedAt?.Equals(other.StatusChangedAt) == true)) &&
                   ((PairedAt == null && other.PairedAt == null) || (PairedAt?.Equals(other.PairedAt) == true)));
        }
Esempio n. 4
0
 public async Task <Location> LoadAsync(LocationId id)
 {
     return(await _context.Locations
            .Include(c => c.City)
            .Include(c => c.Country)
            .FirstOrDefaultAsync(l => l.Id == id));
 }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is InventoryPhysicalCount other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((CatalogObjectId == null && other.CatalogObjectId == null) || (CatalogObjectId?.Equals(other.CatalogObjectId) == true)) &&
                   ((CatalogObjectType == null && other.CatalogObjectType == null) || (CatalogObjectType?.Equals(other.CatalogObjectType) == true)) &&
                   ((State == null && other.State == null) || (State?.Equals(other.State) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((Quantity == null && other.Quantity == null) || (Quantity?.Equals(other.Quantity) == true)) &&
                   ((Source == null && other.Source == null) || (Source?.Equals(other.Source) == true)) &&
                   ((EmployeeId == null && other.EmployeeId == null) || (EmployeeId?.Equals(other.EmployeeId) == true)) &&
                   ((OccurredAt == null && other.OccurredAt == null) || (OccurredAt?.Equals(other.OccurredAt) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)));
        }
Esempio n. 6
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Subscription other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((PlanId == null && other.PlanId == null) || (PlanId?.Equals(other.PlanId) == true)) &&
                   ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) &&
                   ((StartDate == null && other.StartDate == null) || (StartDate?.Equals(other.StartDate) == true)) &&
                   ((CanceledDate == null && other.CanceledDate == null) || (CanceledDate?.Equals(other.CanceledDate) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((TaxPercentage == null && other.TaxPercentage == null) || (TaxPercentage?.Equals(other.TaxPercentage) == true)) &&
                   ((InvoiceIds == null && other.InvoiceIds == null) || (InvoiceIds?.Equals(other.InvoiceIds) == true)) &&
                   ((PriceOverrideMoney == null && other.PriceOverrideMoney == null) || (PriceOverrideMoney?.Equals(other.PriceOverrideMoney) == true)) &&
                   ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((CardId == null && other.CardId == null) || (CardId?.Equals(other.CardId) == true)) &&
                   ((PaidUntilDate == null && other.PaidUntilDate == null) || (PaidUntilDate?.Equals(other.PaidUntilDate) == true)) &&
                   ((Timezone == null && other.Timezone == null) || (Timezone?.Equals(other.Timezone) == true)));
        }
Esempio n. 7
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Booking other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) &&
                   ((StartAt == null && other.StartAt == null) || (StartAt?.Equals(other.StartAt) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) &&
                   ((CustomerNote == null && other.CustomerNote == null) || (CustomerNote?.Equals(other.CustomerNote) == true)) &&
                   ((SellerNote == null && other.SellerNote == null) || (SellerNote?.Equals(other.SellerNote) == true)) &&
                   ((AppointmentSegments == null && other.AppointmentSegments == null) || (AppointmentSegments?.Equals(other.AppointmentSegments) == true)));
        }
Esempio n. 8
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Tender other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((TransactionId == null && other.TransactionId == null) || (TransactionId?.Equals(other.TransactionId) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) &&
                   ((TipMoney == null && other.TipMoney == null) || (TipMoney?.Equals(other.TipMoney) == true)) &&
                   ((ProcessingFeeMoney == null && other.ProcessingFeeMoney == null) || (ProcessingFeeMoney?.Equals(other.ProcessingFeeMoney) == true)) &&
                   ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) &&
                   ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) &&
                   ((CardDetails == null && other.CardDetails == null) || (CardDetails?.Equals(other.CardDetails) == true)) &&
                   ((CashDetails == null && other.CashDetails == null) || (CashDetails?.Equals(other.CashDetails) == true)) &&
                   ((AdditionalRecipients == null && other.AdditionalRecipients == null) || (AdditionalRecipients?.Equals(other.AdditionalRecipients) == true)) &&
                   ((PaymentId == null && other.PaymentId == null) || (PaymentId?.Equals(other.PaymentId) == true)));
        }
Esempio n. 9
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is BankAccount other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((AccountNumberSuffix == null && other.AccountNumberSuffix == null) || (AccountNumberSuffix?.Equals(other.AccountNumberSuffix) == true)) &&
                   ((Country == null && other.Country == null) || (Country?.Equals(other.Country) == true)) &&
                   ((Currency == null && other.Currency == null) || (Currency?.Equals(other.Currency) == true)) &&
                   ((AccountType == null && other.AccountType == null) || (AccountType?.Equals(other.AccountType) == true)) &&
                   ((HolderName == null && other.HolderName == null) || (HolderName?.Equals(other.HolderName) == true)) &&
                   ((PrimaryBankIdentificationNumber == null && other.PrimaryBankIdentificationNumber == null) || (PrimaryBankIdentificationNumber?.Equals(other.PrimaryBankIdentificationNumber) == true)) &&
                   ((SecondaryBankIdentificationNumber == null && other.SecondaryBankIdentificationNumber == null) || (SecondaryBankIdentificationNumber?.Equals(other.SecondaryBankIdentificationNumber) == true)) &&
                   ((DebitMandateReferenceId == null && other.DebitMandateReferenceId == null) || (DebitMandateReferenceId?.Equals(other.DebitMandateReferenceId) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   Creditable.Equals(other.Creditable) &&
                   Debitable.Equals(other.Debitable) &&
                   ((Fingerprint == null && other.Fingerprint == null) || (Fingerprint?.Equals(other.Fingerprint) == true)) &&
                   ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) &&
                   ((BankName == null && other.BankName == null) || (BankName?.Equals(other.BankName) == true)));
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is InventoryAdjustment other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((FromState == null && other.FromState == null) || (FromState?.Equals(other.FromState) == true)) &&
                   ((ToState == null && other.ToState == null) || (ToState?.Equals(other.ToState) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((CatalogObjectId == null && other.CatalogObjectId == null) || (CatalogObjectId?.Equals(other.CatalogObjectId) == true)) &&
                   ((CatalogObjectType == null && other.CatalogObjectType == null) || (CatalogObjectType?.Equals(other.CatalogObjectType) == true)) &&
                   ((Quantity == null && other.Quantity == null) || (Quantity?.Equals(other.Quantity) == true)) &&
                   ((TotalPriceMoney == null && other.TotalPriceMoney == null) || (TotalPriceMoney?.Equals(other.TotalPriceMoney) == true)) &&
                   ((OccurredAt == null && other.OccurredAt == null) || (OccurredAt?.Equals(other.OccurredAt) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((Source == null && other.Source == null) || (Source?.Equals(other.Source) == true)) &&
                   ((EmployeeId == null && other.EmployeeId == null) || (EmployeeId?.Equals(other.EmployeeId) == true)) &&
                   ((TransactionId == null && other.TransactionId == null) || (TransactionId?.Equals(other.TransactionId) == true)) &&
                   ((RefundId == null && other.RefundId == null) || (RefundId?.Equals(other.RefundId) == true)) &&
                   ((PurchaseOrderId == null && other.PurchaseOrderId == null) || (PurchaseOrderId?.Equals(other.PurchaseOrderId) == true)) &&
                   ((GoodsReceiptId == null && other.GoodsReceiptId == null) || (GoodsReceiptId?.Equals(other.GoodsReceiptId) == true)));
        }
        /// <summary>
        /// Returns true if Address instances are equal
        /// </summary>
        /// <param name="input">Instance of Address to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Address input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     LocationId == input.LocationId ||
                     (LocationId != null &&
                      LocationId.Equals(input.LocationId))
                     ) &&
                 (
                     Name == input.Name ||
                     (Name != null &&
                      Name.Equals(input.Name))
                 ) &&
                 (
                     Lon == input.Lon ||
                     (Lon != null &&
                      Lon.Equals(input.Lon))
                 ) &&
                 (
                     Lat == input.Lat ||
                     (Lat != null &&
                      Lat.Equals(input.Lat))
                 ));
        }
Esempio n. 12
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (LocationId.Length != 0)
            {
                hash ^= LocationId.GetHashCode();
            }
            if (DisplayName.Length != 0)
            {
                hash ^= DisplayName.GetHashCode();
            }
            hash ^= Labels.GetHashCode();
            if (metadata_ != null)
            {
                hash ^= Metadata.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 13
0
        public override int GetHashCode()
        {
            int hashCode = 1605817888;

            if (OrderId != null)
            {
                hashCode += OrderId.GetHashCode();
            }

            if (Version != null)
            {
                hashCode += Version.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (State != null)
            {
                hashCode += State.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            return(hashCode);
        }
Esempio n. 14
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CreatePaymentRequest other &&
                   ((SourceId == null && other.SourceId == null) || (SourceId?.Equals(other.SourceId) == true)) &&
                   ((IdempotencyKey == null && other.IdempotencyKey == null) || (IdempotencyKey?.Equals(other.IdempotencyKey) == true)) &&
                   ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) &&
                   ((TipMoney == null && other.TipMoney == null) || (TipMoney?.Equals(other.TipMoney) == true)) &&
                   ((AppFeeMoney == null && other.AppFeeMoney == null) || (AppFeeMoney?.Equals(other.AppFeeMoney) == true)) &&
                   ((DelayDuration == null && other.DelayDuration == null) || (DelayDuration?.Equals(other.DelayDuration) == true)) &&
                   ((Autocomplete == null && other.Autocomplete == null) || (Autocomplete?.Equals(other.Autocomplete) == true)) &&
                   ((OrderId == null && other.OrderId == null) || (OrderId?.Equals(other.OrderId) == true)) &&
                   ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((VerificationToken == null && other.VerificationToken == null) || (VerificationToken?.Equals(other.VerificationToken) == true)) &&
                   ((AcceptPartialAuthorization == null && other.AcceptPartialAuthorization == null) || (AcceptPartialAuthorization?.Equals(other.AcceptPartialAuthorization) == true)) &&
                   ((BuyerEmailAddress == null && other.BuyerEmailAddress == null) || (BuyerEmailAddress?.Equals(other.BuyerEmailAddress) == true)) &&
                   ((BillingAddress == null && other.BillingAddress == null) || (BillingAddress?.Equals(other.BillingAddress) == true)) &&
                   ((ShippingAddress == null && other.ShippingAddress == null) || (ShippingAddress?.Equals(other.ShippingAddress) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((StatementDescriptionIdentifier == null && other.StatementDescriptionIdentifier == null) || (StatementDescriptionIdentifier?.Equals(other.StatementDescriptionIdentifier) == true)));
        }
Esempio n. 15
0
        /// <summary>
        /// Converts the time by using a LocationId, a ISO-string and optionally a list of IDs to convert to.
        /// </summary>
        /// <returns>
        /// The converted time.
        /// </returns>
        /// <param name='fromId'>
        /// The places identifier
        /// </param>
        /// <param name='iso'>
        /// ISO 8601-formatted string.
        /// </param>
        /// <param name='toIds'>
        /// The place IDs to convert to.
        /// </param>
        public ConvertedTimes ConvertTime(LocationId fromId, string iso, IList <LocationId> toIds = null)
        {
            if (fromId == null || string.IsNullOrEmpty(iso))
            {
                throw new ArgumentException("A required argument is null or empty");
            }

            var id = fromId.GetIdAsString();

            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentException("A required argument is null or empty");
            }

            var arguments = GetCommonArguments(id);

            arguments.Set("iso", iso);

            if (toIds != null)
            {
                arguments.Add(GetArgumentsForToIds(toIds));
            }

            return(CallService <ConvertedTimes>(arguments));
        }
Esempio n. 16
0
        /// <summary>
        /// Returns true if Address instances are equal
        /// </summary>
        /// <param name="other">Instance of Address to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Location other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return
                ((
                     LocationId == other.LocationId ||
                     LocationId != null &&
                     LocationId.Equals(other.LocationId)
                     ) &&
                 (
                     Lon == other.Lon ||
                     Lon != null &&
                     Lon.Equals(other.Lon)
                 ) &&
                 (
                     Lat == other.Lat ||
                     Lat != null &&
                     Lat.Equals(other.Lat)
                 ));
        }
        public override int GetHashCode()
        {
            int hashCode = -1717136415;

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (Description != null)
            {
                hashCode += Description.GetHashCode();
            }

            if (AmountMoney != null)
            {
                hashCode += AmountMoney.GetHashCode();
            }

            if (ReceivableId != null)
            {
                hashCode += ReceivableId.GetHashCode();
            }

            return(hashCode);
        }
Esempio n. 18
0
    public void MoveToLocation(LocationId locationId)
    {
        if (_roadMovementComponent != null)
        {
            throw new InvalidOperationException($"Player {_playerId} is at road {_roadMovementComponent.Road.RoadId}. Cannot enter location from here.");
        }

        if (_locationId == locationId)
        {
            throw new InvalidOperationException($"Player {_playerId} is already at location {_locationId}. Cannot move to the same location.");
        }

        var currentLocation = _locationStore.Find(_locationId);

        if (currentLocation == null)
        {
            throw new InvalidOperationException($"Player {_playerId} is currently at not existing location {_locationId}. Cannot move to location {locationId}.");
        }

        if (_locationStore.Find(locationId) == null)
        {
            throw new InvalidOperationException($"Location {locationId} doesn't exist.");
        }

        if (!currentLocation.Locations.Contains(locationId))
        {
            throw new InvalidOperationException($"Cannot move the player {_playerId} from {_locationId} to {locationId}. There is no path to this location from the current location.");
        }

        _locationId = locationId;
        _updateMessagingGroup($"location_{locationId}");
    }
Esempio n. 19
0
#pragma warning restore IDE0032 // Use auto property

    private Player(
        PlayerState state,
        ILocationStore locationStore,
        IRoadStore roadStore,
        Action <string> updateMessagingGroup)
    {
        _locationStore        = locationStore;
        _roadStore            = roadStore;
        _updateMessagingGroup = updateMessagingGroup;

        _playerId   = state.PlayerId;
        _locationId = state.LocationId;

        if (state.RoadMovementState != null)
        {
            var road = roadStore.Find(state.RoadMovementState.RoadId);
            if (road == null)
            {
                throw new InvalidOperationException($"Road {state.RoadMovementState.RoadId} is not found in the store.");
            }

            _roadMovementComponent = new RoadMovementComponent(road, state.RoadMovementState.Progress, state.RoadMovementState.MovementDirection);
        }

        UpdateMessagingGroup();
    }
Esempio n. 20
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is PaymentRefund other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) &&
                   ((AppFeeMoney == null && other.AppFeeMoney == null) || (AppFeeMoney?.Equals(other.AppFeeMoney) == true)) &&
                   ((ProcessingFee == null && other.ProcessingFee == null) || (ProcessingFee?.Equals(other.ProcessingFee) == true)) &&
                   ((PaymentId == null && other.PaymentId == null) || (PaymentId?.Equals(other.PaymentId) == true)) &&
                   ((OrderId == null && other.OrderId == null) || (OrderId?.Equals(other.OrderId) == true)) &&
                   ((Reason == null && other.Reason == null) || (Reason?.Equals(other.Reason) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)));
        }
Esempio n. 21
0
 public Location[] Path(Location location)
 {
     if (WasIterated(location))
     {
         int        stepCount  = 0;
         LocationId locationId = location.Id;
         if (locationId == ApproachLocationId)
         {
             locationId = Backtrace[locationId];
         }
         while (locationId != OriginId)
         {
             stepCount++;
             locationId = Backtrace[locationId];
         }
         Location[] result = new Location[stepCount];
         locationId = location.Id;
         if (locationId == ApproachLocationId)
         {
             locationId = Backtrace[locationId];
         }
         while (locationId != OriginId)
         {
             stepCount--;
             result[stepCount] = new Location(TheEmpire, locationId);
             locationId        = Backtrace[locationId];
         }
         return(result);
     }
     else
     {
         return(null); // not reached yet
     }
 }
Esempio n. 22
0
        public override int GetHashCode()
        {
            int hashCode = -735515174;

            if (StartAtRange != null)
            {
                hashCode += StartAtRange.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (SegmentFilters != null)
            {
                hashCode += SegmentFilters.GetHashCode();
            }

            if (BookingId != null)
            {
                hashCode += BookingId.GetHashCode();
            }

            return(hashCode);
        }
Esempio n. 23
0
        public CarrierMovement(
            CarrierMovementId id,
            LocationId departureLocationId,
            LocationId arrivalLocationId,
            DateTimeOffset departureTime,
            DateTimeOffset arrivalTime)
            : base(id)
        {
            if (departureLocationId == null)
            {
                throw new ArgumentNullException(nameof(departureLocationId));
            }
            if (arrivalLocationId == null)
            {
                throw new ArgumentNullException(nameof(arrivalLocationId));
            }
            if (departureTime == default(DateTimeOffset))
            {
                throw new ArgumentOutOfRangeException(nameof(departureTime));
            }
            if (arrivalTime == default(DateTimeOffset))
            {
                throw new ArgumentOutOfRangeException(nameof(arrivalTime));
            }
            if (departureTime.IsAfter(arrivalTime))
            {
                throw new ArgumentException("Arrival time must be after departure");
            }

            DepartureLocationId = departureLocationId;
            ArrivalLocationId   = arrivalLocationId;
            DepartureTime       = departureTime;
            ArrivalTime         = arrivalTime;
        }
Esempio n. 24
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is LoyaltyEvent other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((AccumulatePoints == null && other.AccumulatePoints == null) || (AccumulatePoints?.Equals(other.AccumulatePoints) == true)) &&
                   ((CreateReward == null && other.CreateReward == null) || (CreateReward?.Equals(other.CreateReward) == true)) &&
                   ((RedeemReward == null && other.RedeemReward == null) || (RedeemReward?.Equals(other.RedeemReward) == true)) &&
                   ((DeleteReward == null && other.DeleteReward == null) || (DeleteReward?.Equals(other.DeleteReward) == true)) &&
                   ((AdjustPoints == null && other.AdjustPoints == null) || (AdjustPoints?.Equals(other.AdjustPoints) == true)) &&
                   ((LoyaltyAccountId == null && other.LoyaltyAccountId == null) || (LoyaltyAccountId?.Equals(other.LoyaltyAccountId) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((Source == null && other.Source == null) || (Source?.Equals(other.Source) == true)) &&
                   ((ExpirePoints == null && other.ExpirePoints == null) || (ExpirePoints?.Equals(other.ExpirePoints) == true)) &&
                   ((OtherEvent == null && other.OtherEvent == null) || (OtherEvent?.Equals(other.OtherEvent) == true)));
        }
Esempio n. 25
0
 public void MoveToLocation_ShouldThrow_WhenCannotMoveToThisLocationFromCurrentLocation(
     Player player,
     LocationId locationId)
 {
     Assert.Throws <InvalidOperationException>(
         () => player.MoveToLocation(locationId));
 }
Esempio n. 26
0
 public static HostId Create(LocationId locationId, int sequenceNumber)
 {
     return new HostId {
         sequenceNumber = sequenceNumber,
         locationId = locationId.Value
     };
 }
 public void Setup()
 {
     fromCoords = new LocationId(new Coordinates(59.913m, 10.752m));
     fromId     = new LocationId(fromFormat);
     toUsId     = new LocationId(toUsFormat);
     toArticId  = new LocationId(toArticFormat);
 }
Esempio n. 28
0
    public static int GetMoveCost(LocationId from, LocationId to)
    {
        if (from == to)
        {
            return(0);
        }
        switch (from)
        {
        case LocationId.SAMPLES:
            return(3);

        case LocationId.DIAGNOSIS when to == LocationId.LABORATORY:
            return(4);

        case LocationId.DIAGNOSIS:
        case LocationId.MOLECULES:
            return(3);

        case LocationId.LABORATORY when to == LocationId.DIAGNOSIS:
            return(4);

        case LocationId.LABORATORY:
            return(3);

        default:
            return(2);
        }
    }
Esempio n. 29
0
        public override int GetHashCode()
        {
            int hashCode = 2055161563;

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            if (Limit != null)
            {
                hashCode += Limit.GetHashCode();
            }

            if (Cursor != null)
            {
                hashCode += Cursor.GetHashCode();
            }

            return(hashCode);
        }
Esempio n. 30
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Shift other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((EmployeeId == null && other.EmployeeId == null) || (EmployeeId?.Equals(other.EmployeeId) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((Timezone == null && other.Timezone == null) || (Timezone?.Equals(other.Timezone) == true)) &&
                   ((StartAt == null && other.StartAt == null) || (StartAt?.Equals(other.StartAt) == true)) &&
                   ((EndAt == null && other.EndAt == null) || (EndAt?.Equals(other.EndAt) == true)) &&
                   ((Wage == null && other.Wage == null) || (Wage?.Equals(other.Wage) == true)) &&
                   ((Breaks == null && other.Breaks == null) || (Breaks?.Equals(other.Breaks) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) &&
                   ((TeamMemberId == null && other.TeamMemberId == null) || (TeamMemberId?.Equals(other.TeamMemberId) == true)));
        }
Esempio n. 31
0
        public ScheduleBuilder Add(
            LocationId arrivalLocationId,
            DateTimeOffset departureTime,
            DateTimeOffset arrivalTime)
        {
            _carrierMovements.Add(new CarrierMovement(
                CarrierMovementId.New,
                _departureLocation,
                arrivalLocationId,
                departureTime,
                arrivalTime));

            _departureLocation = arrivalLocationId;

            return this;
        }
Esempio n. 32
0
        public Route(
            LocationId originLocationId,
            LocationId destinationLocationId,
            DateTimeOffset departureTime,
            DateTimeOffset arrivalDeadline)
        {
            if (originLocationId == null) throw new ArgumentNullException(nameof(originLocationId));
            if (destinationLocationId == null) throw new ArgumentNullException(nameof(destinationLocationId));
            if (arrivalDeadline == default(DateTimeOffset)) throw new ArgumentOutOfRangeException(nameof(arrivalDeadline));
            if (departureTime == default(DateTimeOffset)) throw new ArgumentOutOfRangeException(nameof(departureTime));
            if (originLocationId == destinationLocationId) throw new ArgumentException("Origin and destination cannot be the same");
            if (departureTime.IsAfter(arrivalDeadline)) throw new ArgumentException("Departure must be before arrival");

            OriginLocationId = originLocationId;
            DestinationLocationId = destinationLocationId;
            DepartureTime = departureTime;
            ArrivalDeadline = arrivalDeadline;
        }
Esempio n. 33
0
 public Location(LocationId Id, string ShortDescription, string LongDescription, int North, int East, int South, int West, int Up, int Down)
 {
     this.Id = Id;
     this.ShortDescription = ShortDescription;
     this.LongDescription = LongDescription;
     this.North = North;
     this.East = East;
     this.South = South;
     this.West = West;
     this.Up = Up;
     this.Down = Down;
 }
Esempio n. 34
0
 public ScheduleBuilder(
     LocationId departureLocation)
 {
     _departureLocation = departureLocation;
 }