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;
 }
Пример #2
0
        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));
        }
Пример #3
0
 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());
 }
Пример #4
0
 public static String ProjectDashboard(dtoProjectContext context, Int32 idContainerCommunity, long idProject, PageListType fromPageType, PageListType toPage, SummaryTimeLine timeline, UserActivityStatus actStatus = UserActivityStatus.Expired, SummaryTimeLine actTimeline = SummaryTimeLine.Week)
 {
     return(GetDashboardPage(context, idProject, toPage) + GetPageParameters(fromPageType, idContainerCommunity) + "&tml=" + timeline.ToString() + GetDashboardActivityParametes(actStatus, actTimeline));
 }
Пример #5
0
 private static String GetDashboardActivityParametes(UserActivityStatus actStatus, SummaryTimeLine actTimeline)
 {
     return((actStatus == UserActivityStatus.Ignore) ? "" : "&aSt=" + actStatus.ToString() + "&aTml=" + actTimeline.ToString());
 }
Пример #6
0
 public static String Dashboard(dtoDisplayTimelineContext context, PageListType toPage, UserActivityStatus actStatus, SummaryTimeLine actTimeline)
 {
     return(Dashboard(context, 0, toPage, actStatus, actTimeline));
 }
 private void LoadAvailableStatus(Person user, dtoProjectContext context, dtoItemsFilter filter, PageContainerType containerType, PageListType currentPageType, PageListType fromPage, SummaryTimeLine timeline, long idProject = 0)
 {
     View.LoadStatusFilters(GetStatusItems(Service.GetAvailableFilterStatus(user, context, filter, containerType, currentPageType, timeline, idProject), context, filter, currentPageType, fromPage));
 }
Пример #8
0
        private List <dtoTasksGroup> GenerateProjectTree(List <dtoPlainTask> projectTasks, List <dtoPlainTask> availableTasks, dtoProjectContext context, Int32 idContainerCommunity, dtoItemsFilter filter, PageContainerType container, PageListType fromPage, PageListType currentPage, SummaryTimeLine timeline, Int32 pageIndex, Int32 pageSize)
        {
            List <dtoTasksGroup> items = new List <dtoTasksGroup>();
            String cssClass            = View.GetContainerCssClass(ItemsGroupBy.Project);
            Int32  cCount = View.GetCellsCount(currentPage);
            String sRow   = View.GetStartRowId(ItemsGroupBy.Project);

            projectTasks.OrderBy(p => p.ProjectInfo.VirtualProjectName).GroupBy(p => p.ProjectInfo.VirtualProjectName).OrderBy(p => p.Key).ToList().ForEach(
                p => items.Add(new dtoTasksGroup()
            {
                Id             = p.FirstOrDefault().ProjectInfo.Id,
                Name           = p.FirstOrDefault().ProjectInfo.Name,
                Tasks          = p.ToList(),
                CssClass       = cssClass,
                CellsCount     = cCount,
                IdRowFirstItem = sRow + p.First().Id.ToString(),
                IdRowLastItem  = sRow + p.Last().Id.ToString(),
                IdRow          = sRow + p.FirstOrDefault().ProjectInfo.Id.ToString()
            }));
            items.ForEach(i => UpdateGroups(i, context, idContainerCommunity, filter, container, fromPage, currentPage, timeline));
            long idFirstProject = items.First().Tasks.Select(p => p.ProjectInfo.Id).FirstOrDefault();
            long idLastProject  = items.Last().Tasks.Select(p => p.ProjectInfo.Id).FirstOrDefault();

            if (pageIndex > 0 && availableTasks.OrderBy(p => p.ProjectInfo.VirtualProjectName).Skip((pageIndex - 1) * pageSize).Where(p => p.ProjectInfo.Id == idFirstProject).Any())
            {
                items.First().PreviousPageIndex = pageIndex - 1;
            }
            if (availableTasks.OrderBy(p => p.ProjectInfo.VirtualProjectName).Skip((pageIndex + 1) * pageSize).Where(p => p.ProjectInfo.Id == idLastProject).Any())
            {
                items.Last().NextPageIndex = pageIndex + 1;
            }

            return(items);
        }
Пример #9
0
        private void UpdateGroups(dtoTasksGroup item, 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);
                }
            }

            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);
            }
        }
