static HomeController() { MainLogicProvider.WatchfulSloth.SetMove(new SlothMoveByTimeSingle<object>(() => { _serverProgress = new PhraseProvider().GetProgress(); return null; }, new TimeSpan(0, 15, 0), null)); }
public StatusModel(BaseModel baseModel, ProgressStatusSummary serverProgress) : base(baseModel) { ServerProgress = serverProgress; }
public ProgressStatusSummary GetProgress() { return InvokeSafe(() => { var last30Min = DateTime.UtcNow.AddMinutes(-30); var result = new ProgressStatusSummary(); result.DomainsCount = (int) (DomainEntity.DataSource.Max(DomainEntity.Fields.ID) ?? default(decimal)); result.PhrasesCount = (int) (Phrase.DataSource.Max(Phrase.Fields.ID) ?? default(decimal)); result.EmailCount = (int) (Domainemail.DataSource.Max(Domainemail.Fields.ID) ?? default(decimal)); result.PhoneCount = (int) (Domainphone.DataSource.Max(Domainphone.Fields.ID) ?? default(decimal)); result.DomainsLast30MinCount = DomainEntity.DataSource.Where(DomainEntity.Fields.Datecollected, Oper.GreaterOrEq, last30Min).Count(); result.PhrasesLast30MinCount = Phrase.DataSource.Where(Phrase.Fields.Datecollected, Oper.GreaterOrEq, last30Min).Count(); result.EmailCountDistinctDomain = Domainemail.DataSource.Count(Domainemail.Fields.DomainID); result.PhoneCountDistinct = Domainphone.DataSource.Count(Domainphone.Fields.DomainID); result.UserQueriesCount = (int)(Phraseaccount.DataSource.Max(Phraseaccount.Fields.ID) ?? default(decimal)); return result; }, new ProgressStatusSummary()); }