internal WBQuery GetQueryForNewlyPublishedPublicDocsThatNeedEmailAlert() { WBQuery query = new WBQuery(); query.AddEqualsFilter(WBColumn.LiveOrArchived, WBColumn.LIVE_OR_ARCHIVED__LIVE); query.AddEqualsFilter(WBColumn.ProtectiveZone, WBRecordsType.PROTECTIVE_ZONE__PUBLIC); query.AddEqualsFilter(WBColumn.RecordSeriesStatus, WBColumn.RECORD_SERIES_STATUS__LATEST); query.AddIsNullFilter(WBColumn.SentNewlyPublishedAlert); query.AddFilter(WBColumn.DatePublished, WBQueryClause.Comparators.GreaterThan, DateTime.Now.AddDays(-_daysToIncludeNewlyPublishedPublicDocsInEmailAlerts)); query.RecursiveAll = true; return(query); }
internal Dictionary <String, String> GetCheckBoxDetailsForDocumentType(String documentType) { WBQuery query = new WBQuery(); query.AddEqualsFilter(WBColumn.DocumentType, documentType); query.AddEqualsFilter(WBColumn.UseCheckBox, true); query.OrderByAscending(WBColumn.Order); SPList checkBoxDetailsList = Libraries.ProtectedMasterLibrary.Web.Lists.TryGetList(CHECK_BOXES_LIST_TITLE); SPListItemCollection items = checkBoxDetailsList.WBxGetItems(Libraries.ProtectedMasterLibrary.Site, query); Dictionary <String, String> checkBoxDetails = new Dictionary <String, String>(); foreach (SPListItem item in items) { checkBoxDetails.Add(item.WBxGetAsString(WBColumn.CheckBoxCode), item.WBxGetAsString(WBColumn.CheckBoxText)); } return(checkBoxDetails); }
internal WBQuery GetQueryForTeamsPublicRecordsToArchiveInFutureWeek(WBTeam team, int weekInFuture, bool limitToJustOneWeek) { WBQuery query = new WBQuery(); if (team != null) { query.AddEqualsFilter(WBColumn.OwningTeam, team); } query.AddEqualsFilter(WBColumn.LiveOrArchived, WBColumn.LIVE_OR_ARCHIVED__LIVE); query.AddEqualsFilter(WBColumn.ProtectiveZone, WBRecordsType.PROTECTIVE_ZONE__PUBLIC); query.AddEqualsFilter(WBColumn.RecordSeriesStatus, WBColumn.RECORD_SERIES_STATUS__LATEST); query.OrderByAscending(WBColumn.ReviewDate); if (limitToJustOneWeek && weekInFuture > 1) { query.AddFilter(WBColumn.ReviewDate, WBQueryClause.Comparators.GreaterThanEquals, DateTime.Now.AddDays((-_weeksBetweenReviewDateAndAutoArchival + weekInFuture - 1) * 7)); } query.AddFilter(WBColumn.ReviewDate, WBQueryClause.Comparators.LessThan, DateTime.Now.AddDays((-_weeksBetweenReviewDateAndAutoArchival + weekInFuture) * 7)); query.RecursiveAll = true; return(query); }
public static void CheckTitlesOfFavouriteWorkBoxes(SPSite cacheSite, SPList cacheList, UserProfile profile) { WBLogging.TimerTasks.Verbose("Checking titles of favourite work boxes of: " + profile.DisplayName); UserProfileValueCollection favouriteWorkBoxesPropertyValue = profile[WorkBox.USER_PROFILE_PROPERTY__MY_FAVOURITE_WORK_BOXES]; String favouriteWBDetails = favouriteWorkBoxesPropertyValue.Value.WBxToString(); if (!String.IsNullOrEmpty(favouriteWBDetails)) { string[] favouriteWorkBoxes = favouriteWBDetails.Split(';'); if (favouriteWorkBoxes.Length > 0) { WBLogging.TimerTasks.Verbose("Found favourite work boxes: " + favouriteWorkBoxes.Length); bool hasChangesToSave = false; List <String> updatedFavouriteWorkBoxes = new List <String>(); foreach (string favouriteWorkBoxLinkDetails in favouriteWorkBoxes) { WBLink workBoxLink = new WBLink(favouriteWorkBoxLinkDetails); if (!workBoxLink.IsOK) { continue; } /* * string[] details = favouriteWorkBoxLinkDetails.Split('|'); * string workBoxTitle = details[0]; * string workBoxUrl = details[1]; * string workBoxUniqueID = details[2]; * string workBoxGUID = details[3]; */ try { WBQuery query = new WBQuery(); query.AddEqualsFilter(WBColumn.WorkBoxGUID, workBoxLink.SPWebGUID); query.AddViewColumn(WBColumn.Title); SPListItemCollection items = cacheList.WBxGetItems(cacheSite, query); if (items.Count > 0) { String cachedWBTitle = items[0].WBxGetAsString(WBColumn.Title); if (cachedWBTitle != workBoxLink.Title) { WBLogging.TimerTasks.Verbose("Updating work box title in favourite list: " + workBoxLink.Title + " -> " + cachedWBTitle); workBoxLink.Title = cachedWBTitle; hasChangesToSave = true; } } } catch (Exception exception) { WBLogging.Teams.Monitorable("Something went wrong when searching for a favourite work box" + exception.Message); } updatedFavouriteWorkBoxes.Add(workBoxLink.ToString()); } if (hasChangesToSave) { profile[WorkBox.USER_PROFILE_PROPERTY__MY_FAVOURITE_WORK_BOXES].Value = WBUtils.JoinUpToLimit(";", updatedFavouriteWorkBoxes, 3100); profile.Commit(); } } } }
public static void CheckLastModifiedDatesAndTitlesOfRecentWorkBoxes(SPSite cacheSite, SPList cacheList, UserProfile profile, long ticksAtLastUpdate) { WBLogging.TimerTasks.Verbose("Looking at work boxes recently visited by: " + profile.DisplayName); UserProfileValueCollection workBoxesRecentlyVisited = profile[WorkBox.USER_PROFILE_PROPERTY__MY_RECENTLY_VISITED_WORK_BOXES]; String recentlyVisitedDetails = workBoxesRecentlyVisited.Value.WBxToString(); if (!String.IsNullOrEmpty(recentlyVisitedDetails)) { string[] recentWorkBoxes = recentlyVisitedDetails.Split(';'); if (recentWorkBoxes.Length > 0) { WBLogging.TimerTasks.Verbose("Found recently visited work boxes: " + recentWorkBoxes.Length); bool hasChangesToSave = false; List <String> updatedRecentWorkBoxes = new List <String>(); foreach (string recentWorkBoxLinkDetails in recentWorkBoxes) { WBLink workBoxLink = new WBLink(recentWorkBoxLinkDetails); if (!workBoxLink.IsOK) { continue; } /* * string[] details = recentWorkBoxLinkDetails.Split('|'); * string workBoxTitle = details[0]; * string workBoxUrl = details[1]; * string workBoxUniqueID = details[2]; * string workBoxGUID = details[3]; */ try { long ticksWhenVisited = 0; //if (details.Length >= 5) if (workBoxLink.UsingTicksWhenVisited) { string ticksWhenVisitedString = workBoxLink.TicksWhenVisitedString; ticksWhenVisited = Convert.ToInt64(workBoxLink.TicksWhenVisitedString); // Would we have already done this recently visited work box during the last update: if (ticksWhenVisited > ticksAtLastUpdate) { // OK so we're going to update the details for this work box: using (WorkBox workBox = new WorkBox(workBoxLink.URL)) { workBox.RecentlyVisited(cacheList, ticksWhenVisited); } } } WBQuery query = new WBQuery(); query.AddEqualsFilter(WBColumn.WorkBoxGUID, workBoxLink.SPWebGUID); query.AddViewColumn(WBColumn.Title); SPListItemCollection items = cacheList.WBxGetItems(cacheSite, query); if (items.Count > 0) { String cachedWBTitle = items[0].WBxGetAsString(WBColumn.Title); if (cachedWBTitle != workBoxLink.Title) { WBLogging.TimerTasks.Verbose("Updating work box title in recently visited list: " + workBoxLink.Title + " -> " + cachedWBTitle); workBoxLink.Title = cachedWBTitle; hasChangesToSave = true; } } } catch (Exception exception) { WBLogging.Teams.Monitorable("Something went wrong when searching for a favourite work box" + exception.Message); } updatedRecentWorkBoxes.Add(workBoxLink.ToString()); } if (hasChangesToSave) { profile[WorkBox.USER_PROFILE_PROPERTY__MY_RECENTLY_VISITED_WORK_BOXES].Value = WBUtils.JoinUpToLimit(";", updatedRecentWorkBoxes, 3100); profile.Commit(); } } } }