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

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Trigger != global::RedNimbus.Messages.LambdaMessage.Types.TriggerType.Get)
            {
                hash ^= Trigger.GetHashCode();
            }
            if (Runtime != global::RedNimbus.Messages.LambdaMessage.Types.RuntimeType.Csharp)
            {
                hash ^= Runtime.GetHashCode();
            }
            if (OwnerId.Length != 0)
            {
                hash ^= OwnerId.GetHashCode();
            }
            if (ImageId.Length != 0)
            {
                hash ^= ImageId.GetHashCode();
            }
            if (Guid.Length != 0)
            {
                hash ^= Guid.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 2
0
        public Draft Create(OwnerId ownerId, TenantId tenantId, Apartment apartment, Period period, Price pricePerDay, OfferId offerId, Price deposit)
        {
            var draftNumber     = _draftNumberGenerator.GetNextAvailable(tenantId, offerId);
            var discountedPrice = Price.From(pricePerDay.ToDecimal() * _discount.ToDecimal());

            return(new Draft(ownerId, tenantId, apartment, period, discountedPrice, draftNumber, deposit));
        }
Exemplo n.º 3
0
        public Task <DataResponse <Dto.File> > Get(string fileName)
        {
            var resp = new DataResponse <Dto.File>
            {
                Type = ResponseType.RecordNotFound
            };

            var id = fileName.Split("_")[0];

            var file = _repository.GetById(id);


            if (file == null || file.OwnerId != OwnerId.ToString())
            {
                return(Task.FromResult(resp));
            }

            resp.Data = new Dto.File
            {
                Content = file.Content,
                Name    = file.Name
            };

            resp.Type = ResponseType.Success;

            return(Task.FromResult(resp));
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (RequestId.Length != 0)
            {
                hash ^= RequestId.GetHashCode();
            }
            if (OwnerId.Length != 0)
            {
                hash ^= OwnerId.GetHashCode();
            }
            if (Skip != 0)
            {
                hash ^= Skip.GetHashCode();
            }
            if (Take != 0)
            {
                hash ^= Take.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (version_ != null)
            {
                hash ^= Version.GetHashCode();
            }
            if (ownerId_ != null)
            {
                hash ^= OwnerId.GetHashCode();
            }
            if (Nonce.Length != 0)
            {
                hash ^= Nonce.GetHashCode();
            }
            if (BasicAcl != 0)
            {
                hash ^= BasicAcl.GetHashCode();
            }
            hash ^= attributes_.GetHashCode();
            if (placementPolicy_ != null)
            {
                hash ^= PlacementPolicy.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 6
0
        private string GetOwnerLink()
        {
            string retval = String.Empty;

            if (instance == null)             // new
            {
                if (!String.IsNullOrEmpty(OwnerName) && OwnerId > 0)
                {
                    retval = CHelper.GetLinkObjectViewByOwnerName(OwnerName, OwnerId.ToString());
                }
            }
            else
            {
                string ownerName = string.Empty;
                if (instance.OwnerDocumentId != null)
                {
                    ownerName = WorkflowInstanceEntity.FieldOwnerDocumentId;
                }

                if (!String.IsNullOrEmpty(ownerName))
                {
                    retval = CHelper.GetLinkObjectViewByOwnerName(ownerName, instance.OwnerDocumentId.ToString());
                }
            }

            return(retval);
        }
Exemplo n.º 7
0
 public override bool Equals(object obj)
 {
     return(obj is ShoppingList list &&
            Name == list.Name &&
            ListDate == list.ListDate &&
            OwnerId.Equals(list.OwnerId) &&
            ItemsEqual(list.Items));
 }
Exemplo n.º 8
0
        public void Init(int netId, string ownerId, GameObject obj)
        {
            this.NetId   = netId;
            this.OwnerId = ownerId;
            this.Obj     = obj;

            IsMine = OwnerId.Equals(UserManager.Instance.userID);
        }
Exemplo n.º 9
0
        public void Dispose()
        {
            OwnerId?.Dispose();

            _properties.Remove(_id);

            GC.SuppressFinalize(this);
        }
Exemplo n.º 10
0
 public Offer(Period period, OwnerId ownerId, Apartment apartment, Price pricePerDay, OfferId offerId, Price deposit)
 {
     Id           = offerId;
     _period      = period;
     _ownerId     = ownerId;
     _apartment   = apartment;
     _pricePerDay = pricePerDay;
     _deposit     = deposit;
 }
Exemplo n.º 11
0
        public static Company Create(CompanyId id, OwnerId ownerId, string name, DateTime setUpDate, CompanyContact companyContact, IList <Agency> agencies = null)
        {
            if (agencies.Count > 10)
            {
                throw new CreateCompanyRejectedException("Company cannot contains more than 10 Agencies");
            }

            return(new Company(id, ownerId, name, setUpDate, companyContact, agencies));
        }
Exemplo n.º 12
0
 private Company(CompanyId id, OwnerId ownerId, string name, DateTime setUpDate, CompanyContact companyContact, IList <Agency> agenciess)
 {
     this.Id             = id;
     this.OwnerId        = ownerId;
     this.setUpDate      = setUpDate;
     this.agencies       = agenciess;
     this.companyContact = companyContact;
     this.agencies       = agenciess ?? new List <Agency>();
 }
Exemplo n.º 13
0
 public ScreenshotsPhotoMetadata(UInt32?id, OwnerId owner, Double?latitude, Double?longitude, DateTime?date, String text, IReadOnlyCollection <IPhoto> photos)
 {
     Id        = id;
     Owner     = owner;
     Latitude  = latitude;
     Longitude = longitude;
     Date      = date;
     Text      = text;
     Photos    = photos;
 }
Exemplo n.º 14
0
 public Agreement(OwnerId ownerId, TenantId tenantId, Apartment apartment, Period period, Price price, AgreementNumber number, Price deposit)
 {
     _ownerId   = ownerId;
     _tenantId  = tenantId;
     _apartment = apartment;
     _period    = period;
     _price     = price;
     _number    = number;
     _deposit   = deposit;
 }
Exemplo n.º 15
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;

                // Suitable nullity checks
                hash = hash * 59 + Id.GetHashCode();

                if (EquipmentType != null)
                {
                    hash = hash * 59 + EquipmentType.GetHashCode();
                }

                if (OwnerName != null)
                {
                    hash = hash * 59 + OwnerName.GetHashCode();
                }

                if (OwnerId != null)
                {
                    hash = hash * 59 + OwnerId.GetHashCode();
                }

                hash = hash * 59 + IsHired.GetHashCode();

                if (Make != null)
                {
                    hash = hash * 59 + Make.GetHashCode();
                }

                if (Model != null)
                {
                    hash = hash * 59 + Model.GetHashCode();
                }

                if (Size != null)
                {
                    hash = hash * 59 + Size.GetHashCode();
                }

                hash = hash * 59 + AttachmentCount.GetHashCode();

                if (LastVerifiedDate != null)
                {
                    hash = hash * 59 + LastVerifiedDate.GetHashCode();
                }

                hash = hash * 59 + SenioritySortOrder.GetHashCode();

                return(hash);
            }
        }
Exemplo n.º 16
0
 public Draft(OwnerId ownerId, TenantId tenantId, Apartment apartment, Period period, Price pricePerDay, AgreementNumber agreementNumber, Price deposit)
 {
     Id               = DraftId.From(Guid.NewGuid().ToString());
     _ownerId         = ownerId;
     _tenantId        = tenantId;
     _apartment       = apartment;
     _period          = period;
     _pricePerDay     = pricePerDay;
     _agreementNumber = agreementNumber;
     _deposit         = deposit;
 }
Exemplo n.º 17
0
        public bool Equals(Vote second)
        {
            // If parameter is null return false:
            if ((object)second == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return(OwnerId.Equals(second.OwnerId) && subjectId == second.subjectId);
        }
Exemplo n.º 18
0
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hash = 17;
         // Suitable nullity checks etc, of course :)
         hash = hash * 23 + OwnerId.GetHashCode();
         hash = hash * 23 + LegalFormOfOwner.GetHashCode();
         hash = hash * 23 + CountryOfOwner.GetHashCode();
         return(hash);
     }
 }
Exemplo n.º 19
0
        public JObject ToJson()
        {
            var json = new JObject();

            json["version"]         = Version?.ToJson();
            json["ownerID"]         = OwnerId?.ToJson();
            json["nonce"]           = Nonce.ToBase64();
            json["basicACL"]        = BasicAcl;
            json["attributes"]      = new JArray(Attributes.Select(p => p.ToJson()));
            json["placementPolicy"] = PlacementPolicy?.ToJson();
            return(json);
        }
Exemplo n.º 20
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = OwnerId.GetHashCode();
         hashCode = (hashCode * 397) ^ (OwnerResource != null ? OwnerResource.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Value != null ? Value.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ValueType != null ? ValueType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 21
0
        public override int GetHashCode()
        {
            unchecked
            {
                if (LocalDocumentAnchor == 0)
                {
                    return(0);
                }

                return((LocalDocumentAnchor.GetHashCode() * 397) ^ OwnerId.GetHashCode());
            }
        }
Exemplo n.º 22
0
        /// <summary>
        ///   Returns a hash code for this instance.
        /// </summary>
        /// <returns>
        ///   A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
        /// </returns>
        public override int GetHashCode()
        {
            unchecked
            {
                int result = Name != null?Name.GetHashCode() : 0;

                result = (result * 397) ^ Id.GetHashCode();
                result = (result * 397) ^ Space.GetHashCode();
                result = (result * 397) ^ OwnerId.GetHashCode();
                result = (result * 397) ^ Enabled.GetHashCode();
                return(result);
            }
        }
Exemplo n.º 23
0
        private async Task <IPhotoMetadata> GetPhotoMetadataAsync(UInt32 photoId, Double latitude, Double longitude, String uri)
        {
            var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(uri));

            var fileBuffer = await FileIO.ReadBufferAsync(storageFile);

            var imageProperties = await storageFile.Properties.GetImagePropertiesAsync();

            await App.Model.LocalFiles.StoreAsync(photoId, fileBuffer);

            var photo = new ScreenshotsDataPhoto(new Size(imageProperties.Width, imageProperties.Height), new Uri(uri), "m");

            return(new ScreenshotsPhotoMetadata(photoId, OwnerId.Create(1, OwnerId.OwnerType.User), latitude, longitude, DateTime.Now, null, new IPhoto[] { photo }));
        }
Exemplo n.º 24
0
        protected override IEnumerable <byte[]> GetItems()
        {
            yield return(RuleId.ToByteArray());

            yield return(BitConverter.GetBytes(Tag));

            yield return(KeyId.ToByteArray());

            yield return(Encoding.UTF8.GetBytes(Condition));

            yield return(BitConverter.GetBytes((int)Action));

            yield return(OwnerId.ToByteArray());
        }
Exemplo n.º 25
0
    public BattleObject(Room room, BattleObjectSettings settings, OwnerId owner, float2 position)
    {
        if (settings == null)
        {
            throw new ArgumentNullException($"Tried to spawn object {GetType()} with null settings!");
        }

        Owner    = owner;
        Settings = settings;
        Size     = settings.Size;
        Position = position;
        Room     = room;
        SendViewEvent(ViewEventType.Init);
    }
        public Task <object> Handle(TestQuery request, CancellationToken cancellationToken)
        {
            using (context)
            {
                var ownerId = new OwnerId(Guid.Parse("2f9abcbc-d607-4806-8248-5a8777a60538"));
                var period  = context.Set <ReportingPeriod>().FirstOrDefault(e => e.OwnerId == ownerId);
                if (period == null)
                {
                    return(null);
                }

                var res = new { PeriodBounderies = $"{period.TimePeriod.StartingPoint} - {period.TimePeriod.EndPoint}" };
                return(Task.FromResult((object)res));
            }
        }
Exemplo n.º 27
0
        public OfferId Create(DateTime from, DateTime to, string apartmentIdString, decimal priceDecimal, string ownerIdString, decimal depositDecimal)
        {
            var apartmentId = ApartmentId.From(apartmentIdString);
            var apartment   = _apartmentRepository.Get(apartmentId);
            var period      = Period.From(from, to);
            var pricePerDay = Price.From(priceDecimal);
            var ownerId     = OwnerId.From(ownerIdString);
            var deposit     = Price.From(depositDecimal);

            var offer = OfferFactory.Create(apartment, ownerId, period, pricePerDay, deposit);

            _offerRepository.Save(offer);

            return(offer.Id);
        }
        public void Add(CreateApartmentDto createApartmentDto)
        {
            var address = Address.From(createApartmentDto.StreetName, createApartmentDto.PostalCode);
            var ownerId = OwnerId.From(createApartmentDto.OwnerId);
            var rooms   = new List <Room>();

            foreach (var(area, type) in createApartmentDto.Rooms)
            {
                var room = Room.From(area, type);
                rooms.Add(room);
            }

            var apartment = ApartmentFactory.Create(address, ownerId, rooms);

            _apartmentRepository.Save(apartment);
        }
Exemplo n.º 29
0
        public static IPhotoMetadata Create(JsonObject value)
        {
            var photos = new List <IPhoto>();

            if (value.ContainsKey("sizes") && (value["sizes"].ValueType == JsonValueType.Array))
            {
                foreach (var item in value["sizes"].GetArray())
                {
                    var photo = VkPhoto.Create(item.GetObject());
                    if (photo != null)
                    {
                        photos.Add(photo);
                    }
                }
            }

            var instance = new VkPhotoMetadata();

            if (value.ContainsKey("id"))
            {
                instance.Id = (UInt32)value["id"].GetNumber();
            }
            if (value.ContainsKey("owner_id"))
            {
                var owner = value["owner_id"].GetNumber();
                instance.Owner = (owner < 0) ? OwnerId.Create((UInt32)Math.Abs(owner), OwnerId.OwnerType.Group) : OwnerId.Create((UInt32)owner, OwnerId.OwnerType.User);
            }
            if (value.ContainsKey("lat"))
            {
                instance.Latitude = value["lat"].GetNumber();
            }
            if (value.ContainsKey("long"))
            {
                instance.Longitude = value["long"].GetNumber();
            }
            if (value.ContainsKey("date"))
            {
                instance.Date = DateTimeExtensions.FromUnixTimestamp((Int32)value["date"].GetNumber());
            }
            if (value.ContainsKey("text"))
            {
                instance.Text = value["text"].GetString();
            }
            instance.Photos = photos;
            return(instance);
        }
Exemplo n.º 30
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = CreatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (Key != null ? Key.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Namespace != null ? Namespace.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ OwnerId.GetHashCode();
         hashCode = (hashCode * 397) ^ (OwnerResource != null ? OwnerResource.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (Value != null ? Value.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ValueType != null ? ValueType.GetHashCode() : 0);
         return(hashCode);
     }
 }