Пример #10
0
        private void GroupTasks(List <dtoPlainTask> tasks, String unknownUser, dtoProjectContext context, Int32 idContainerCommunity, dtoItemsFilter filter, PageContainerType container, PageListType fromPage, PageListType currentPage, 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>()));

                View.LoadTasks(GenerateCommunityProjectTree(tasks, context, idContainerCommunity, filter, container, fromPage, currentPage, timeline, pageIndex, pageSize));
            }
            else
            {
                View.LoadedNoTasks();
            }
        }
Пример #11
0
        private List <dtoCommunityProjectTasksGroup> GenerateCommunityProjectTree(List <dtoPlainTask> tasks, dtoProjectContext context, Int32 idContainerCommunity, dtoItemsFilter filter, PageContainerType container, PageListType fromPage, PageListType currentPage, SummaryTimeLine timeline, Int32 pageIndex, Int32 pageSize)
        {
            List <dtoCommunityProjectTasksGroup> items = new List <dtoCommunityProjectTasksGroup>();
            Int32  cCount = View.GetCellsCount(currentPage);
            String sRow   = View.GetStartRowId(ItemsGroupBy.Community);

            tasks.OrderBy(p => p.ProjectInfo.CommunityName).Skip(pageIndex * pageSize).Take(pageSize).GroupBy(p => p.ProjectInfo.VirtualCommunityName).OrderBy(p => p.Key).ToList().ForEach(
                p => items.Add(new dtoCommunityProjectTasksGroup()
            {
                Id             = p.FirstOrDefault().ProjectInfo.IdCommunity,
                Name           = p.FirstOrDefault().ProjectInfo.CommunityName,
                Projects       = GenerateProjectTree(p.ToList(), tasks, context, idContainerCommunity, filter, container, fromPage, currentPage, timeline, pageIndex, pageSize),
                CellsCount     = cCount,
                IdRowFirstItem = sRow + p.First().Id.ToString(),
                IdRowLastItem  = sRow + p.Last().Id.ToString(),
                IdRow          = sRow + p.FirstOrDefault().ProjectInfo.IdCommunity.ToString()
            }));
            long idFirstCommunity = items.First().Projects.Select(p => p.ProjectInfo.IdCommunity).FirstOrDefault();
            long idLastCommunity  = items.Last().Projects.Select(p => p.ProjectInfo.IdCommunity).FirstOrDefault();

            if (pageIndex > 0 && !items.Where(i => i.Projects.Where(p => p.PreviousPageIndex != -1).Any()).Any() && tasks.OrderBy(p => p.ProjectInfo.VirtualCommunityName).Skip((pageIndex - 1) * pageSize).Where(p => p.ProjectInfo.IdCommunity == idFirstCommunity).Any())
            {
                items.First().PreviousPageIndex = pageIndex - 1;
            }
            if (!items.Where(i => i.Projects.Where(p => p.NextPageIndex != -1).Any()).Any() && tasks.OrderBy(p => p.ProjectInfo.VirtualCommunityName).Skip((pageIndex + 1) * pageSize).Where(p => p.ProjectInfo.IdCommunity == idLastCommunity).Any())
            {
                items.Last().NextPageIndex = pageIndex + 1;
            }

            return(items);
        }
Пример #12
0
        private void UpdateProjects(String idFatherRow, List <dtoPlainProject> projects, Int32 idContainerCommunity, PageListType currentPage, SummaryTimeLine timeline)
        {
            foreach (dtoPlainProject p in projects)
            {
                p.IdFatherRow         = idFatherRow;
                p.Urls.Edit           = RootObject.EditProject(p.Id, p.IdCommunity, p.isPortal, p.isPersonal, currentPage, idContainerCommunity);
                p.Urls.EditResources  = RootObject.ProjectResources(p.Id, p.IdCommunity, p.isPortal, p.isPersonal, currentPage, idContainerCommunity);
                p.Urls.PhisicalDelete = RootObject.PhisicalDeleteProject(p.Id, p.IdCommunity, p.isPortal, p.isPersonal, currentPage, idContainerCommunity);
                switch (currentPage)
                {
                case PageListType.ListResource:
                    p.Urls.ProjectUrl = RootObject.ProjectDashboard(p.IdCommunity, p.isPortal, p.isPersonal, idContainerCommunity, p.Id, currentPage, PageListType.ProjectDashboardResource, timeline, GetDefaultUserActivityStatus(p), timeline);
                    break;

                case PageListType.ListManager:
                    p.Urls.ProjectUrl = RootObject.ProjectDashboard(p.IdCommunity, p.isPortal, p.isPersonal, idContainerCommunity, p.Id, currentPage, PageListType.DashboardManager, timeline, GetDefaultUserActivityStatus(p), timeline);
                    break;

                case PageListType.ListAdministrator:
                    p.Urls.ProjectUrl = RootObject.ProjectDashboard(p.IdCommunity, p.isPortal, p.isPersonal, idContainerCommunity, p.Id, currentPage, PageListType.DashboardManager, timeline, GetDefaultUserActivityStatus(p), timeline);
                    break;
                }
                if (p.Permissions.EditMap)
                {
                    p.Urls.ProjectMap = RootObject.ProjectMap(p.Id, p.IdCommunity, p.isPortal, p.isPersonal, currentPage, idContainerCommunity);
                }
                else if (p.Permissions.ViewMap)
                {
                    p.Urls.ProjectMap = RootObject.ViewProjectMap(p.Id, p.IdCommunity, p.isPortal, p.isPersonal, currentPage, idContainerCommunity);
                }
            }
        }
