private List <dtoItemFilter <ItemListStatus> > GetStatusItems(List <ItemListStatus> availableStatus, dtoProjectContext context, dtoItemsFilter filter, PageListType currentPageType, PageListType fromPage) { Int32 idContainer = View.IdContainerCommunity; ItemListStatus current = filter.GetContainerStatus(); switch (filter.Container) { case PageContainerType.ProjectsList: if (!availableStatus.Contains(current)) { current = (availableStatus.Contains(ItemListStatus.Active) ? ItemListStatus.Active : availableStatus.First()); } break; default: if (!availableStatus.Contains(current)) { current = (availableStatus.Contains(ItemListStatus.Active) ? ItemListStatus.Active : availableStatus.First()); } break; } List <dtoItemFilter <ItemListStatus> > items = (from i in availableStatus select new dtoItemFilter <ItemListStatus>() { Url = GenerateItemUrl(currentPageType, fromPage, filter, context, idContainer, filter.GroupBy, i), Value = i, Selected = (filter.GetContainerStatus() == i), DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.item }).ToList(); if (!items.Where(i => i.Selected).Any()) { items.First().Selected = true; switch (filter.Container) { case PageContainerType.ProjectsList: filter.ProjectsStatus = items.First().Value; break; default: filter.ActivitiesStatus = items.First().Value; break; } } items.First().DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.first; items.Last().DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.last; return(items); }
private void LoadAvailableGroupBy(dtoProjectContext context, dtoItemsFilter filter, PageListType currentPageType, PageListType fromPage) { List <ItemsGroupBy> availableItems = new List <ItemsGroupBy>(); switch (currentPageType) { case PageListType.DashboardAdministrator: case PageListType.DashboardManager: case PageListType.DashboardResource: availableItems.Add(ItemsGroupBy.CommunityProject); availableItems.Add(ItemsGroupBy.Project); availableItems.Add(ItemsGroupBy.Community); break; case PageListType.ProjectDashboardManager: case PageListType.ProjectDashboardResource: break; default: availableItems.Add(ItemsGroupBy.Community); break; } availableItems.Add(ItemsGroupBy.EndDate); availableItems.Add(ItemsGroupBy.Plain); if (!availableItems.Contains(filter.GroupBy)) { filter.GroupBy = ItemsGroupBy.Plain; } Int32 idContainer = View.IdContainerCommunity; List <dtoItemFilter <ItemsGroupBy> > items = (from i in availableItems select new dtoItemFilter <ItemsGroupBy>() { Url = GenerateItemUrl(currentPageType, fromPage, filter, context, idContainer, i, filter.GetContainerStatus(), View.CurrentActivityStatus), Value = i, Selected = (filter.GroupBy == i), DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.item }).ToList(); if (items.Count == 1) { items[0].DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.first | lm.Comol.Core.DomainModel.ItemDisplayOrder.last; } else if (items.Any()) { items.First().DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.first; items.Last().DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.last; } View.LoadGroupByFilters(items); }
private void LoadSummary(dtoProjectContext context, Int32 idContainerCommunity, PageListType currentPageType, PageListType fromPage, Person user, long idProject, dtoItemsFilter filter, SummaryTimeLine timeline, SummaryDisplay displayMode, Int32 idCommunity = -100) { if (idProject > 0) { LoadProjectSummary(context, idContainerCommunity, currentPageType, fromPage, user.Id, idProject, timeline, displayMode); } else if (displayMode == SummaryDisplay.Filtered) { if (filter.FilterBy != ProjectFilterBy.CurrentCommunity && filter.FilterBy != ProjectFilterBy.AllPersonalFromCurrentCommunity) { idCommunity = -100; } LoadSummary(context, idContainerCommunity, currentPageType, fromPage, user, timeline, displayMode, filter.FilterBy, filter.GetContainerStatus(), idCommunity); } else { LoadSummary(context, idContainerCommunity, currentPageType, fromPage, user, timeline, displayMode); } }