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; } } }
public void ChangeCommunityProfileType(Int32 idProfileType, int currentPageIndex, int currentPageSize) { //View.LoadAvailableStatus(Service.GetAvailableStatus(idOrganization, idProfileType), View.SelectedProfileStatus); List <Int32> idCommunities = View.FromCommunities; if (idCommunities.Count == 1) { ModuleCommunityManagement cModule = ServiceCommunity.GetModulePermission(UserContext.CurrentUserID, idCommunities[0]); View.LoadSearchProfilesBy(GetSearchByItems(cModule), View.SelectedSearchBy, UserSelectionType.CommunityUsers); idProfileType = View.SelectedIdProfileType; if (idProfileType == (int)UserTypeStandard.Employee) { View.LoadAgencies(Service.GetAvailableAgencies(idCommunities[0], View.SelectedIdRole, View.SelectedSubscriptionStatus), View.SelectedIdAgency, UserSelectionType.CommunityUsers); } } LoadSubscriptions(currentPageIndex, currentPageSize, true); }
public void InitView(UserSelectionType loadMode, Boolean fromAllMyCommunity, List <Int32> idCommunities, List <Int32> unloadIdUsers, List <Int32> selectedIdUsers) { if (UserContext.isAnonymous) { View.DisplaySessionTimeout(); } else { if (unloadIdUsers == null) { unloadIdUsers = new List <Int32>(); } if (selectedIdUsers == null) { selectedIdUsers = new List <Int32>(); } View.isInitialized = true; View.FromAllMyCommunity = fromAllMyCommunity; View.FromCommunities = (fromAllMyCommunity) ? new List <Int32>() : idCommunities; View.UnavailableIdUsers = unloadIdUsers; View.SelectAllUsers = false; View.SelectedIdUsers = (selectedIdUsers == null) ? new List <int>() : selectedIdUsers.Where(s => !unloadIdUsers.Contains(s)).ToList(); View.IsFirstLoad = true; View.IsFirstPreviewLoad = true; switch (loadMode) { case UserSelectionType.SystemUsers: ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID); InitializeProfileFilters(module); break; case UserSelectionType.CommunityUsers: if (idCommunities.Any()) { if (idCommunities.Count == 1) { ModuleCommunityManagement cModule = ServiceCommunity.GetModulePermission(UserContext.CurrentUserID, idCommunities[0]); InitializeCommunityFilters(cModule, idCommunities[0], unloadIdUsers); } } break; } } }
private List <SearchProfilesBy> GetSearchByItems(ModuleCommunityManagement module) { ModuleProfileManagement portalModule = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID); List <SearchProfilesBy> list = new List <SearchProfilesBy>(); list.Add(SearchProfilesBy.All); list.Add(SearchProfilesBy.Contains); list.Add(SearchProfilesBy.Name); list.Add(SearchProfilesBy.Surname); if (module.Administration || module.Manage || portalModule.Administration || portalModule.ViewProfiles) { list.Add(SearchProfilesBy.Mail); } if (View.AllowSearchByTaxCode && (module.Administration || module.Manage) && (portalModule.Administration || portalModule.ViewProfiles)) { list.Add(SearchProfilesBy.TaxCode); } return(list); }
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(); }