Пример #13
0
        private List <dtoProjectsGroup> GenerateEndDateTree(List <dtoPlainProject> projects, Int32 idContainerCommunity, PageListType currentPage, SummaryTimeLine timeline, Int32 pageIndex, Int32 pageSize, PagerBase pager)
        {
            List <dtoProjectsGroup> items = new List <dtoProjectsGroup>();
            String cssClass = View.GetContainerCssClass(ItemsGroupBy.EndDate);
            Int32  cCount   = View.GetCellsCount(currentPage);
            String sRow     = View.GetStartRowId(ItemsGroupBy.EndDate);

            Dictionary <TimeGroup, String> timeTranslations = View.GetTimeTranslations();
            List <dtoTimeGroup>            timegroups       = GetAvailableTimeGroups(projects.Select(p => p.VirtualEndDate).ToList());

            foreach (dtoPlainProject p in projects)
            {
                p.TimeGroup = GetTimeGroupByDate(timegroups, p.VirtualEndDate);
            }
            if (pageIndex == -1 && pager != null)
            {
                pageIndex       = GetCurrentPageIndex(pageSize, projects);
                pager.PageIndex = pageIndex;// Me.View.CurrentPageIndex
                View.Pager      = pager;
            }
            String dateTimePattern = View.GetDateTimePattern();
            Dictionary <Int32, String> monthNames = View.GetMonthNames();

            if (projects.Skip(pageIndex * pageSize).Take(pageSize).Any())
            {
                foreach (dtoTimeGroup t in GetAvailableTimeGroups(timegroups, projects.Skip(pageIndex * pageSize).Take(pageSize).Select(p => p.VirtualEndDate).ToList()))
                {
                    items.Add(new dtoProjectsGroup()
                    {
                        Id             = ((long)t.TimeLine),
                        Name           = GetTimeGroupDisplayName(timeTranslations[t.TimeLine], t, dateTimePattern, monthNames),
                        Projects       = projects.Where(p => p.VirtualEndDate.Ticks >= t.FromTicks && p.VirtualEndDate.Ticks <= t.ToTicks).ToList(),
                        CssClass       = cssClass,
                        CellsCount     = cCount,
                        IdRowFirstItem = sRow + projects.Where(p => p.VirtualEndDate.Ticks >= t.FromTicks && p.VirtualEndDate.Ticks <= t.ToTicks).First().Id.ToString(),
                        IdRowLastItem  = sRow + projects.Where(p => p.VirtualEndDate.Ticks >= t.FromTicks && p.VirtualEndDate.Ticks <= t.ToTicks).Last().Id.ToString(),
                        IdRow          = sRow + ((long)t.TimeLine).ToString(),
                        Time           = t
                    });
                }
                items.ForEach(i => UpdateProjects(i.IdRow, i.Projects, idContainerCommunity, currentPage, timeline));
                TimeGroup firstTimeGroup = items.First().Time.TimeLine;
                TimeGroup lastTimeGroup  = items.Last().Time.TimeLine;
                if (pageIndex > 0 && projects.OrderBy(p => p.VirtualEndDate).Skip((pageIndex - 1) * pageSize).Where(p => p.TimeGroup.TimeLine == firstTimeGroup).Any())
                {
                    items.First().PreviousPageIndex = pageIndex - 1;
                }
                if (projects.OrderBy(p => p.VirtualEndDate).Skip((pageIndex + 1) * pageSize).Where(p => p.TimeGroup.TimeLine == lastTimeGroup).Any())
                {
                    items.Last().NextPageIndex = pageIndex + 1;
                }
            }
            return(items);
        }
