public void InitView(Int32 preloadIdCommunityType, String searchText, Boolean preloadList) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { ////if (UserContext.CurrentCommunityID > 0) ////{ //// View.GeneratePortalWebContext(); //// UserContext.CurrentCommunityID = 0; //// UserContext.CurrentCommunityOrganizationID = 0; //// UserContext.WorkingCommunityID = 0; ////} liteDashboardSettings settings = Service.DashboardSettingsGet(DashboardType.Portal, 0); litePageSettings pSettings = (settings == null) ? null : settings.Pages.Where(p => p.Type == DashboardViewType.Subscribe).FirstOrDefault(); Int32 itemsForPage = (pSettings == null) ? 25 : pSettings.MaxItems; RangeSettings range = (pSettings == null) ? null : pSettings.Range; View.EnableFullWidth((settings == null) ? false : settings.FullWidth); View.InitializeSubscriptionControl(itemsForPage, range, preloadIdCommunityType, searchText, preloadList); //View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, ModuleDashboard.ActionType.e); } }
public float GetTopMarkerTimeRange() { if (m_Analysis == null) { return(0.0f); } var frameSummary = m_Analysis.GetFrameSummary(); if (frameSummary == null) { return(0.0f); } m_Analysis.GetMarkers(); RangeSettings currentRangeSettings = new RangeSettings(m_Analysis, m_DepthFilter, m_NameFilters, m_NameExcludes); if (currentRangeSettings != m_LastRangeSettings) { Profiler.BeginSample("CalculateTopMarkerTimeRange"); m_TimeRange = CalculateTopMarkerTimeRange(m_Analysis, m_DepthFilter, m_NameFilters, m_NameExcludes); m_LastRangeSettings = currentRangeSettings; Profiler.EndSample(); } return(m_TimeRange); }
public void SetData(ProfileDataView dataView, int depthFilter, List <string> nameFilters, List <string> nameExcludes, TimingOptions.TimingOption timingOption, int threadSelectionCount) { m_RequestedRangeSettings = new RangeSettings(dataView, depthFilter, nameFilters, nameExcludes, timingOption, threadSelectionCount); if (m_CurrentSettings.rangeSettings != m_RequestedRangeSettings) { m_TimeRangeDirty = true; } }
public Settings(RangeSettings rangeSettings, int barCount, float timeRange, bool includeOthers, bool includeUnaccounted) { this.rangeSettings = rangeSettings; this.barCount = barCount; this.timeRange = timeRange; this.includeOthers = includeOthers; this.includeUnaccounted = includeUnaccounted; }
private Int32 CalculatePageSize(Int32 itemsForPage, RangeSettings range, Int32 itemsCount) { Int32 pageSize = itemsForPage; if (range != null && range.IsInRange(itemsCount)) { pageSize = range.DisplayItems; } return(pageSize); }
public void InitView(Int32 itemsForPage, RangeSettings range, Int32 preloadIdCommunityType, String searchText, Boolean preloadList) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { InitializeView(itemsForPage, range, preloadIdCommunityType, searchText, preloadList); } }
public void LoadCommunities(Int32 itemsForPage, RangeSettings range, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsToSubscribeBy orderBy, Boolean ascending, Int32 pageIndex) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { InternalLoadCommunities(itemsForPage, range, filters, orderBy, ascending, true, pageIndex, ModuleDashboard.ActionType.EnrollPageChangePageIndex); } }
bool IsEqual(RangeSettings b) { if (m_Analysis != b.m_Analysis) { return(false); } if (m_DepthFilter != b.m_DepthFilter) { return(false); } if (m_NameFilters.Count != b.m_NameFilters.Count) { return(false); } if (m_NameExcludes.Count != b.m_NameExcludes.Count) { return(false); } // Want to check if contents match, not just if refeernce is the same for (int i = 0; i < m_NameFilters.Count; i++) { if (m_NameFilters[i] != b.m_NameFilters[i]) { return(false); } } for (int i = 0; i < m_NameExcludes.Count; i++) { if (m_NameExcludes[i] != b.m_NameExcludes[i]) { return(false); } } /* * if (!m_NameFilters.Equals(b.m_NameFilters)) * return false; * if (!m_NameExcludes.Equals(b.m_NameExcludes)) * return false; */ return(true); }
public void ApplyFilters(Int32 itemsForPage, RangeSettings range, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsToSubscribeBy orderBy) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { InternalLoadCommunities(itemsForPage, range, filters, orderBy, GetDefaultAscending(orderBy), false, 0, ModuleDashboard.ActionType.EnrollPageApplyFilters, true); View.CurrentFilters = filters; liteTile tile = null; if (filters.IdcommunityType > -1) { tile = Service.GetTileForCommunityType(filters.IdcommunityType); } } }
private void InitializeView(Int32 itemsForPage, RangeSettings range, Int32 preloadIdCommunityType, String searchText, Boolean preloadList) { View.DefaultPageSize = itemsForPage; View.DefaultRange = range; View.IsInitialized = true; View.FirstLoad = true; litePerson person = CurrentManager.GetLitePerson(UserContext.CurrentUserID); if (person != null) { List <lm.Comol.Core.DomainModel.Filters.Filter> fToLoad = Service.GetDefaultFilters(UserContext.CurrentUserID, searchText, preloadIdCommunityType, -1, null, null, CommunityAvailability.NotSubscribed).OrderBy(f => f.DisplayOrder).ToList(); View.LoadDefaultFilters(fToLoad); if (fToLoad != null && fToLoad.Any()) { //lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters = Service.GetDefaultFilters(person, CommunityManagement.CommunityAvailability.NotSubscribed, false, preloadIdCommunityType); lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters = new lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters(fToLoad, CommunityAvailability.NotSubscribed, preloadIdCommunityType); if (preloadIdCommunityType > -1) { filters.IdcommunityType = preloadIdCommunityType; } View.CurrentFilters = filters; if (preloadList) { InternalLoadCommunities(itemsForPage, range, filters, OrderItemsToSubscribeBy.Name, true, false, 0, ModuleDashboard.ActionType.EnrollPageLoadWithCommunities); } else { View.CurrentOrderBy = OrderItemsToSubscribeBy.Name; View.CurrentAscending = true; InitializeColumns(filters, new List <dtoEnrollingItem>()); View.LoadItems(new List <dtoEnrollingItem>(), OrderItemsToSubscribeBy.Name, true); } View.SendUserAction(0, CurrentIdModule, ModuleDashboard.ActionType.EnrollPageLoad); } SetListTitle(preloadIdCommunityType, (fToLoad != null && fToLoad.Any())); } else { View.DisplaySessionTimeout(); } }
public void EnrollTo(List <dtoCommunityInfoForEnroll> sCommunities, Int32 itemsForPage, RangeSettings range, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsToSubscribeBy orderBy, Boolean ascending, Int32 pageIndex) { Int32 idPerson = UserContext.CurrentUserID; if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { Boolean reloadCommunities = false; if (sCommunities.Any()) { reloadCommunities = true; litePerson person = CurrentManager.GetLitePerson(idPerson); String profileType = Service.GetTranslatedProfileType(person); String organizationName = CurrentManager.GetUserDefaultOrganizationName(idPerson); List <dtoEnrollment> enrollments = new List <dtoEnrollment>(); foreach (dtoCommunityInfoForEnroll cm in sCommunities) { dtoEnrollment enrollment = Service.EnrollTo(idPerson, cm); if (enrollment != null) { enrollments.Add(enrollment); } } if (enrollments.Any()) { if (enrollments.Where(e => e.Status == EnrolledStatus.Available || e.Status == EnrolledStatus.NeedConfirm).Any()) { lm.Comol.Core.DomainModel.Helpers.CacheHelper.PurgeCacheItems(lm.Comol.Core.BaseModules.CommunityManagement.Domain.CacheKeys.UserCommunitiesTree(idPerson)); enrollments.Where(e => e.Status == EnrolledStatus.Available || e.Status == EnrolledStatus.NeedConfirm).ToList().ForEach(e => View.NotifyEnrollment(e, person, profileType, organizationName)); reloadCommunities = true; } if (enrollments.Where(e => e.Status == EnrolledStatus.Available).Any()) { View.SendUserAction(0, CurrentIdModule, enrollments.Where(e => e.Status == EnrolledStatus.Available).Select(c => c.IdCommunity).ToList(), ModuleDashboard.ActionType.EnrollToCommunities); } if (enrollments.Where(e => e.Status == EnrolledStatus.NeedConfirm).Any()) { View.SendUserAction(0, CurrentIdModule, enrollments.Where(e => e.Status == EnrolledStatus.NeedConfirm).Select(c => c.IdCommunity).ToList(), ModuleDashboard.ActionType.EnrollToCommunitiesWaitingConfirm); } UpdateSelectedItems(enrollments.Where(e => e.Status == EnrolledStatus.Available || e.Status == EnrolledStatus.NeedConfirm || e.Status == EnrolledStatus.PreviousEnrolled || e.Status == EnrolledStatus.UnableToEnroll).Select(e => e.IdCommunity).ToList()); View.DisplayEnrollMessage(enrollments); } if (reloadCommunities) { InternalLoadCommunities(itemsForPage, range, filters, orderBy, ascending, true, pageIndex, ModuleDashboard.ActionType.EnrollPageLoadcommunitiesAfterEnrolling, true); } } else { View.SendUserAction(0, CurrentIdModule, ModuleDashboard.ActionType.NoSelectedCommunitiesToEnroll); } } }
public void EnrollTo(List <dtoCommunityToEnroll> sCommunities, Boolean applyToAll, Int32 itemsForPage, RangeSettings range, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsToSubscribeBy orderBy, Boolean ascending, Int32 pageIndex) { Int32 idPerson = UserContext.CurrentUserID; if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { ModuleDashboard.ActionType dAction = ModuleDashboard.ActionType.None; Boolean reloadCommunities = false; List <dtoCommunityToEnroll> cCommunities = View.CurrentSelectedItems; if (sCommunities.Where(i => !i.Selected).Any()) { cCommunities = cCommunities.Where(c => !sCommunities.Where(s => s.Id == c.Id).Any() || sCommunities.Where(s => s.Selected && s.Id == c.Id).Any()).ToList(); } if (sCommunities.Where(i => i.Selected).Any()) { List <Int32> idCommunities = cCommunities.Select(c => c.Id).ToList(); cCommunities.AddRange(sCommunities.Where(s => s.Selected && !idCommunities.Contains(s.Id)).ToList()); } List <dtoCommunityInfoForEnroll> items = Service.GetEnrollingItems(idPerson, cCommunities); if (items != null && items.Where(i => i.Id > 0).Any()) { if (!items.Where(i => i.AllowEnroll).Any()) { dAction = ModuleDashboard.ActionType.EnrollNotAllowed; if (items.Count == 1) { View.DisplayEnrollMessage(items.FirstOrDefault(), dAction); } else { View.DisplayEnrollMessage(items.Count, dAction); } } else { reloadCommunities = true; litePerson person = CurrentManager.GetLitePerson(idPerson); String profileType = Service.GetTranslatedProfileType(person); String organizationName = CurrentManager.GetUserDefaultOrganizationName(idPerson); List <dtoEnrollment> enrollments = new List <dtoEnrollment>(); foreach (dtoCommunityInfoForEnroll cm in items.Where(i => i.AllowEnroll && !i.HasConstraints)) { dtoEnrollment enrollment = Service.EnrollTo(idPerson, cm); if (enrollment != null) { enrollments.Add(enrollment); } } if (enrollments.Where(e => e.Status == EnrolledStatus.Available || e.Status == EnrolledStatus.NeedConfirm).Any()) { lm.Comol.Core.DomainModel.Helpers.CacheHelper.PurgeCacheItems(lm.Comol.Core.BaseModules.CommunityManagement.Domain.CacheKeys.UserCommunitiesTree(idPerson)); enrollments.Where(e => e.Status == EnrolledStatus.Available || e.Status == EnrolledStatus.NeedConfirm).ToList().ForEach(e => View.NotifyEnrollment(e, person, profileType, organizationName)); } if ((enrollments.Any() && enrollments.Where(s => s.Status == EnrolledStatus.NotAvailable || s.Status == EnrolledStatus.UnableToEnroll).Any()) || items.Where(i => i.HasConstraints || !i.AllowUnsubscribe).Any()) { UpdateSelectedItems(enrollments.Where(e => e.Status == EnrolledStatus.Available || e.Status == EnrolledStatus.NeedConfirm || e.Status == EnrolledStatus.PreviousEnrolled || e.Status == EnrolledStatus.UnableToEnroll).Select(e => e.IdCommunity).ToList()); View.DisplayConfirmMessage(enrollments.Where(e => e.Status != EnrolledStatus.NotAvailable && e.Status != EnrolledStatus.UnableToEnroll).ToList(), enrollments.Where(e => e.Status == EnrolledStatus.NotAvailable || e.Status == EnrolledStatus.UnableToEnroll).ToList(), items.Where(i => !enrollments.Where(e => e.IdCommunity == i.Id).Any()).ToList(), person, profileType, organizationName); View.SendUserAction(0, CurrentIdModule, items.Where(i => !enrollments.Where(e => e.IdCommunity == i.Id).Any()).Select(c => c.Id).ToList(), ModuleDashboard.ActionType.RequireEnrollConfirm); } else { if (enrollments.Where(e => e.Status == EnrolledStatus.Available).Any()) { View.SendUserAction(0, CurrentIdModule, enrollments.Where(e => e.Status == EnrolledStatus.Available).Select(c => c.IdCommunity).ToList(), ModuleDashboard.ActionType.EnrollToCommunities); } if (enrollments.Where(e => e.Status == EnrolledStatus.NeedConfirm).Any()) { View.SendUserAction(0, CurrentIdModule, enrollments.Where(e => e.Status == EnrolledStatus.NeedConfirm).Select(c => c.IdCommunity).ToList(), ModuleDashboard.ActionType.EnrollToCommunitiesWaitingConfirm); } UpdateSelectedItems(enrollments.Where(e => e.Status == EnrolledStatus.Available || e.Status == EnrolledStatus.NeedConfirm || e.Status == EnrolledStatus.PreviousEnrolled || e.Status == EnrolledStatus.UnableToEnroll).Select(e => e.IdCommunity).ToList()); if (enrollments.Any() && enrollments.Count == items.Count) { View.DisplayEnrollMessage(enrollments); } else { View.DisplayEnrollMessage(enrollments, items.Where(i => !enrollments.Where(e => e.IdCommunity == i.Id).Any()).Select(c => c.Name).ToList()); } } } } else { View.SendUserAction(0, CurrentIdModule, sCommunities.Select(c => c.Id).ToList(), ModuleDashboard.ActionType.UnableToEnroll); } if (reloadCommunities) { InternalLoadCommunities(itemsForPage, range, filters, orderBy, ascending, true, pageIndex, ModuleDashboard.ActionType.EnrollPageLoadcommunitiesAfterEnrolling); } } }
public void EnrollTo(Int32 idCommunity, String name, String path, Int32 itemsForPage, RangeSettings range, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsToSubscribeBy orderBy, Boolean ascending, Int32 pageIndex) { Int32 idPerson = UserContext.CurrentUserID; if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { Boolean reloadCommunities = false; ModuleDashboard.ActionType dAction = ModuleDashboard.ActionType.None; dtoCommunityInfoForEnroll item = Service.GetEnrollingItem(idPerson, idCommunity, path); litePerson person = CurrentManager.GetLitePerson(idPerson); if (item != null && item.Id > 0 && person != null && person.Id > 0) { if (!item.AllowEnroll) { dAction = ModuleDashboard.ActionType.EnrollNotAllowed; View.DisplayEnrollMessage(item, dAction); } else { if (!item.HasConstraints && item.AllowUnsubscribe) { dtoEnrollment enrollment = Service.EnrollTo(idPerson, item); if (enrollment == null) { dAction = ModuleDashboard.ActionType.UnableToEnroll; View.DisplayEnrollMessage(item, dAction); } else { View.DisplayEnrollMessage(enrollment, enrollment.IdCommunity, person, Service.GetTranslatedProfileType(person), CurrentManager.GetUserDefaultOrganizationName(idPerson)); UpdateSelectedItems(new List <Int32>() { enrollment.IdCommunity }); reloadCommunities = true; dAction = (enrollment.Status == EnrolledStatus.NeedConfirm) ? ModuleDashboard.ActionType.EnrollToCommunityWaitingConfirm : ModuleDashboard.ActionType.EnrollToCommunity; lm.Comol.Core.DomainModel.Helpers.CacheHelper.PurgeCacheItems(lm.Comol.Core.BaseModules.CommunityManagement.Domain.CacheKeys.UserCommunitiesTree(idPerson)); } } else { dAction = ModuleDashboard.ActionType.RequireEnrollConfirm; View.DisplayConfirmMessage(item); } } } else { dAction = ModuleDashboard.ActionType.UnableToEnroll; View.DisplayUnknownCommunity(name); } View.SendUserAction(0, CurrentIdModule, idCommunity, dAction); if (reloadCommunities) { InternalLoadCommunities(itemsForPage, range, filters, orderBy, ascending, true, pageIndex, ModuleDashboard.ActionType.EnrollPageLoadcommunitiesAfterEnrolling); } } }
private void InternalLoadCommunities(Int32 itemsForPage, RangeSettings range, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsToSubscribeBy orderBy, Boolean ascending, Boolean useCache, Int32 pageIndex, ModuleDashboard.ActionType action = ModuleDashboard.ActionType.EnrollPageApplyFilters, Boolean applyFilters = false) { View.CurrentFilters = filters; List <dtoItemFilter <OrderItemsToSubscribeBy> > orderItems = GetOrderByItems(filters.IdcommunityType, orderBy); View.InitializeOrderBySelector(orderItems); List <dtoEnrollingItem> items = Service.GetCommunitiesToEnroll(UserContext.CurrentUserID, filters, useCache); Int32 itemsCount = (items == null) ? 0 : items.Count; Int32 pageSize = CalculatePageSize(itemsForPage, range, itemsCount); View.CurrentPageSize = pageSize; InitializeColumns(filters, items); if (items == null) { View.DisplayErrorFromDB(); View.CurrentOrderBy = orderBy; View.CurrentAscending = ascending; } else { if (pageSize == 0) { pageSize = View.DefaultPageSize; } PagerBase pager = new PagerBase(); pager.PageSize = pageSize; pager.Count = (itemsCount > 0) ? itemsCount - 1 : 0; pager.PageIndex = pageIndex; View.Pager = pager; List <dtoCommunityToEnroll> cItems = null; if (applyFilters) { cItems = new List <dtoCommunityToEnroll>(); } else { cItems = View.CurrentSelectedItems; List <dtoCommunityToEnroll> sItems = View.GetSelectedItems(); if (sItems.Where(i => !i.Selected).Any()) { cItems = cItems.Where(c => !sItems.Where(s => s.Id == c.Id).Any() || sItems.Where(s => s.Selected && s.Id == c.Id).Any()).ToList(); } if (sItems.Where(i => i.Selected).Any()) { List <Int32> idCommunities = cItems.Select(c => c.Id).ToList(); cItems.AddRange(sItems.Where(s => s.Selected && !idCommunities.Contains(s.Id)).ToList()); } } View.CurrentSelectedItems = cItems; View.KeepOpenBulkActions = (cItems.Count > 0); View.InitializeBulkActions(itemsCount > pageSize, cItems); items = Service.GetCommunities(UserContext.CurrentUserID, items, pageIndex, pageSize, orderBy, ascending); if (items != null) { 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 (dtoEnrollingItem 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 <dtoEnrollingItem>(), orderBy, ascending); } } }
bool IsEqual(RangeSettings b) { if (timingOption != b.timingOption) { return(false); } if (b.dataView == null && dataView != null) { return(false); } // Check contents of data view (the reference will definitly not match as we made a copy) if (b.dataView != null) { // Only need to check data, analysis and selectedIndices if (dataView.data != b.dataView.data) { return(false); } if (dataView.analysis != b.dataView.analysis) { return(false); } if (dataView.selectedIndices != b.dataView.selectedIndices) { return(false); } if (dataView.selectedIndices.Count != b.dataView.selectedIndices.Count) { return(false); } // Want to check if contents match, not just if reference is the same for (int i = 0; i < dataView.selectedIndices.Count; i++) { if (dataView.selectedIndices[i] != b.dataView.selectedIndices[i]) { return(false); } } } if (depthFilter != b.depthFilter) { return(false); } if (threadSelectionCount != b.threadSelectionCount) { return(false); } if (nameFilters.Count != b.nameFilters.Count) { return(false); } if (nameExcludes.Count != b.nameExcludes.Count) { return(false); } // Want to check if contents match, not just if reference is the same for (int i = 0; i < nameFilters.Count; i++) { if (nameFilters[i] != b.nameFilters[i]) { return(false); } } for (int i = 0; i < nameExcludes.Count; i++) { if (nameExcludes[i] != b.nameExcludes[i]) { return(false); } } return(true); }
float CalculateTopMarkerTimeRange(RangeSettings rangeSettings) { if (rangeSettings == null) { return(0.0f); } if (rangeSettings.dataView == null) { return(0.0f); } ProfileAnalysis analysis = rangeSettings.dataView.analysis; if (analysis == null) { return(0.0f); } var frameSummary = analysis.GetFrameSummary(); if (frameSummary == null) { return(0.0f); } int depthFilter = rangeSettings.depthFilter; List <string> nameFilters = rangeSettings.nameFilters; List <string> nameExcludes = rangeSettings.nameExcludes; var markers = analysis.GetMarkers(); float range = 0; foreach (var marker in markers) { if (depthFilter != ProfileAnalyzer.kDepthAll && marker.minDepth != depthFilter) { continue; } if (nameFilters.Count > 0) { if (!m_ProfileAnalyzerWindow.NameInFilterList(marker.name, nameFilters)) { continue; } } if (nameExcludes.Count > 0) { if (m_ProfileAnalyzerWindow.NameInExcludeList(marker.name, nameExcludes)) { continue; } } range += marker.msAtMedian; } // Minimum is the frame time range // As we can have unaccounted markers if (range < frameSummary.msMedian) { range = frameSummary.msMedian; } return(range); }