public void LoadSubscriptions(int currentPageIndex, int currentPageSize, Boolean updateSelection) { List <Int32> idRemoveUsers = View.UnavailableIdUsers; dtoUserFilters filters = View.SearchUserFilters; PagerBase pager = new PagerBase(); //if (filters.StartWith != View.CurrentStartWith) // filters.StartWith = View.CurrentStartWith; pager.PageSize = currentPageSize; //Me.View.CurrentPageSize pager.Count = (int)Service.CommunitySubscriptionsCount(filters, idRemoveUsers) - 1; pager.PageIndex = currentPageIndex; // Me.View.CurrentPageIndex View.Pager = pager; View.IsFirstLoad = false; View.InitializeWordSelector(Service.GetAvailableSubsriptionStartLetter(filters, idRemoveUsers), filters.StartWith); filters.StartWith = View.CurrentStartWith; if (updateSelection) { View.SelectedIdUsers = UpdateItemsSelection(); } List <Int32> idCommunities = View.FromCommunities; if (idCommunities.Count == 1) { ModuleCommunityManagement cModule = ServiceCommunity.GetModulePermission(UserContext.CurrentUserID, idCommunities[0]); ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID); List <ProfileColumn> columns = SetDefaultColumns(filters.IdRole, filters.IdProfileType, cModule.Administration || cModule.Manage, module, filters.Status); if (View.SelectedIdProfileType != (int)UserTypeStandard.Employee && View.ShowSubscriptionsFilterByProfile) { View.UnLoadAgencies(); } switch (filters.IdProfileType) { case (int)UserTypeStandard.Company: List <dtoSubscriptionProfileItem <dtoCompany> > companyUsers = Service.GetCompanyUserProfiles(filters, pager.PageIndex, currentPageSize, View.GetTranslatedProfileTypes, View.GetTranslatedRoles, idRemoveUsers); View.LoadSubscriptions(companyUsers); break; case (int)UserTypeStandard.Employee: List <dtoSubscriptionProfileItem <dtoEmployee> > employeeUsers = Service.GetEmployeeProfiles(filters, pager.PageIndex, currentPageSize, View.GetTranslatedProfileTypes, View.GetTranslatedRoles, idRemoveUsers); View.LoadSubscriptions(employeeUsers); break; default: List <dtoSubscriptionProfileItem <dtoBaseProfile> > items = Service.GetProfiles(filters, pager.PageIndex, currentPageSize, View.GetTranslatedProfileTypes, View.GetTranslatedRoles, idRemoveUsers); View.LoadSubscriptions(items); break; } } }
private Boolean HasEmployeeUsers(UserSelectionType mode) { switch (mode) { case UserSelectionType.CommunityUsers: dtoUserFilters filter = (dtoUserFilters)View.GetCurrentUserFilters.Clone(); filter.IdProfileType = (int)UserTypeStandard.Employee; filter.IdRole = -1; filter.IdAgency = -1; return((int)Service.CommunitySubscriptionsCount(filter, View.UnavailableIdUsers) > 0); case UserSelectionType.SystemUsers: dtoFilters pFilter = (dtoFilters)View.GetCurrentProfileFilters.Clone(); pFilter.IdProfileType = (int)UserTypeStandard.Employee; pFilter.IdAgency = -1; return(Service.ProfilesCount(pFilter, View.UnavailableIdUsers) > 0); default: return(false); } }
private void InitializeCommunityFilters(ModuleCommunityManagement module, Int32 idCommunity, List <Int32> unavailableIdUsers) { View.OrderAscending = true; View.OrderUsersBy = OrderUsersBy.SurnameAndName; Int32 idDefaultProfileType = 0; Int32 idDefaultRole = 0; long idDefaultAgency = 0; SubscriptionStatus defaultStatus = SubscriptionStatus.activemember; SearchProfilesBy defaultSearch = SearchProfilesBy.Contains; //if (module.Administration || module.Manage) //{ View.LoadRolesTypes(Service.GetAvailableSubscriptionsIdRoles(idCommunity, unavailableIdUsers), idDefaultRole); View.LoadAvailableSubscriptionsStatus(Service.GetAvailableSubscriptionsStatus(idCommunity, unavailableIdUsers), defaultStatus); if (View.ShowSubscriptionsFilterByProfile) { View.LoadProfileTypes(Service.GetAvailableProfileTypes(idCommunity, View.SelectedIdRole, View.SelectedSubscriptionStatus), idDefaultProfileType); if (View.SelectedIdProfileType == (int)UserTypeStandard.Employee) { View.LoadAgencies(Service.GetAvailableAgencies(idCommunity, View.SelectedIdRole, View.SelectedSubscriptionStatus), idDefaultAgency, UserSelectionType.CommunityUsers); } } else if (HasEmployeeUsers(UserSelectionType.CommunityUsers) && (module.Administration || module.Manage)) { View.LoadAgencies(Service.GetAvailableAgencies(idCommunity, View.SelectedIdRole, View.SelectedSubscriptionStatus), idDefaultAgency, UserSelectionType.CommunityUsers); } View.LoadSearchProfilesBy(GetSearchByItems(module), defaultSearch, UserSelectionType.CommunityUsers); dtoUserFilters filter = View.GetCurrentUserFilters; View.SearchUserFilters = filter; View.InitializeWordSelector(Service.GetAvailableSubsriptionStartLetter(filter, View.UnavailableIdUsers)); ModuleProfileManagement pMmodule = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID); SetDefaultColumns(filter.IdRole, filter.IdProfileType, module.Administration || module.Manage, pMmodule, filter.Status); View.LoadSubscriptions(new List <dtoSubscriptionProfileItem <dtoBaseProfile> >()); //} //else // View.NoPermission(); }