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

            return
                ((
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                     ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     StartDateLocal == other.StartDateLocal ||
                     StartDateLocal != null &&
                     StartDateLocal.Equals(other.StartDateLocal)
                 ) &&
                 (
                     ElapsedTime == other.ElapsedTime ||
                     ElapsedTime != null &&
                     ElapsedTime.Equals(other.ElapsedTime)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     Trainer == other.Trainer ||
                     Trainer != null &&
                     Trainer.Equals(other.Trainer)
                 ) &&
                 (
                     Commute == other.Commute ||
                     Commute != null &&
                     Commute.Equals(other.Commute)
                 ) &&
                 (
                     HideFromHome == other.HideFromHome ||
                     HideFromHome != null &&
                     HideFromHome.Equals(other.HideFromHome)
                 ));
        }
Exemple #2
0
        /// <summary>
        /// Returns true if SummarySegmentEffort instances are equal
        /// </summary>
        /// <param name="other">Instance of SummarySegmentEffort to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SummarySegmentEffort other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     ActivityId == other.ActivityId ||
                     ActivityId != null &&
                     ActivityId.Equals(other.ActivityId)
                 ) &&
                 (
                     ElapsedTime == other.ElapsedTime ||
                     ElapsedTime != null &&
                     ElapsedTime.Equals(other.ElapsedTime)
                 ) &&
                 (
                     StartDate == other.StartDate ||
                     StartDate != null &&
                     StartDate.Equals(other.StartDate)
                 ) &&
                 (
                     StartDateLocal == other.StartDateLocal ||
                     StartDateLocal != null &&
                     StartDateLocal.Equals(other.StartDateLocal)
                 ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     IsKom == other.IsKom ||
                     IsKom != null &&
                     IsKom.Equals(other.IsKom)
                 ));
        }
Exemple #3
0
        /// <summary>
        /// Returns true if Split instances are equal
        /// </summary>
        /// <param name="other">Instance of Split to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Split other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AverageSpeed == other.AverageSpeed ||
                     AverageSpeed != null &&
                     AverageSpeed.Equals(other.AverageSpeed)
                     ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     ElapsedTime == other.ElapsedTime ||
                     ElapsedTime != null &&
                     ElapsedTime.Equals(other.ElapsedTime)
                 ) &&
                 (
                     ElevationDifference == other.ElevationDifference ||
                     ElevationDifference != null &&
                     ElevationDifference.Equals(other.ElevationDifference)
                 ) &&
                 (
                     PaceZone == other.PaceZone ||
                     PaceZone != null &&
                     PaceZone.Equals(other.PaceZone)
                 ) &&
                 (
                     MovingTime == other.MovingTime ||
                     MovingTime != null &&
                     MovingTime.Equals(other.MovingTime)
                 ) &&
                 (
                     _Split == other._Split ||
                     _Split != null &&
                     _Split.Equals(other._Split)
                 ));
        }