Пример #14
0
        private List <dtoProjectsGroup> GenerateCommunityTree(List <dtoPlainProject> projects, Int32 idContainerCommunity, PageListType currentPage, SummaryTimeLine timeline, Int32 pageIndex, Int32 pageSize)
        {
            List <dtoProjectsGroup> items = new List <dtoProjectsGroup>();
            String cssClass = View.GetContainerCssClass(ItemsGroupBy.Community);
            Int32  cCount   = View.GetCellsCount(currentPage);
            String sRow     = View.GetStartRowId(ItemsGroupBy.Community);

            projects.OrderBy(p => p.CommunityName).Skip(pageIndex * pageSize).Take(pageSize).GroupBy(p => p.VirtualName).OrderBy(p => p.Key).ToList().ForEach(
                p => items.Add(new dtoProjectsGroup()
            {
                Id             = p.FirstOrDefault().IdCommunity,
                Name           = p.FirstOrDefault().CommunityName,
                Projects       = p.ToList(),
                CssClass       = cssClass,
                CellsCount     = cCount,
                IdRowFirstItem = sRow + p.First().Id.ToString(),
                IdRowLastItem  = sRow + p.Last().Id.ToString(),
                IdRow          = sRow + p.FirstOrDefault().IdCommunity.ToString()
            }));
            items.ForEach(i => UpdateProjects(i.IdRow, i.Projects, idContainerCommunity, currentPage, timeline));
            long idFirstCommunity = items.First().Projects.Select(p => p.IdCommunity).FirstOrDefault();
            long idLastCommunity  = items.Last().Projects.Select(p => p.IdCommunity).FirstOrDefault();

            if (pageIndex > 0 && projects.OrderBy(p => p.VirtualName).Skip((pageIndex - 1) * pageSize).Where(p => p.IdCommunity == idFirstCommunity).Any())
            {
                items.First().PreviousPageIndex = pageIndex - 1;
            }
            if (projects.OrderBy(p => p.VirtualName).Skip((pageIndex + 1) * pageSize).Where(p => p.IdCommunity == idLastCommunity).Any())
            {
                items.Last().NextPageIndex = pageIndex + 1;
            }

            return(items);
        }
        private void LoadSummary(dtoProjectContext context, Int32 idContainerCommunity, PageListType currentPageType, PageListType fromPage, List <dtoTimelineSummary> items, SummaryTimeLine timeline, SummaryDisplay display)
        {
            List <dtoDisplayTimelineSummary> results = new List <dtoDisplayTimelineSummary>();

            if (items != null)
            {
                List <dtoItemFilter <SummaryTimeLine> > timeLines = items.SelectMany(t => t.Activities.Select(a => a.TimeLine)).Distinct().Where(t => t != SummaryTimeLine.Today).Select(t => new dtoItemFilter <SummaryTimeLine>()
                {
                    Value = t, Selected = (t == timeline)
                }).ToList();

                if (timeLines.Count == 1)
                {
                    timeLines[0].DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.first | lm.Comol.Core.DomainModel.ItemDisplayOrder.last;
                }
                else if (timeLines.Count > 1)
                {
                    timeLines[0].DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.first;
                    timeLines.Last().DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.last;
                }
                if (!timeLines.Where(t => t.Selected).Any())
                {
                    timeline = timeLines.FirstOrDefault().Value;
                    timeLines.FirstOrDefault().Selected = true;
                }

                View.LoadTimeLines(timeLines);
                List <dtoItemFilter <SummaryDisplay> > dItems = new List <dtoItemFilter <SummaryDisplay> >();
                if (display == SummaryDisplay.Project)
                {
                    dItems.Add(new dtoItemFilter <SummaryDisplay>()
                    {
                        DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.last, Value = SummaryDisplay.Project, Selected = (display == SummaryDisplay.Project)
                    });
                }
                else
                {
                    if (View.PageContainer == PageContainerType.ProjectsList)
                    {
                        dItems.Add(new dtoItemFilter <SummaryDisplay>()
                        {
                            DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.first | ItemDisplayOrder.last, Value = SummaryDisplay.All, Selected = true
                        });
                    }
                    else
                    {
                        dItems.Add(new dtoItemFilter <SummaryDisplay>()
                        {
                            DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.first, Value = SummaryDisplay.All, Selected = (display == SummaryDisplay.All)
                        });
                        dItems.Add(new dtoItemFilter <SummaryDisplay>()
                        {
                            DisplayAs = lm.Comol.Core.DomainModel.ItemDisplayOrder.last, Value = SummaryDisplay.Filtered, Selected = (display == SummaryDisplay.Filtered)
                        });
                    }
                }
                if (!dItems.Where(t => t.Selected).Any())
                {
                    dItems.FirstOrDefault().Selected = true;
                }
                View.LoadDisplayMode(dItems);


                UserActivityStatus aStatus = View.CurrentActivityStatus;
                if (aStatus != UserActivityStatus.Ignore)
                {
                    SummaryTimeLine aTimeline = View.CurrentActivityTimeLine;
                    if (items.Where(i => i.Activities.Where(a => a.Status == aStatus && a.TimeLine == aTimeline).Any()).Any())
                    {
                        View.CurrentStatus = ItemListStatus.Ignore;
                    }
                    else
                    {
                        View.CurrentActivityStatus = UserActivityStatus.Ignore;
                    }
                }
                dtoItemsFilter filters = View.GetCurrentFilters;
                items.ForEach(i => results.Add(new dtoDisplayTimelineSummary(i,
                                                                             new dtoDisplayTimelineContext(context, idContainerCommunity, View.PageContainer, currentPageType, fromPage, filters, (View.PageContainer != PageContainerType.ProjectsList && currentPageType == i.DashboardPage) ? ItemsGroupBy.None : ItemsGroupBy.Plain))));
            }


            View.LoadSummaries(results);
        }
