Пример #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Code != 0)
            {
                hash ^= Code.GetHashCode();
            }
            if (Time != 0L)
            {
                hash ^= Time.GetHashCode();
            }
            if (ToId.Length != 0)
            {
                hash ^= ToId.GetHashCode();
            }
            if (FromId.Length != 0)
            {
                hash ^= FromId.GetHashCode();
            }
            if (ReqId.Length != 0)
            {
                hash ^= ReqId.GetHashCode();
            }
            if (Data.Length != 0)
            {
                hash ^= Data.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #2
0
        public override int GetHashCode()
        {
            int hashToId = ToId.GetHashCode();

            int hashNotificationId = NotificationId.GetHashCode();

            return(hashToId ^ hashNotificationId);
        }
Пример #3
0
        public bool Equals(Notification other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(false);
            }

            if (Object.ReferenceEquals(this, other))
            {
                return(true);
            }

            return(NotificationId.Equals(other.NotificationId) && ToId.Equals(other.ToId));
        }
Пример #4
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 hash = 17;

                hash = hash * 92821 + TypeId.GetHashCode( );

                hash = hash * 92821 + FromId.GetHashCode( );

                hash = hash * 92821 + ToId.GetHashCode( );

                if (Cardinality != null)
                {
                    hash = hash * 92821 + Cardinality.GetHashCode( );
                }

                return(hash);
            }
        }
Пример #5
0
 /// <summary>
 ///     Navigates the click.
 /// </summary>
 private void NavigateToClick( )
 {
     EntityNotificationService.NavigateTo(ToId.ToString(CultureInfo.InvariantCulture), TenantId);
 }
Пример #6
0
        private async Task <IReadOnlyCollection <ToId> > UpdateSingle <T, TI, TModel, TService>(TService service, DbSet <T> set,
                                                                                                Func <T, int> getId,
                                                                                                Func <T, string> getName)
            where T : class
            where TService : IEntityProvider <TI>
            where TI : INamed, IWeight, IEntity
            where TModel : class, TI, new()
        {
            List <ToId> newArray =
                new List <ToId>();

            foreach (var ent in set)
            {
                ToId toId =
                    new ToId()
                {
                    From = getId(ent),
                };

                var exists =
                    await
                    service.Get(1, 1, new SearchModel()
                {
                    Filter = new BinaryFilterUnit()
                    {
                        OperatorType = OperatorType.Equals,
                        Unit2        = new ConstFilterUnit()
                        {
                            Value = getName(ent)
                        },
                        Unit1 = new ParameterFilterUnit()
                        {
                            PropertyName = "Value",
                        },
                    }
                });

                int newId = -1;

                if (exists.Total == 0)
                {
                    var res =
                        await service.AddOrUpdate(new TModel
                    {
                        Name   = getName(ent),
                        Weight = 1,
                    });

                    newId = res.Id;
                }
                else
                {
                    newId =
                        exists.Items.First().Id;
                }

                toId.To = newId;

                newArray.Add(toId);
            }

            return(newArray);
        }