Exemple #4
0
        /// <summary>
        /// Returns true if ActivityTotal instances are equal
        /// </summary>
        /// <param name="other">Instance of ActivityTotal to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ActivityTotal other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Count == other.Count ||
                     Count != null &&
                     Count.Equals(other.Count)
                     ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     MovingTime == other.MovingTime ||
                     MovingTime != null &&
                     MovingTime.Equals(other.MovingTime)
                 ) &&
                 (
                     ElapsedTime == other.ElapsedTime ||
                     ElapsedTime != null &&
                     ElapsedTime.Equals(other.ElapsedTime)
                 ) &&
                 (
                     ElevationGain == other.ElevationGain ||
                     ElevationGain != null &&
                     ElevationGain.Equals(other.ElevationGain)
                 ) &&
                 (
                     AchievementCount == other.AchievementCount ||
                     AchievementCount != null &&
                     AchievementCount.Equals(other.AchievementCount)
                 ));
        }
        public CoinTradeStatistics GetTotalVolumeAndTradesByElapsedTime(ElapsedTime elapsedTime)
        {
            if (elapsedTime.Equals(ElapsedTime.All))
            {
                var coins = _context.Coins
                            .AsEnumerable()
                            .ToList();

                return(new CoinTradeStatistics
                {
                    NumberOfTrades = coins.Sum(c => c.NumberOfTrades),
                    Volumes = new Dictionary <string, decimal>
                    {
                        { "USD", coins.Sum(c => c.VolumeUSD) },
                        { "BTC", coins.Sum(c => c.VolumeBTC) },
                        { "BLOCK", coins.Sum(c => c.VolumeBLOCK) }
                    }
                });
            }

            var past = getUnixTimestampFromElapsedTime(elapsedTime);

            var trades = _context.Trades
                         .AsEnumerable()
                         .Where(t => t.Timestamp >= past)
                         .ToList();

            return(new CoinTradeStatistics
            {
                NumberOfTrades = trades.Count(),
                Volumes = new Dictionary <string, decimal>
                {
                    { "USD", trades.Sum(t => t.MakerSize * t.PriceUSD) },
                    { "BTC", trades.Sum(t => t.MakerSize * t.PriceBTC) },
                    { "BLOCK", trades.Sum(t => t.MakerSize * t.PriceBLOCK) }
                }
            });
        }
        /// <summary>
        /// Returns true if SummaryActivity instances are equal
        /// </summary>
        /// <param name="other">Instance of SummaryActivity to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SummaryActivity other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ExternalId == other.ExternalId ||
                     ExternalId != null &&
                     ExternalId.Equals(other.ExternalId)
                     ) &&
                 (
                     UploadId == other.UploadId ||
                     UploadId != null &&
                     UploadId.Equals(other.UploadId)
                 ) &&
                 (
                     Athlete == other.Athlete ||
                     Athlete != null &&
                     Athlete.Equals(other.Athlete)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     MovingTime == other.MovingTime ||
                     MovingTime != null &&
                     MovingTime.Equals(other.MovingTime)
                 ) &&
                 (
                     ElapsedTime == other.ElapsedTime ||
                     ElapsedTime != null &&
                     ElapsedTime.Equals(other.ElapsedTime)
                 ) &&
                 (
                     TotalElevationGain == other.TotalElevationGain ||
                     TotalElevationGain != null &&
                     TotalElevationGain.Equals(other.TotalElevationGain)
                 ) &&
                 (
                     ElevHigh == other.ElevHigh ||
                     ElevHigh != null &&
                     ElevHigh.Equals(other.ElevHigh)
                 ) &&
                 (
                     ElevLow == other.ElevLow ||
                     ElevLow != null &&
                     ElevLow.Equals(other.ElevLow)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     StartDate == other.StartDate ||
                     StartDate != null &&
                     StartDate.Equals(other.StartDate)
                 ) &&
                 (
                     StartDateLocal == other.StartDateLocal ||
                     StartDateLocal != null &&
                     StartDateLocal.Equals(other.StartDateLocal)
                 ) &&
                 (
                     Timezone == other.Timezone ||
                     Timezone != null &&
                     Timezone.Equals(other.Timezone)
                 ) &&
                 (
                     StartLatlng == other.StartLatlng ||
                     StartLatlng != null &&
                     StartLatlng.Equals(other.StartLatlng)
                 ) &&
                 (
                     EndLatlng == other.EndLatlng ||
                     EndLatlng != null &&
                     EndLatlng.Equals(other.EndLatlng)
                 ) &&
                 (
                     AchievementCount == other.AchievementCount ||
                     AchievementCount != null &&
                     AchievementCount.Equals(other.AchievementCount)
                 ) &&
                 (
                     KudosCount == other.KudosCount ||
                     KudosCount != null &&
                     KudosCount.Equals(other.KudosCount)
                 ) &&
                 (
                     CommentCount == other.CommentCount ||
                     CommentCount != null &&
                     CommentCount.Equals(other.CommentCount)
                 ) &&
                 (
                     AthleteCount == other.AthleteCount ||
                     AthleteCount != null &&
                     AthleteCount.Equals(other.AthleteCount)
                 ) &&
                 (
                     PhotoCount == other.PhotoCount ||
                     PhotoCount != null &&
                     PhotoCount.Equals(other.PhotoCount)
                 ) &&
                 (
                     TotalPhotoCount == other.TotalPhotoCount ||
                     TotalPhotoCount != null &&
                     TotalPhotoCount.Equals(other.TotalPhotoCount)
                 ) &&
                 (
                     Map == other.Map ||
                     Map != null &&
                     Map.Equals(other.Map)
                 ) &&
                 (
                     Trainer == other.Trainer ||
                     Trainer != null &&
                     Trainer.Equals(other.Trainer)
                 ) &&
                 (
                     Commute == other.Commute ||
                     Commute != null &&
                     Commute.Equals(other.Commute)
                 ) &&
                 (
                     Manual == other.Manual ||
                     Manual != null &&
                     Manual.Equals(other.Manual)
                 ) &&
                 (
                     _Private == other._Private ||
                     _Private != null &&
                     _Private.Equals(other._Private)
                 ) &&
                 (
                     Flagged == other.Flagged ||
                     Flagged != null &&
                     Flagged.Equals(other.Flagged)
                 ) &&
                 (
                     WorkoutType == other.WorkoutType ||
                     WorkoutType != null &&
                     WorkoutType.Equals(other.WorkoutType)
                 ) &&
                 (
                     UploadIdStr == other.UploadIdStr ||
                     UploadIdStr != null &&
                     UploadIdStr.Equals(other.UploadIdStr)
                 ) &&
                 (
                     AverageSpeed == other.AverageSpeed ||
                     AverageSpeed != null &&
                     AverageSpeed.Equals(other.AverageSpeed)
                 ) &&
                 (
                     MaxSpeed == other.MaxSpeed ||
                     MaxSpeed != null &&
                     MaxSpeed.Equals(other.MaxSpeed)
                 ) &&
                 (
                     HasKudoed == other.HasKudoed ||
                     HasKudoed != null &&
                     HasKudoed.Equals(other.HasKudoed)
                 ) &&
                 (
                     HideFromHome == other.HideFromHome ||
                     HideFromHome != null &&
                     HideFromHome.Equals(other.HideFromHome)
                 ) &&
                 (
                     GearId == other.GearId ||
                     GearId != null &&
                     GearId.Equals(other.GearId)
                 ) &&
                 (
                     Kilojoules == other.Kilojoules ||
                     Kilojoules != null &&
                     Kilojoules.Equals(other.Kilojoules)
                 ) &&
                 (
                     AverageWatts == other.AverageWatts ||
                     AverageWatts != null &&
                     AverageWatts.Equals(other.AverageWatts)
                 ) &&
                 (
                     DeviceWatts == other.DeviceWatts ||
                     DeviceWatts != null &&
                     DeviceWatts.Equals(other.DeviceWatts)
                 ) &&
                 (
                     MaxWatts == other.MaxWatts ||
                     MaxWatts != null &&
                     MaxWatts.Equals(other.MaxWatts)
                 ) &&
                 (
                     WeightedAverageWatts == other.WeightedAverageWatts ||
                     WeightedAverageWatts != null &&
                     WeightedAverageWatts.Equals(other.WeightedAverageWatts)
                 ));
        }
