/// <summary> /// Loads model for the dashboard live tile. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return CacheHelper.Cache(() => { bool isApprovalEnabled = SettingsKeyInfoProvider.GetBoolValue("CMSRegistrationAdministratorApproval", liveTileContext.SiteInfo.SiteID); // Calculate only if approval process is enabled for new users if (isApprovalEnabled) { var usersWaitingForApprovalCount = GetUsersWaitingForApprovalCount(liveTileContext.SiteInfo); if (usersWaitingForApprovalCount != 0) { return new LiveTileModel { Value = usersWaitingForApprovalCount, Description = ResHelper.GetString("users.livetiledescription"), }; } else return null; } else return null; }, new CacheSettings(5, "UsersLiveTileModelProvider", liveTileContext.SiteInfo.SiteID)); }
/// <summary> /// Loads model for the dashboard live tile. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return(CacheHelper.Cache(() => { var licensesRemainingDays = GetLicensesRemainingDays(); if (licensesRemainingDays != 0) { return new LiveTileModel { Value = licensesRemainingDays, Description = ResHelper.GetString("licenses.livetiledescription"), }; } else { return null; } }, new CacheSettings(10, "LicensesLiveTileModelProvider", liveTileContext.SiteInfo.SiteID))); }
/// <summary> /// Loads model for the dashboard live tile. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return CacheHelper.Cache(() => { var formsClassNames = BizFormInfoProvider.GetBizForms() .OnSite(liveTileContext.SiteInfo.SiteID) .Source(s => s.Join<DataClassInfo>("FormClassID", "ClassID")) .Column("ClassName") .GetListResult<string>(); // Leave tile empty if there are no forms on current site if (!formsClassNames.Any()) { return null; } int newSubmissionsCount = formsClassNames.Sum(className => BizFormItemProvider.GetItems(className) .WhereGreaterThan("FormInserted", DateTime.Now.AddDays(-7).Date) .Count); return new LiveTileModel { Value = newSubmissionsCount, Description = ResHelper.GetString("bizform.livetiledescription"), }; } , new CacheSettings(5, "FormsLiveTileModelProvider", liveTileContext.SiteInfo.SiteID)); }
/// <summary> /// Loads model for the dashboard live tile. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return(CacheHelper.Cache(() => { bool isApprovalEnabled = SettingsKeyInfoProvider.GetBoolValue("CMSRegistrationAdministratorApproval", liveTileContext.SiteInfo.SiteID); // Calculate only if approval process is enabled for new users if (isApprovalEnabled) { var usersWaitingForApprovalCount = GetUsersWaitingForApprovalCount(liveTileContext.SiteInfo); if (usersWaitingForApprovalCount != 0) { return new LiveTileModel { Value = usersWaitingForApprovalCount, Description = ResHelper.GetString("users.livetiledescription"), }; } else { return null; } } else { return null; } }, new CacheSettings(5, "UsersLiveTileModelProvider", liveTileContext.SiteInfo.SiteID))); }
/// <summary> /// Loads model for the dashboard live tile. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return(CacheHelper.Cache(() => { var formsClassNames = BizFormInfoProvider.GetBizForms() .OnSite(liveTileContext.SiteInfo.SiteID) .Source(s => s.Join <DataClassInfo>("FormClassID", "ClassID")) .Column("ClassName") .GetListResult <string>(); // Leave tile empty if there are no forms on current site if (!formsClassNames.Any()) { return null; } int newSubmissionsCount = formsClassNames.Sum(className => BizFormItemProvider.GetItems(className) .WhereGreaterThan("FormInserted", DateTime.Now.AddDays(-7).Date) .Count); return new LiveTileModel { Value = newSubmissionsCount, Description = ResHelper.GetString("bizform.livetiledescription"), }; } , new CacheSettings(5, "FormsLiveTileModelProvider", liveTileContext.SiteInfo.SiteID))); }
/// <summary> /// Loads model for the dashboard live tile. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return(CacheHelper.Cache(() => { var emailsNotSentCount = GetEmailsNotSentCount(liveTileContext.SiteInfo); if (emailsNotSentCount != 0) { return new LiveTileModel { Value = emailsNotSentCount, Description = ResHelper.GetString("emails.livetiledescription"), }; } else { return null; } }, new CacheSettings(1, "EmailsLiveTileModelProvider", liveTileContext.SiteInfo.SiteID))); }
/// <summary> /// Loads model for the dashboard live tile. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return(CacheHelper.Cache(() => { string description; var timeSinceRestart = GetTimeDifferenceSinceRestart(out description); return new LiveTileModel { Value = timeSinceRestart, Description = description, }; }, new CacheSettings(1, "SystemLiveTileModelProvider", liveTileContext.SiteInfo.SiteID))); }
/// <summary> /// Loads model for the dashboard live tile. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return CacheHelper.Cache(() => { string description; var timeSinceRestart = GetTimeDifferenceSinceRestart(out description); return new LiveTileModel { Value = timeSinceRestart, Description = description, }; }, new CacheSettings(1, "SystemLiveTileModelProvider", liveTileContext.SiteInfo.SiteID)); }
/// <summary> /// Loads model for the dashboard live tile. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return(CacheHelper.Cache(() => { // If site has more than 1 form on lower license, BizFormItemProvider.GetItems method returns null which results in exception // Standard license check if (!BizFormItemProvider.LicenseVersionCheck(RequestContext.CurrentDomain, ObjectActionEnum.Edit)) { return null; } var formsClassNames = BizFormInfoProvider.GetBizForms() .OnSite(liveTileContext.SiteInfo.SiteID) .Source(s => s.Join <DataClassInfo>("FormClassID", "ClassID")) .Column("ClassName") .GetListResult <string>(); // Leave tile empty if there are no forms on current site if (!formsClassNames.Any()) { return null; } int newSubmissionsCount = formsClassNames.Sum(className => BizFormItemProvider.GetItems(className) .WhereGreaterThan("FormInserted", DateTime.Now.AddDays(-7).Date) .Count); return new LiveTileModel { Value = newSubmissionsCount, Description = ResHelper.GetString("bizform.livetiledescription"), }; } , new CacheSettings(5, "FormsLiveTileModelProvider", liveTileContext.SiteInfo.SiteID))); }
/// <summary> /// Loads total number of pages waiting for the approval. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return(CacheHelper.Cache(() => { int waitingPagesCount = GetNumberOfPendingPages(liveTileContext.SiteInfo, (UserInfo)liveTileContext.UserInfo); if (waitingPagesCount == 0) { return null; } return new LiveTileModel { Value = waitingPagesCount, Description = ResHelper.GetString("pendingpages.livetiledescription") }; }, new CacheSettings(2, "PendingPagesLiveModelProvider", liveTileContext.SiteInfo.SiteID, liveTileContext.UserInfo.UserID))); }
/// <summary> /// Loads total number of submissions waiting for import. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return CacheHelper.Cache(() => { int waitingSubmissionsCount = GetNumberOfWaitingSubmissions(liveTileContext.SiteInfo.SiteID); if (waitingSubmissionsCount == 0) { return null; } return new LiveTileModel { Value = waitingSubmissionsCount, Description = ResHelper.GetString("translations.livetiledescription") }; }, new CacheSettings(2, "TranslationsLiveModelProvider", liveTileContext.SiteInfo.SiteID)); }
/// <summary> /// Loads total number of submissions waiting for import. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return(CacheHelper.Cache(() => { int waitingSubmissionsCount = GetNumberOfWaitingSubmissions(liveTileContext.SiteInfo.SiteID); if (waitingSubmissionsCount == 0) { return null; } return new LiveTileModel { Value = waitingSubmissionsCount, Description = ResHelper.GetString("translations.livetiledescription") }; }, new CacheSettings(2, "TranslationsLiveModelProvider", liveTileContext.SiteInfo.SiteID))); }
/// <summary> /// Loads total number of pages waiting for the approval. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return CacheHelper.Cache(() => { int waitingPagesCount = GetNumberOfPendingPages(liveTileContext.SiteInfo, (UserInfo)liveTileContext.UserInfo); if (waitingPagesCount == 0) { return null; } return new LiveTileModel { Value = waitingPagesCount, Description = ResHelper.GetString("pendingpages.livetiledescription") }; }, new CacheSettings(2, "PendingPagesLiveModelProvider", liveTileContext.SiteInfo.SiteID, liveTileContext.UserInfo.UserID)); }
/// <summary> /// Loads model for the dashboard live tile. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return CacheHelper.Cache(() => { var emailsNotSentCount = GetEmailsNotSentCount(liveTileContext.SiteInfo); if (emailsNotSentCount != 0) { return new LiveTileModel { Value = emailsNotSentCount, Description = ResHelper.GetString("emails.livetiledescription"), }; } else return null; }, new CacheSettings(1, "EmailsLiveTileModelProvider", liveTileContext.SiteInfo.SiteID)); }
/// <summary> /// Loads number of visits in the last week. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return CacheHelper.Cache(() => { if (!AnalyticsHelper.AnalyticsEnabled(liveTileContext.SiteInfo.SiteName)) { return null; } var weekVisitsCount = GetWeekVisitsCount(liveTileContext.SiteInfo.SiteID); return new LiveTileModel { Value = weekVisitsCount, Description = ResHelper.GetString("webanalytics.livetiledescription") }; }, new CacheSettings(2, "WebAnalyticsLiveTileModelProvider", liveTileContext.SiteInfo.SiteID)); }
/// <summary> /// Loads model for the dashboard live tile. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return CacheHelper.Cache(() => { var licensesRemainingDays = GetLicensesRemainingDays(); if (licensesRemainingDays != 0) { return new LiveTileModel { Value = licensesRemainingDays, Description = ResHelper.GetString("licenses.livetiledescription"), }; } else return null; }, new CacheSettings(10, "LicensesLiveTileModelProvider", liveTileContext.SiteInfo.SiteID)); }
/// <summary> /// Loads number of visits in the last week. /// </summary> /// <param name="liveTileContext">Context of the live tile. Contains information about the user and the site the model is requested for</param> /// <exception cref="ArgumentNullException"><paramref name="liveTileContext"/> is null</exception> /// <returns>Live tile model</returns> public LiveTileModel GetModel(LiveTileContext liveTileContext) { if (liveTileContext == null) { throw new ArgumentNullException("liveTileContext"); } return(CacheHelper.Cache(() => { if (!AnalyticsHelper.AnalyticsEnabled(liveTileContext.SiteInfo.SiteName)) { return null; } var weekVisitsCount = GetWeekVisitsCount(liveTileContext.SiteInfo.SiteID); return new LiveTileModel { Value = weekVisitsCount, Description = ResHelper.GetString("webanalytics.livetiledescription") }; }, new CacheSettings(2, "WebAnalyticsLiveTileModelProvider", liveTileContext.SiteInfo.SiteID))); }