public Boolean VirtualUndeleteProject(long idProject, dtoItemsFilter filter, ItemsGroupBy groupBy, PageListType currentPage, Int32 idCommunity, Int32 pageIndex, Int32 pageSize, ref long deleted) { Boolean result = false; if (UserContext.isAnonymous) { View.DisplayPager(false); View.LoadedNoProjects(currentPage); } else { result = Service.SetProjectVirtualDelete(idProject, false); if (result) { View.SendUserAction(View.IdCurrentCommunityForList, CurrentIdModule, idProject, ModuleProjectManagement.ActionType.ProjectVirtualUndelete); } List <dtoPlainProject> projects = Service.GetProjects(UserContext.CurrentUserID, filter, currentPage, idCommunity, View.RoleTranslations); deleted = projects.Count; if (deleted > 0) { LoadProjects(Service.GetProjects(UserContext.CurrentUserID, filter, currentPage, idCommunity, View.RoleTranslations), groupBy, currentPage, filter.TimeLine, pageIndex, pageSize); } } return(result); }
private void UpdateGroups(dtoTasksGroup item, ItemsGroupBy groupBy, dtoProjectContext context, Int32 idContainerCommunity, dtoItemsFilter filter, PageContainerType container, PageListType fromPage, PageListType currentPage, SummaryTimeLine timeline) { foreach (dtoPlainTask task in item.Tasks) { task.IdFatherRow = item.IdRow; if (currentPage != PageListType.ProjectDashboardManager && currentPage != PageListType.ProjectDashboardResource) { task.ProjectInfo.ProjectDashboard = RootObject.ProjectDashboard(context, idContainerCommunity, task.ProjectInfo.Id, currentPage, currentPage, filter.TimeLine); } } switch (groupBy) { case ItemsGroupBy.Project: item.ProjectInfo = item.Tasks.First().ProjectInfo; if (item.HasPermission(PmActivityPermission.ManageProject)) { item.ProjectInfo.ProjectUrls.Edit = RootObject.EditProject(item.ProjectInfo.Id, item.ProjectInfo.IdCommunity, item.ProjectInfo.isPortal, item.ProjectInfo.isPersonal, currentPage, idContainerCommunity); item.ProjectInfo.ProjectUrls.ProjectMap = RootObject.ProjectMap(item.ProjectInfo.Id, item.ProjectInfo.IdCommunity, item.ProjectInfo.isPortal, item.ProjectInfo.isPersonal, currentPage, idContainerCommunity); } else if (item.HasPermission(PmActivityPermission.ViewProjectMap)) { item.ProjectInfo.ProjectUrls.ProjectMap = RootObject.ViewProjectMap(item.ProjectInfo.Id, item.ProjectInfo.IdCommunity, item.ProjectInfo.isPortal, item.ProjectInfo.isPersonal, currentPage, idContainerCommunity); } break; } }
private void GroupProjects(List <dtoPlainProject> projects, ItemsGroupBy groupBy, PageListType currentPage, SummaryTimeLine timeline, Int32 pageIndex, Int32 pageSize, PagerBase pager = null) { Int32 idContainerCommunity = View.IdCurrentCommunityForList; if (projects.Skip((pageIndex < 0 ? 0 : pageIndex) * pageSize).Take(pageSize).Any()) { String pName = View.GetPortalName(); String cName = View.GetUnknownCommunityName(); projects.Where(p => p.isPortal && p.IdCommunity == 0).ToList().ForEach(p => p.CommunityName = pName); projects.Where(p => !p.isPortal && p.IdCommunity < 0).ToList().ForEach(p => p.CommunityName = cName); List <dtoProjectsGroup> items = new List <dtoProjectsGroup>(); switch (groupBy) { case ItemsGroupBy.Community: items = GenerateCommunityTree(projects, idContainerCommunity, currentPage, timeline, pageIndex, pageSize); break; case ItemsGroupBy.EndDate: items = GenerateEndDateTree(projects, idContainerCommunity, currentPage, timeline, pageIndex, pageSize, pager); break; } View.LoadProjects(items, currentPage); } else { View.LoadedNoProjects(currentPage); } View.SendUserAction(View.IdCurrentCommunityForList, CurrentIdModule, GetDefaultAction(currentPage)); }
public void LoadProjects(dtoItemsFilter filter, ItemsGroupBy groupBy, PageListType currentPage, Int32 idCommunity, Int32 pageIndex, Int32 pageSize) { if (UserContext.isAnonymous) { View.DisplayPager(false); View.LoadedNoProjects(currentPage); } else { LoadProjects(Service.GetProjects(UserContext.CurrentUserID, filter, currentPage, idCommunity, View.RoleTranslations), groupBy, currentPage, filter.TimeLine, pageIndex, pageSize); } }
public dtoDisplayTimelineContext(dtoProjectContext context, Int32 idContainerCommunity, PageContainerType container, PageListType currentPage, PageListType fromPage, SummaryTimeLine timeline, SummaryDisplay display, ProjectFilterBy filterBy = ProjectFilterBy.All, ItemsGroupBy groupBy = ItemsGroupBy.None, ItemListStatus status = ItemListStatus.All) { FromPage = fromPage; ProjectContext = context; FromPage = fromPage; CurrentPage = currentPage; IdContainerCommunity = idContainerCommunity; Display = display; FilterBy = filterBy; ContainerTimeline = timeline; Container = container; GroupBy = groupBy; Status = status; }
private void LoadProjects(List <dtoPlainProject> projects, ItemsGroupBy groupBy, PageListType currentPage, SummaryTimeLine timeline, Int32 pageIndex, Int32 pageSize) { if (pageIndex < 0 && groupBy != ItemsGroupBy.EndDate) { pageIndex = 0; } PagerBase pager = new PagerBase(); pager.PageSize = pageSize;//Me.View.CurrentPageSize pager.Count = (projects.Count > 0) ? projects.Count - 1 : 0; if (pageIndex > -1) { pager.PageIndex = pageIndex;// Me.View.CurrentPageIndex View.Pager = pager; } GroupProjects(projects, groupBy, currentPage, timeline, pageIndex, pageSize, (pageIndex > -1 ? null : pager)); }
public dtoDisplayTimelineContext(dtoProjectContext context, Int32 idContainerCommunity, PageContainerType container, PageListType currentPage, PageListType fromPage, dtoItemsFilter filters, ItemsGroupBy groupBy = ItemsGroupBy.None) { FromPage = fromPage; ProjectContext = context; FromPage = fromPage; CurrentPage = currentPage; IdContainerCommunity = idContainerCommunity; Display = filters.Display; FilterBy = filters.FilterBy; ContainerTimeline = filters.TimeLine; Container = container; IdProject = filters.IdProject; if (groupBy != ItemsGroupBy.None) { GroupBy = groupBy; } else { GroupBy = filters.GroupBy; } }
public static String ProjectDashboard(dtoProjectContext context, Int32 idContainerCommunity, long idProject, PageListType fromPageType, PageListType toPage, ItemsGroupBy groupBy, ItemListStatus filterStatus, SummaryTimeLine timeline, UserActivityStatus actStatus = UserActivityStatus.Expired, SummaryTimeLine actTimeline = SummaryTimeLine.Week) { return(GetDashboardPage(context, idProject, toPage) + GetPageParameters(fromPageType, idContainerCommunity) + GetFilterParameters(groupBy, ProjectFilterBy.All, filterStatus, timeline, SummaryDisplay.Project) + GetDashboardActivityParametes(actStatus, actTimeline)); }
public static String Dashboard(dtoProjectContext context, long idProject, Int32 idContainerCommunity, PageContainerType container, PageListType fromPage, PageListType toPage, SummaryTimeLine timeline, SummaryDisplay display, ProjectFilterBy filterBy, ItemsGroupBy groupBy, ItemListStatus status, UserActivityStatus actStatus = UserActivityStatus.Ignore, SummaryTimeLine actTimeline = SummaryTimeLine.Week) { return(Dashboard(new dtoDisplayTimelineContext(context, idContainerCommunity, container, fromPage, timeline, display, filterBy, groupBy, status), idProject, toPage, actStatus, actTimeline)); }
public void InitView(dtoProjectContext context, Int32 idContainerCommunity, Boolean loadFromCookies, TabListItem tab, PageContainerType container, PageListType fromPage, PageListType currentPageType, ItemsGroupBy preloadGroupBy, ProjectFilterBy pFilterBy, ItemListStatus pProjectsStatus, ItemListStatus pActivitiesStatus, SummaryTimeLine pFilterTimeLine = SummaryTimeLine.Week, SummaryDisplay pFilterDisplay = SummaryDisplay.All, long idProject = 0, UserActivityStatus pUserActivitiesStatus = UserActivityStatus.Ignore, SummaryTimeLine pUserActivitiesTimeLine = SummaryTimeLine.Week) { Person p = CurrentManager.GetPerson(UserContext.CurrentUserID); View.PageContext = context; View.PageContainer = container; View.PageType = currentPageType; View.CurrentFromPage = fromPage; View.CurrendIdProject = idProject; View.IdContainerCommunity = idContainerCommunity; View.CurrentActivityStatus = pUserActivitiesStatus; View.CurrentActivityTimeLine = pUserActivitiesTimeLine; if (UserContext.isAnonymous || p == null) { View.DisplaySessionTimeout(); } else { View.CookieName = View.CookieStartName + container.ToString() + tab.ToString(); dtoItemsFilter filter = null; if (loadFromCookies) { filter = View.GetSavedFilters; View.CurrentActivityStatus = filter.UserActivitiesStatus; View.CurrentActivityTimeLine = filter.UserActivitiesTimeLine; idProject = filter.IdProject; View.CurrendIdProject = idProject; } if (filter == null) { filter = dtoItemsFilter.GenerateForGroup(container, (preloadGroupBy == ItemsGroupBy.None) ? ItemsGroupBy.Plain : preloadGroupBy); if (preloadGroupBy != ItemsGroupBy.None) { filter.FilterBy = pFilterBy; filter.ProjectsStatus = pProjectsStatus; filter.Display = pFilterDisplay; filter.TimeLine = pFilterTimeLine; filter.ActivitiesStatus = pActivitiesStatus; filter.UserActivitiesStatus = pUserActivitiesStatus; filter.UserActivitiesTimeLine = pUserActivitiesTimeLine; } filter.IdProject = idProject; } LoadFilters(p, context, filter, container, currentPageType, fromPage, pFilterTimeLine, idProject); View.SaveCurrentFilters(filter); View.InitializeTabs(Service.GetAvailableTabs(p.Id, context, container), tab, filter, context); LoadSummary(context, idContainerCommunity, currentPageType, fromPage, p, idProject, filter, pFilterTimeLine, pFilterDisplay, (context.IdCommunity > 0 ? context.IdCommunity : -100)); } }
private String GenerateItemUrl(PageListType currentPageType, PageListType fromPage, dtoItemsFilter filter, dtoProjectContext context, Int32 idContainerCommunity, ItemsGroupBy groupBy, ItemListStatus status, UserActivityStatus activitiesStatus = UserActivityStatus.Ignore) { switch (currentPageType) { case PageListType.ListAdministrator: return(RootObject.ProjectListAdministrator(context.IdCommunity, context.isForPortal, context.isPersonal, false, 0, groupBy, filter.FilterBy, status, filter.TimeLine, filter.Display)); case PageListType.ListManager: return(RootObject.ProjectListManager(context.IdCommunity, context.isForPortal, context.isPersonal, false, 0, groupBy, filter.FilterBy, status, filter.TimeLine, filter.Display)); case PageListType.ListResource: return(RootObject.ProjectListResource(context.IdCommunity, context.isForPortal, context.isPersonal, false, 0, groupBy, filter.FilterBy, status, filter.TimeLine, filter.Display)); case PageListType.DashboardManager: case PageListType.DashboardResource: case PageListType.DashboardAdministrator: return(RootObject.Dashboard(context, idContainerCommunity, View.PageContainer, fromPage, currentPageType, filter.TimeLine, filter.Display, filter.FilterBy, groupBy, status, activitiesStatus, View.CurrentActivityTimeLine)); case PageListType.ProjectDashboardResource: case PageListType.ProjectDashboardManager: return(RootObject.ProjectDashboard(context, idContainerCommunity, filter.IdProject, fromPage, currentPageType, groupBy, status, filter.TimeLine, activitiesStatus, View.CurrentActivityTimeLine)); default: return(""); } }
private void LoadTasks(List <dtoPlainTask> tasks, String unknownUser, dtoProjectContext context, Int32 idContainerCommunity, dtoItemsFilter filter, PageContainerType container, PageListType fromPage, PageListType currentPage, ItemsGroupBy groupBy, Int32 pageIndex, Int32 pageSize) { if (pageIndex < 0 && groupBy != ItemsGroupBy.EndDate) { pageIndex = 0; } PagerBase pager = new PagerBase(); pager.PageSize = pageSize;//Me.View.CurrentPageSize pager.Count = (tasks.Count > 0) ? tasks.Count - 1 : 0; if (pageIndex > -1) { pager.PageIndex = pageIndex;// Me.View.CurrentPageIndex pageIndex = (pageIndex > pager.PageIndex && pager.PageIndex >= 0) ? pager.PageIndex : pageIndex; View.Pager = pager; } GroupTasks(tasks, unknownUser, context, idContainerCommunity, filter, container, fromPage, currentPage, groupBy, filter.TimeLine, pageIndex, pageSize, (pageIndex > -1 ? null : pager)); SendDefaultAction(currentPage, filter.IdProject, context.IdCommunity); }
//public static dtoItemsFilter GenerateForGroup(ItemsGroupBy groupBy, Int32 idCommunity = -1, long idProject =0) { public static dtoItemsFilter GenerateForGroup(PageContainerType pageContainer, ItemsGroupBy groupBy) { return(GenerateForGroup(pageContainer, groupBy, -1, 0)); }
private void GroupTasks(List <dtoPlainTask> tasks, String unknownUser, dtoProjectContext context, Int32 idContainerCommunity, dtoItemsFilter filter, PageContainerType container, PageListType fromPage, PageListType currentPage, ItemsGroupBy groupBy, SummaryTimeLine timeline, Int32 pageIndex, Int32 pageSize, PagerBase pager = null) { if (tasks.Skip((pageIndex < 0 ? 0 : pageIndex) * pageSize).Take(pageSize).Any()) { Dictionary <long, List <dtoResource> > resources = tasks.Select(t => t.ProjectInfo.Id).Distinct().ToDictionary(t => t, t => Service.GetAvailableResources(t, unknownUser)); String pName = View.GetPortalName(); String cName = View.GetUnknownCommunityName(); tasks.Where(p => p.ProjectInfo.IdCommunity == 0).ToList().ForEach(p => p.ProjectInfo.CommunityName = pName); tasks.Where(p => p.ProjectInfo.IdCommunity < 0).ToList().ForEach(p => p.ProjectInfo.CommunityName = cName); tasks.ForEach(t => t.ProjectResources = (resources.ContainsKey(t.ProjectInfo.Id) ? resources[t.ProjectInfo.Id] : new List <dtoResource>())); List <dtoTasksGroup> items = new List <dtoTasksGroup>(); switch (groupBy) { case ItemsGroupBy.Community: items = GenerateCommunityTree(tasks, unknownUser, context, idContainerCommunity, filter, container, fromPage, currentPage, timeline, pageIndex, pageSize); break; case ItemsGroupBy.EndDate: items = GenerateEndDateTree(tasks, unknownUser, context, idContainerCommunity, filter, container, fromPage, currentPage, timeline, pageIndex, pageSize, pager); break; case ItemsGroupBy.Project: items = GenerateProjectTree(tasks, unknownUser, context, idContainerCommunity, filter, container, fromPage, currentPage, timeline, pageIndex, pageSize); break; } View.LoadTasks(items); } else { View.LoadedNoTasks(); } }
public static String GetFilterParameters(ItemsGroupBy groupBy = ItemsGroupBy.None, ProjectFilterBy filterBy = ProjectFilterBy.All, ItemListStatus filterStatus = ItemListStatus.All, SummaryTimeLine timeline = SummaryTimeLine.Week, SummaryDisplay display = SummaryDisplay.All) { return(groupBy == ItemsGroupBy.None ? "" : "&grp=" + groupBy.ToString() + "&fltBy=" + filterBy.ToString() + "&fltSts=" + filterStatus.ToString() + "&tml=" + timeline.ToString() + "&smd=" + display.ToString()); }
public static dtoItemsFilter GenerateForGroup(PageContainerType pageContainer, ItemsGroupBy groupBy, Int32 idCommunity, long idProject) { dtoItemsFilter filter = new dtoItemsFilter(); switch (idCommunity) { case 0: filter.FilterBy = ProjectFilterBy.FromPortal; break; case -1: filter.FilterBy = ProjectFilterBy.All; break; default: filter.FilterBy = ProjectFilterBy.CurrentCommunity; break; } filter.Container = pageContainer; filter.PageIndex = 0; filter.PageSize = 25; if (idProject == 0) { filter.Display = SummaryDisplay.All; } else { filter.Display = SummaryDisplay.Project; } filter.IdProject = idProject; filter.ProjectsStatus = (pageContainer == PageContainerType.ProjectDashboard) ? ItemListStatus.Late : ItemListStatus.All; filter.ActivitiesStatus = (pageContainer == PageContainerType.Dashboard) ? ItemListStatus.Late : ItemListStatus.All; filter.TimeLine = SummaryTimeLine.Week; filter.GroupBy = groupBy; switch (groupBy) { case ItemsGroupBy.Plain: filter.Ascending = true; filter.OrderBy = ProjectOrderBy.Deadline; break; case ItemsGroupBy.Community: filter.Ascending = true; filter.OrderBy = ProjectOrderBy.CommunityName; break; case ItemsGroupBy.EndDate: filter.Ascending = false; filter.OrderBy = ProjectOrderBy.EndDate; filter.PageIndex = -1; break; case ItemsGroupBy.Project: filter.Ascending = true; filter.OrderBy = ProjectOrderBy.Name; break; case ItemsGroupBy.CommunityProject: filter.Ascending = true; filter.OrderBy = ProjectOrderBy.CommunityName; break; } return(filter); }
public static String ProjectListManager(int idCommunity, Boolean forPortal, Boolean isPersonal, Boolean fromCookies = false, long idProject = 0, ItemsGroupBy groupBy = ItemsGroupBy.None, ProjectFilterBy filterBy = ProjectFilterBy.All, ItemListStatus filterStatus = ItemListStatus.All, SummaryTimeLine timeline = SummaryTimeLine.Week, SummaryDisplay display = SummaryDisplay.All) { return(modulehome + "ListManager.aspx?" + (idCommunity > 0 ? "&cId=" + idCommunity.ToString() : "") + "&isPortal=" + forPortal.ToString() + "&isPersonal=" + isPersonal.ToString() + (fromCookies ? "&fromCookies=true" : "") + GetFilterParameters(groupBy, filterBy, filterStatus, timeline, display) + (idProject == 0 ? "" : "#" + idProject.ToString())); }
public void LoadTasks(String unknownUser, dtoProjectContext context, Int32 idContainerCommunity, dtoItemsFilter filter, PageContainerType container, PageListType fromPage, PageListType currentPage, ItemsGroupBy groupBy, Int32 pageIndex, Int32 pageSize) { if (UserContext.isAnonymous) { View.DisplayPager(false); View.LoadedNoTasks(); } else { LoadTasks(Service.GetTasks(UserContext.CurrentUserID, filter, context.IdCommunity, container, fromPage, currentPage), unknownUser, context, idContainerCommunity, filter, container, fromPage, currentPage, groupBy, pageIndex, pageSize); } }