Пример #16
0
 public Boolean UserHasLateActivities(Person p, dtoProjectContext context, dtoItemsFilter filter, PageListType pageType, SummaryTimeLine timeline, long idProject = 0)
 {
     return(UserHasActivitiesByStatus(UserActivityStatus.Expired, p, context, filter, pageType, timeline, idProject));
 }
 private void LoadFilters(Person user, dtoProjectContext context, dtoItemsFilter filter, PageContainerType containerType, PageListType currentPageType, PageListType fromPage, SummaryTimeLine timeline, long idProject = 0)
 {
     LoadAvailableStatus(user, context, filter, containerType, currentPageType, fromPage, timeline, idProject);
     LoadAvailableGroupBy(context, filter, currentPageType, fromPage);
     if (containerType != PageContainerType.ProjectDashboard)
     {
         LoadAvailableFiltersBy(user, context, filter, currentPageType);
     }
 }
Пример #18
0
        private Boolean UserHasActivitiesByStatus(UserActivityStatus status, Person p, dtoProjectContext context, dtoItemsFilter filter, PageListType pageType, SummaryTimeLine timeline, long idProject = 0)
        {
            switch (pageType)
            {
            case PageListType.ProjectDashboardManager:
                return(ProjectHasActivitiesByStatus(status, idProject, timeline));

            case PageListType.DashboardAdministrator:
                if (idProject > 0)
                {
                    return(ProjectHasActivitiesByStatus(status, idProject, timeline));
                }
                break;

            default:
                Int32 idCommunity = context.IdCommunity;
                if (filter.FilterBy != ProjectFilterBy.CurrentCommunity && filter.FilterBy != ProjectFilterBy.AllPersonalFromCurrentCommunity)
                {
                    idCommunity = -100;
                }
                List <dtoTimelineSummary> items = GetSummary(p.Id, idProject, filter.FilterBy, ItemListStatus.All, idCommunity);
                if (pageType == PageListType.ProjectDashboardResource)
                {
                    return(items != null && items.Where(i => i.DashboardPage == PageListType.DashboardResource && i.Activities.Where(a => a.TimeLine == timeline && a.Status == status).Any()).Any());
                }
                else
                {
                    return(items != null && items.Where(i => i.DashboardPage == pageType && i.Activities.Where(a => a.TimeLine == timeline && a.Status == status).Any()).Any());
                }
            }
            return(false);
        }
        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));
            }
        }