Exemple #7
0
        /// <summary>
        /// Returns true if Lap instances are equal
        /// </summary>
        /// <param name="other">Instance of Lap to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Lap other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Activity == other.Activity ||
                     Activity != null &&
                     Activity.Equals(other.Activity)
                 ) &&
                 (
                     Athlete == other.Athlete ||
                     Athlete != null &&
                     Athlete.Equals(other.Athlete)
                 ) &&
                 (
                     AverageCadence == other.AverageCadence ||
                     AverageCadence != null &&
                     AverageCadence.Equals(other.AverageCadence)
                 ) &&
                 (
                     AverageSpeed == other.AverageSpeed ||
                     AverageSpeed != null &&
                     AverageSpeed.Equals(other.AverageSpeed)
                 ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     ElapsedTime == other.ElapsedTime ||
                     ElapsedTime != null &&
                     ElapsedTime.Equals(other.ElapsedTime)
                 ) &&
                 (
                     StartIndex == other.StartIndex ||
                     StartIndex != null &&
                     StartIndex.Equals(other.StartIndex)
                 ) &&
                 (
                     EndIndex == other.EndIndex ||
                     EndIndex != null &&
                     EndIndex.Equals(other.EndIndex)
                 ) &&
                 (
                     LapIndex == other.LapIndex ||
                     LapIndex != null &&
                     LapIndex.Equals(other.LapIndex)
                 ) &&
                 (
                     MaxSpeed == other.MaxSpeed ||
                     MaxSpeed != null &&
                     MaxSpeed.Equals(other.MaxSpeed)
                 ) &&
                 (
                     MovingTime == other.MovingTime ||
                     MovingTime != null &&
                     MovingTime.Equals(other.MovingTime)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     PaceZone == other.PaceZone ||
                     PaceZone != null &&
                     PaceZone.Equals(other.PaceZone)
                 ) &&
                 (
                     Split == other.Split ||
                     Split != null &&
                     Split.Equals(other.Split)
                 ) &&
                 (
                     StartDate == other.StartDate ||
                     StartDate != null &&
                     StartDate.Equals(other.StartDate)
                 ) &&
                 (
                     StartDateLocal == other.StartDateLocal ||
                     StartDateLocal != null &&
                     StartDateLocal.Equals(other.StartDateLocal)
                 ) &&
                 (
                     TotalElevationGain == other.TotalElevationGain ||
                     TotalElevationGain != null &&
                     TotalElevationGain.Equals(other.TotalElevationGain)
                 ));
        }