private void LoadTags(DashboardViewType tileRedirectOn, DisplayNoticeboard noticeboard, long idDashboard, List <dtoLiteTile> tiles, Int32 tileDisplayItems, GroupItemsBy groupBy) { OrderItemsBy orderby = View.CurrentOrderItemsBy; Boolean displayLessCommand = View.DisplayLessCommand; Language l = CurrentManager.GetDefaultLanguage(); displayLessCommand = displayLessCommand = (displayLessCommand) && tiles.Count() + ((noticeboard == DisplayNoticeboard.Hide) ? 0 : 1) > tileDisplayItems; List <dtoTileDisplay> items = null; if (View.IsPreview) { items = tiles.Select(t => new dtoTileDisplay(t, UserContext.Language.Id, l.Id, true) { CommandUrl = RootObject.DashboardPreview(idDashboard, tileRedirectOn, groupBy, orderby, t.Tile.Id, t.Tile.GetAvailableIdTags().FirstOrDefault()) }).ToList(); } else { items = tiles.Select(t => new dtoTileDisplay(t, UserContext.Language.Id, l.Id) { CommandUrl = RootObject.LoadPortalView(UserContext.CurrentUserID, tileRedirectOn, groupBy, orderby, noticeboard, t.Tile.Id, t.Tile.GetAvailableIdTags().FirstOrDefault(), true, displayLessCommand) }).ToList(); } if (displayLessCommand) { View.LoadTiles(noticeboard, items); View.DisplayMoreCommand = false; View.DisplayLessCommand = true; } { View.LoadTiles(noticeboard, items.Skip(0).Take(tileDisplayItems - ((noticeboard == DisplayNoticeboard.Hide) ? 0 : 1)).ToList()); View.DisplayMoreCommand = tiles.Count() + ((noticeboard == DisplayNoticeboard.Hide) ? 0 : 1) > tileDisplayItems; } }
public void ShowMoreCommunities(Boolean value, DashboardViewType view, OrderItemsBy orderBy, Boolean ascending, Int32 idCommunityType = -1, Int32 idRemoveCommunityType = -1, long idTile = -1, long idTag = -1, dtoTileDisplay tile = null) { View.DisplayLessCommand = value; View.DisplayMoreCommand = !value; switch (view) { case DashboardViewType.List: if (value) { View.SendUserAction(0, CurrentIdModule, ModuleDashboard.ActionType.ListDashboardMoreComminities); } else { View.SendUserAction(0, CurrentIdModule, ModuleDashboard.ActionType.ListDashboardLessComminities); } break; case DashboardViewType.Combined: if (value) { View.SendUserAction(0, CurrentIdModule, ModuleDashboard.ActionType.CombinedDashboardMoreCommunities); } else { View.SendUserAction(0, CurrentIdModule, ModuleDashboard.ActionType.CombinedDashboardLessCommunities); } break; } LoadCommunities(view, null, 0, (value) ? View.DefaultPageSize : View.CurrentPageSize, orderBy, ascending, idCommunityType, idRemoveCommunityType, idTile, idTag, tile); }
public void InitView(litePageSettings pageSettings, UserCurrentSettings userSettings, List <dtoItemFilter <OrderItemsBy> > items, Int32 idCommunityType = -1, Int32 idRemoveCommunityType = -1, long idTile = -1, long idTag = -1, dtoTileDisplay tile = null) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { View.IdCurrentCommunityType = idCommunityType; View.IdCurrentRemoveCommunityType = idRemoveCommunityType; View.IdCurrentTag = idTag; View.IdCurrentTile = (tile == null) ? idTile : tile.Id; View.IdCurrentTileTags = (tile == null) ? new List <long>() : tile.Tags; View.PageType = pageSettings.Type; View.DefaultPageSize = pageSettings.MaxMoreItems; Int32 itemsCount = Service.GetSubscribedCommunitiesCount(UserContext.CurrentUserID, pageSettings.Type, idCommunityType, idRemoveCommunityType, idTile, idTag, tile); Int32 pageSize = InitializePageSize(pageSettings, itemsCount); View.CurrentPageSize = pageSize; OrderItemsBy orderBy = items.Where(i => i.Selected).Select(i => i.Value).FirstOrDefault(); Boolean ascending = false; if (orderBy != userSettings.OrderBy) { switch (orderBy) { //case OrderItemsBy.ActivatedOn: //case OrderItemsBy.ClosedOn: //case OrderItemsBy.CreatedOn: //case OrderItemsBy.LastAccess: case OrderItemsBy.Name: ascending = true; break; } } else { ascending = userSettings.Ascending; } View.CurrentOrderBy = orderBy; View.CurrentAscending = ascending; View.AvailableColumns = new List <searchColumn>() { searchColumn.subscriptioninfo, searchColumn.genericdate }; LoadCommunities(pageSettings.Type, userSettings, 0, pageSize, orderBy, ascending, idCommunityType, idRemoveCommunityType, idTile, idTag, tile); } }
public void InitView(litePageSettings pageSettings, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, List <dtoItemFilter <OrderItemsBy> > items, liteTile tile = null) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { View.IsForSearch = true; View.PageType = DashboardViewType.Search; OrderItemsBy orderBy = items.Where(i => i.Selected).Select(i => i.Value).FirstOrDefault(); Boolean ascending = (orderBy == OrderItemsBy.Name); View.CurrentFilters = filters; View.CurrentOrderBy = orderBy; View.CurrentAscending = ascending; Int32 idUserLanguage = ((UserContext != null && UserContext.Language != null) ? UserContext.Language.Id : -2); Int32 idDefaultLanguage = CurrentManager.GetDefaultIdLanguage(); LoadCommunities(pageSettings, filters, orderBy, ascending, false, 0, 0, ModuleDashboard.ActionType.SearchDashboardLoadcommunities); } }
private void InitializeTileView(long idDashboard, Int32 miniTileDisplayItems, TileLayout tLayout, Boolean autoUpdateLayout, GroupItemsBy groupBy, OrderItemsBy orderBy, long preloadIdTile, TileType type, out dtoTileDisplay selectedTile) { List <dtoLiteTile> tiles = (View.IsPreview) ? Service.TilesGetForDashboard(idDashboard, type, false) : Service.TilesGetForUser(UserContext.CurrentUserID, idDashboard, type); if (tiles != null) { tiles = tiles.Where(t => t.Tile.Type != TileType.DashboardUserDefined && t.Tile.Type != TileType.UserDefined).ToList(); } if (tiles == null || !tiles.Any()) { View.DisplayUnableToLoadTile(RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.List, GroupItemsBy.None, OrderItemsBy.LastAccess, DisplayNoticeboard.OnRight)); View.CurrentTileLayout = tLayout; selectedTile = null; } else { View.CurrentTileLayout = Service.GetTileLayout(tiles.Count, tLayout, autoUpdateLayout); LoadMiniTiles(idDashboard, tiles, miniTileDisplayItems, groupBy, orderBy, preloadIdTile, out selectedTile); } }
public static String DashboardPreview(long idDashboard, DashboardViewType vType, GroupItemsBy groupBy, OrderItemsBy orderItemsBy, long idTile = -1, long idTag = -1) { return(dashboardmodulehome + "Preview.aspx?idDashboard=" + idDashboard.ToString() + "&vType=" + vType.ToString() + "&step=" + WizardDashboardStep.None.ToString() + "&g=" + groupBy.ToString() + "&o=" + orderItemsBy.ToString() + ((idTile == -1) ? "" : "&idTile=" + idTile.ToString()) + ((idTag == -1) ? "" : "&idTag=" + idTag.ToString())); }
public void UnsubscribeFromCommunity(Int32 idCommunity, String path, RemoveAction action, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsBy orderBy, Boolean ascending, Int32 pageIndex, Int32 pageSize) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { lm.Comol.Core.BaseModules.CommunityManagement.dtoUnsubscribeTreeNode node = Service.UnsubscribeInfo(UserContext.CurrentUserID, idCommunity, path); if (node != null) { switch (action) { case RemoveAction.None: break; default: ModuleDashboard.ActionType dAction = ModuleDashboard.ActionType.UnableToUnsubscribe; List <liteSubscriptionInfo> subscriptions = Service.UnsubscribeFromCommunity(UserContext.CurrentUserID, node, action); if (subscriptions == null && !subscriptions.Any()) { switch (action) { case RemoveAction.FromCommunity: dAction = ModuleDashboard.ActionType.UnableToUnsubscribeFromCommunity; View.DisplayUnableToUnsubscribe(node.Name); break; case RemoveAction.FromAllSubCommunities: dAction = ModuleDashboard.ActionType.UnableToUnsubscribeFromCommunities; View.DisplayUnsubscriptionMessage(new List <String>(), node.GetAllNodes().Where(n => n.AllowUnsubscribe()).Select(n => n.Name).ToList()); break; } } else { switch (action) { case RemoveAction.FromCommunity: dAction = ModuleDashboard.ActionType.UnsubscribeFromCommunity; View.DisplayUnsubscribedFrom(node.Name); break; case RemoveAction.FromAllSubCommunities: dAction = ModuleDashboard.ActionType.UnsubscribeFromCommunities; View.DisplayUnsubscriptionMessage(node.GetAllNodes().Where(n => n.AllowUnsubscribe() && subscriptions.Where(s => s.IdCommunity == n.Id && s.IdRole < 1).Any()).Select(n => n.Name).ToList(), node.GetAllNodes().Where(n => n.AllowUnsubscribe() && subscriptions.Where(s => s.IdCommunity == n.Id && s.IdRole > 0).Any()).Select(n => n.Name).ToList() ); break; } } View.SendUserAction(0, CurrentIdModule, idCommunity, dAction); break; } } else { String name = CurrentManager.GetCommunityName(idCommunity); if (!String.IsNullOrEmpty(name)) { View.DisplayUnableToUnsubscribe(name); } View.SendUserAction(0, CurrentIdModule, idCommunity, ModuleDashboard.ActionType.UnableToUnsubscribe); } LoadCommunities(filters, orderBy, ascending, pageIndex, pageSize); } }
public void LoadCommunities(DashboardViewType view, UserCurrentSettings userSettings, Int32 pageIndex, Int32 pageSize, OrderItemsBy orderBy, Boolean ascending, Int32 idCommunityType = -1, Int32 idRemoveCommunityType = -1, long idTile = -1, long idTag = -1, dtoTileDisplay tile = null) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { if (View.DisplayLessCommand) { Int32 itemsCount = Service.GetSubscribedCommunitiesCount(UserContext.CurrentUserID, view, idCommunityType, idRemoveCommunityType, idTile, idTag, tile); PagerBase pager = new PagerBase(); pager.PageSize = pageSize; //Me.View.CurrentPageSize pager.Count = (itemsCount > 0) ? itemsCount - 1 : 0; pager.PageIndex = pageIndex; // Me.View.CurrentPageIndex View.Pager = pager; } List <dtoSubscriptionItem> items = Service.GetSubscribedCommunities(UserContext.CurrentUserID, view, pageIndex, pageSize, orderBy, ascending, idCommunityType, idRemoveCommunityType, idTile, idTag, tile); if (items != null) { List <Int32> withNews = View.GetIdcommunitiesWithNews(items.Where(i => i.Status != SubscriptionStatus.communityblocked && i.Status != SubscriptionStatus.blocked && i.Status != SubscriptionStatus.waiting).Select(i => i.Community.Id).ToList(), UserContext.CurrentUserID); if (withNews.Any()) { items.Where(i => withNews.Contains(i.Community.Id)).ToList().ForEach(i => i.HasNews = true); } switch (view) { case DashboardViewType.List: case DashboardViewType.Combined: Language l = CurrentManager.GetDefaultLanguage(); Dictionary <Int32, List <String> > tags = ServiceTags.GetCommunityAssociationToString(items.Select(i => i.Community.Id).ToList(), UserContext.Language.Id, l.Id, true); if (tags.Any()) { foreach (dtoSubscriptionItem item in items.Where(i => tags.ContainsKey(i.Community.Id))) { item.Community.Tags = tags[item.Community.Id]; } } break; } View.LoadItems(items, orderBy, ascending); if (userSettings != null) { userSettings.Ascending = ascending; userSettings.OrderBy = orderBy; userSettings.View = view; View.UpdateUserSettings(userSettings); } //View.SendUserAction(0, CurrentIdModule, ModuleDashboard.ActionType.ListDashboardLoadSubscribedCommunities); } else { View.DisplayErrorFromDB(); } } }
private void LoadCommunities(litePageSettings pageSettings, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsBy orderBy, Boolean ascending, Boolean useCache, Int32 pageIndex = 0, Int32 pageSize = 0, ModuleDashboard.ActionType action = ModuleDashboard.ActionType.SearchDashboardApplyFilters) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { List <dtoSubscriptionItem> items = Service.GetCommunities(UserContext.CurrentUserID, filters, useCache); if (items == null) { View.DisplayErrorFromDB(); } else { Int32 itemsCount = items.Count(); if (pageSettings != null) { View.DefaultPageSize = pageSettings.MaxItems; InitializeColumns(filters); pageSize = InitializeSearchPageSize(pageSettings, itemsCount); View.CurrentPageSize = pageSize; } if (pageSize == 0) { pageSize = View.CurrentPageSize; } PagerBase pager = new PagerBase(); pager.PageSize = pageSize; pager.Count = (itemsCount > 0) ? itemsCount - 1 : 0; pager.PageIndex = pageIndex; View.Pager = pager; items = Service.GetCommunities(UserContext.Language.Id, items, pageIndex, pageSize, orderBy, ascending); if (items != null) { List <Int32> withNews = View.GetIdcommunitiesWithNews(items.Where(i => i.Status != SubscriptionStatus.communityblocked && i.Status != SubscriptionStatus.blocked && i.Status != SubscriptionStatus.waiting).Select(i => i.Community.Id).ToList(), UserContext.CurrentUserID); if (withNews.Any()) { items.Where(i => withNews.Contains(i.Community.Id)).ToList().ForEach(i => i.HasNews = true); } Language l = CurrentManager.GetDefaultLanguage(); Dictionary <Int32, List <String> > tags = ServiceTags.GetCommunityAssociationToString(items.Select(i => i.Community.Id).ToList(), UserContext.Language.Id, l.Id, true); if (tags.Any()) { foreach (dtoSubscriptionItem item in items.Where(i => tags.ContainsKey(i.Community.Id))) { item.Community.Tags = tags[item.Community.Id]; } } View.LoadItems(items, orderBy, ascending); //View.SendUserAction(0, CurrentIdModule, action); } else { View.LoadItems(new List <dtoSubscriptionItem>(), orderBy, ascending); } } } }
public void UnsubscribeFromCommunity(Int32 idCommunity, String path, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsBy orderBy, Boolean ascending, Int32 pageIndex, Int32 pageSize) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { lm.Comol.Core.BaseModules.CommunityManagement.dtoUnsubscribeTreeNode node = Service.UnsubscribeInfo(UserContext.CurrentUserID, idCommunity, path); if (node != null) { ModuleDashboard.ActionType dAction = ModuleDashboard.ActionType.None; List <lm.Comol.Core.BaseModules.CommunityManagement.dtoUnsubscribeTreeNode> nodes = node.GetAllNodes(); if (!nodes.Where(n => n.AllowUnsubscribe()).Any()) { View.DisplayUnableToUnsubscribe(CurrentManager.GetCommunityName(idCommunity)); dAction = ModuleDashboard.ActionType.UnableToUnsubscribeFromCommunity; } else { List <RemoveAction> actions = new List <RemoveAction>(); actions.Add(RemoveAction.None); actions.Add(RemoveAction.FromCommunity); if (nodes.Where(n => n.AllowUnsubscribe()).Count() > 1) { actions.Add(RemoveAction.FromAllSubCommunities); } if (node == null) { View.DisplayUnableToUnsubscribe(CurrentManager.GetCommunityName(idCommunity)); dAction = ModuleDashboard.ActionType.UnableToUnsubscribeFromCommunity; } else if (!node.AllowUnsubscribe()) { View.DisplayUnsubscribeNotAllowed(node.Name); dAction = ModuleDashboard.ActionType.UnsubscribeNotallowed; } else if (node.AllowUnsubscribe() && (!node.CommunityAllowSubscription || node.MaxUsersWithDefaultRole > 0 || (node.CommunitySubscriptionEndOn.HasValue && DateTime.Now.AddDays(30) > node.CommunitySubscriptionEndOn.Value))) { View.DisplayConfirmMessage(idCommunity, path, node, actions, RemoveAction.None, nodes.Where(n => n.AllowUnsubscribe() && n.Id != idCommunity).ToList()); dAction = ModuleDashboard.ActionType.RequireUnsubscribeConfirm; } else { if (nodes.Where(n => n.AllowUnsubscribe()).Count() > 1) { View.DisplayConfirmMessage(idCommunity, path, node, actions, RemoveAction.FromCommunity, nodes.Where(n => n.AllowUnsubscribe() && n.Id != idCommunity).ToList()); dAction = ModuleDashboard.ActionType.RequireUnsubscribeConfirmFromSubCommunities; } else { List <liteSubscriptionInfo> subscriptions = Service.UnsubscribeFromCommunity(UserContext.CurrentUserID, node, RemoveAction.FromCommunity); if (subscriptions != null && subscriptions.Any() && subscriptions.Count == 1 && subscriptions[0].IdRole < 1) { View.DisplayUnsubscribedFrom(node.Name); dAction = ModuleDashboard.ActionType.UnsubscribeFromCommunity; } else { View.DisplayUnableToUnsubscribe(node.Name); dAction = ModuleDashboard.ActionType.UnableToUnsubscribeFromCommunity; } } } } View.SendUserAction(0, CurrentIdModule, idCommunity, dAction); } else { String name = CurrentManager.GetCommunityName(idCommunity); if (!String.IsNullOrEmpty(name)) { View.DisplayUnableToUnsubscribe(CurrentManager.GetCommunityName(idCommunity)); } View.SendUserAction(0, CurrentIdModule, idCommunity, ModuleDashboard.ActionType.UnableToUnsubscribe); } LoadCommunities(filters, orderBy, ascending, pageIndex, pageSize); } }
public void ApplyFilters(litePageSettings pageSettings, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsBy orderBy, Boolean ascending) { View.CurrentFilters = filters; LoadCommunities(pageSettings, filters, orderBy, ascending, false, 0, View.CurrentPageSize); }
public void LoadCommunities(lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsBy orderBy, Boolean ascending, Int32 pageIndex, Int32 pageSize) { LoadCommunities(null, filters, orderBy, ascending, true, pageIndex, pageSize, ModuleDashboard.ActionType.SearchDashboardChangePageIndex); }
public static String LoadPortalView(Int32 iduser, DashboardViewType view, GroupItemsBy groupBy, OrderItemsBy orderItemsBy, DisplayNoticeboard dNoticeboard, long idTile = -1, long idTag = -1, Boolean loadFromUrl = false, Boolean moreTiles = false, Boolean moreCommunities = false) { return(GetPortalPage(iduser, view) + "g=" + groupBy.ToString() + "&n=" + dNoticeboard.ToString() + "&o=" + orderItemsBy.ToString() + ((idTile == -1) ? "" : "&idTile=" + idTile.ToString()) + ((idTag == -1) ? "" : "&idTag=" + idTag.ToString()) + ((!loadFromUrl) ? "" : "&lfu=" + loadFromUrl.ToString()) + ((!moreTiles) ? "" : "&mt=" + moreTiles.ToString()) + ((!moreCommunities) ? "" : "&mc=" + moreCommunities.ToString())); }
private void InitializeTagView(long idDashboard, Int32 miniTileDisplayItems, TileLayout tLayout, Boolean autoUpdateLayout, OrderItemsBy orderBy, ref long preloadIdTag) { List <dtoLiteTile> tiles = Service.TilesGetForUser(UserContext.CurrentUserID, idDashboard, TileType.CommunityTag); if (tiles == null || !tiles.Any()) { View.DisplayUnableToLoadTile(RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.List, GroupItemsBy.None, OrderItemsBy.LastAccess, DisplayNoticeboard.OnRight)); } View.CurrentTileLayout = Service.GetTileLayout(tiles.Count, tLayout, autoUpdateLayout); LoadMiniTags(tiles, miniTileDisplayItems, GroupItemsBy.Tag, orderBy, ref preloadIdTag); }
public void ShowMoreCommunities(long idDashboard, Int32 miniTileDisplayItems, TileLayout tLayout, Boolean autoUpdateLayout, GroupItemsBy groupBy, OrderItemsBy orderBy, long idCurrentTile, Boolean value, Boolean moreCommunities) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.Combined, groupBy, orderBy, View.CurrentDisplayNoticeboard, idCurrentTile, View.IdCurrentTag, true, value, moreCommunities)); } else { View.DisplayLessCommand = value; View.DisplayMoreCommand = !value; if (value) { View.SendUserAction(0, CurrentIdModule, idDashboard, ModuleDashboard.ActionType.CombinedDashboardMoreTiles); } else { View.SendUserAction(0, CurrentIdModule, idDashboard, ModuleDashboard.ActionType.CombinedDashboardLessTiles); } dtoTileDisplay selectedTile = null; switch (groupBy) { case GroupItemsBy.CommunityType: InitializeTileView(idDashboard, miniTileDisplayItems, tLayout, autoUpdateLayout, groupBy, orderBy, idCurrentTile, TileType.CommunityType, out selectedTile); break; case GroupItemsBy.Tile: InitializeTileView(idDashboard, miniTileDisplayItems, tLayout, autoUpdateLayout, groupBy, orderBy, idCurrentTile, TileType.CombinedTags, out selectedTile); break; case GroupItemsBy.Tag: InitializeTileView(idDashboard, miniTileDisplayItems, tLayout, autoUpdateLayout, groupBy, orderBy, idCurrentTile, TileType.CommunityTag, out selectedTile); break; case GroupItemsBy.None: View.LoadDashboard(RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.List, GroupItemsBy.None, OrderItemsBy.LastAccess, DisplayNoticeboard.OnRight)); break; } } }
private void LoadMiniTags(List <dtoLiteTile> tiles, Int32 miniTileDisplayItems, GroupItemsBy groupBy, OrderItemsBy orderBy, ref long preloadIdTag) { long idTag = preloadIdTag; Boolean displayLessCommand = View.DisplayLessCommand; if (!tiles.Where(t => t.HasOnlyThisIdTag(idTag)).Any()) { idTag = tiles.Where(t => t.HasOnlyOneTag()).Select(t => t.Tile.GetFirstIdTag()).FirstOrDefault(); } View.IdCurrentTag = idTag; Language l = CurrentManager.GetDefaultLanguage(); displayLessCommand = (displayLessCommand) && tiles.Where(t => !t.HasOnlyThisIdTag(idTag)).Count() > miniTileDisplayItems; Boolean forPreview = View.IsPreview; List <dtoTileDisplay> items = tiles.Where(t => !t.HasOnlyThisIdTag(idTag)).Select(t => new dtoTileDisplay(t, UserContext.Language.Id, l.Id, forPreview) { CommandUrl = RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.Combined, groupBy, orderBy, DisplayNoticeboard.OnRight, t.Tile.Id, -1, true, displayLessCommand, false) }).ToList(); if (displayLessCommand) { View.LoadMiniTiles(items); View.DisplayMoreCommand = false; View.DisplayLessCommand = true; } { View.LoadMiniTiles(items.Skip(0).Take(miniTileDisplayItems).ToList()); View.DisplayMoreCommand = (tiles.Where(t => !t.HasOnlyThisIdTag(idTag)).Count() > miniTileDisplayItems); } preloadIdTag = idTag; }
private void LoadMiniTiles(long idDashboard, List <dtoLiteTile> tiles, Int32 miniTileDisplayItems, GroupItemsBy groupBy, OrderItemsBy orderBy, long preloadIdTile, out dtoTileDisplay selectedTile) { Boolean displayLessCommand = View.DisplayLessCommand; if (!tiles.Where(t => t.Tile.Id == preloadIdTile).Any()) { preloadIdTile = tiles.Select(t => t.Tile.Id).FirstOrDefault(); } View.IdCurrentTile = preloadIdTile; Language l = CurrentManager.GetDefaultLanguage(); displayLessCommand = (displayLessCommand) && tiles.Where(t => t.Tile.Id != preloadIdTile).Count() > miniTileDisplayItems; List <dtoTileDisplay> items = null; Boolean forPreview = View.IsPreview; if (forPreview) { items = tiles.Where(t => t.Tile.Id != preloadIdTile).Select(t => new dtoTileDisplay(t, UserContext.Language.Id, l.Id, forPreview) { CommandUrl = RootObject.DashboardPreview(idDashboard, DashboardViewType.Combined, groupBy, orderBy, t.Tile.Id) }).ToList(); } else { items = tiles.Where(t => t.Tile.Id != preloadIdTile).Select(t => new dtoTileDisplay(t, UserContext.Language.Id, l.Id) { CommandUrl = RootObject.LoadPortalView(UserContext.CurrentUserID, DashboardViewType.Combined, groupBy, orderBy, DisplayNoticeboard.OnRight, t.Tile.Id, -1, true, displayLessCommand, false) }).ToList(); } if (displayLessCommand) { View.LoadMiniTiles(items); View.DisplayMoreCommand = false; View.DisplayLessCommand = true; } else { View.LoadMiniTiles(items.Skip(0).Take(miniTileDisplayItems).ToList()); View.DisplayMoreCommand = (tiles.Where(t => t.Tile.Id != preloadIdTile).Count() > miniTileDisplayItems); } selectedTile = tiles.Where(t => t.Tile.Id == preloadIdTile).Select(t => new dtoTileDisplay(t, UserContext.Language.Id, l.Id, forPreview)).FirstOrDefault(); }