Пример #20
0
 private Boolean ProjectHasActivitiesByStatus(UserActivityStatus status, long idProject, SummaryTimeLine timeline)
 {
     return(ProjectHasActivitiesByStatus((from a in Manager.GetIQ <PmActivity>() where a.Deleted == BaseStatusDeleted.None && a.Project.Id == idProject && !a.IsSummary select a), status, timeline, GetDaysOfYear(DateTime.Now)));
 }
Пример #21
0
 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));
 }
Пример #22
0
        private Boolean ProjectHasActivitiesByStatus(IEnumerable <PmActivity> qActivities, UserActivityStatus status, SummaryTimeLine timeline, Dictionary <SummaryTimeLine, long> days)
        {
            IEnumerable <PmActivity> query;

            switch (status)
            {
            case UserActivityStatus.Starting:
                query = qActivities.Where(a => a.EarlyStartDate.HasValue && a.Completeness == 0 && a.EarlyStartDate.Value.Ticks >= days[SummaryTimeLine.Today] && a.EarlyStartDate.Value.Ticks <= days[timeline]);
                break;

            case UserActivityStatus.ToDo:
                query = qActivities.Where(a => a.EarlyStartDate.HasValue && !a.IsCompleted && a.EarlyStartDate.Value.Ticks >= days[SummaryTimeLine.Today] && a.EarlyStartDate.Value.Ticks <= days[timeline]);
                break;

            case UserActivityStatus.Expired:
                query = qActivities.Where(a => a.EarlyFinishDate.HasValue && !a.IsCompleted && a.EarlyFinishDate.Value.Ticks < days[SummaryTimeLine.Today]);
                break;

            case UserActivityStatus.Expiring:
                query = qActivities.Where(a => a.EarlyFinishDate.HasValue && !a.IsCompleted && a.EarlyFinishDate.Value.Ticks >= days[timeline] && a.EarlyFinishDate.Value.Ticks <= days[timeline]);
                break;

            default:
                return(false);
            }
            return(query.Select(a => a.Id).Any());
        }
Пример #23
0
        public static String Dashboard(dtoDisplayTimelineContext context, long idProject, PageListType toPage, UserActivityStatus actStatus, SummaryTimeLine actTimeline)
        {
            String page = GetDashboardPage(context.ProjectContext, idProject, toPage);

            page += GetPageParameters(context.FromPage, context.IdContainerCommunity) + GetFilterParameters(context) + GetDashboardActivityParametes(actStatus, actTimeline);
            return(page);
        }
 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);
     }
 }
Пример #25
0
 public static String ProjectDashboard(Int32 idCommunity, Boolean isPortal, Boolean isPersonal, Int32 idContainerCommunity, long idProject, PageListType fromPageType, PageListType toPage, SummaryTimeLine timeline, UserActivityStatus actStatus = UserActivityStatus.Expired, SummaryTimeLine actTimeline = SummaryTimeLine.Week)
 {
     return(ProjectDashboard(new dtoProjectContext()
     {
         IdCommunity = idCommunity, isForPortal = isPortal, isPersonal = isPersonal
     }, idContainerCommunity, idProject, fromPageType, toPage, timeline, actStatus, actTimeline));
 }
        private void LoadProjectSummary(dtoProjectContext context, Int32 idContainerCommunity, PageListType currentPageType, PageListType fromPage, Int32 idPerson, long idProject, SummaryTimeLine timeline, SummaryDisplay display)
        {
            dtoProject project = Service.GetdtoProject(idProject);

            if (project != null)
            {
                View.DisplayProjectName(project.Name, Service.GetProjectAttachments(idProject, 0, false, View.UnknownUserTranslation, true));
            }
            LoadSummary(context, idContainerCommunity, currentPageType, fromPage, Service.GetSummary(idPerson, idProject), timeline, display);
        }
Пример #27
0
 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));
 }
 private void LoadSummary(dtoProjectContext context, Int32 idContainerCommunity, PageListType currentPageType, PageListType fromPage, Person person, SummaryTimeLine timeline, SummaryDisplay display, ProjectFilterBy filter = ProjectFilterBy.All, ItemListStatus filterStatus = ItemListStatus.All, Int32 idCommunity = -100)
 {
     if (person.Id != UserContext.CurrentUserID)
     {
         View.DisplayUserName((person == null) ? "" : person.SurnameAndName);
     }
     LoadSummary(context, idContainerCommunity, currentPageType, fromPage, Service.GetSummary(person.Id, filter, filterStatus, idCommunity), timeline, display);
 }
Пример #29
0
 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()));
 }
Пример #30
0
        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));
        }