public object Clone() { var cpi = new CompanyProfile { Id = Id, Name = Name, Street = Street, City = City, State = State, Zip = Zip, Country = Country, TaxCode = TaxCode, VatCode = VatCode, Email = Email, Web = Web, Phone = Phone, Mobile = Mobile, Note = Note, ContactName = ContactName, ContactEmail = ContactEmail, ContactPhone = ContactPhone, ProfileRate = (CompanyProfileRate)ProfileRate.Clone(), ComparerOptions = (ComparerSettings)ComparerOptions.Clone(), MetricGroup = (QualityMetricGroup)MetricGroup.Clone() }; return(cpi); }
public async Task IncrementAsync(ImdbType type, Profile profile) { State.Count++; var rate = new ProfileRate(profile, State.Count); var id = new ActorId(type.ToString()); var proxy = ActorProxy.Create <IImdbTopRated>(id); await proxy.OferCandidateAsync(rate); #region Log var logId = Constants.Singleton; var logProxy = ActorProxy.Create <IImdbFaults>(logId); await logProxy.Report($"{profile.Name} Counter: {State.Count}"); #endregion // Log }
public async Task OferCandidateAsync(ProfileRate profile) { ProfileRate existing = _topItems.FirstOrDefault(m => m.Name == profile.Name); if (existing != null) { existing.Count++; // increment the item which already in the state Publish(); return; } ProfileRate barierProfile = _topItems .OrderBy(m => m.Count) .FirstOrDefault(); int barier = barierProfile?.Count ?? 0; if (_topItems.Count == LIMIT && profile.Count <= barier) { return; } _topItems.Add(profile); if (_topItems.Count > LIMIT) { var removeCandidate = _topItems.OrderBy(m => m.Count) .First(); _topItems.Remove(removeCandidate); } State = _topItems.OrderByDescending(m => m.Count) .ToArray(); Publish(); #region Log var logId = Constants.Singleton; var logProxy = ActorProxy.Create <IImdbFaults>(logId); await logProxy.Report($"Top {_type}"); #endregion // Log }