Example #1
0
        private void InitializeProfileFilters(ModuleProfileManagement module)
        {
            View.OrderAscending  = true;
            View.OrderProfilesBy = OrderProfilesBy.SurnameAndName;
            Int32            idDefaultProfileType  = 0;
            long             idDefaultAgency       = 0;
            long             idDefaultProvider     = 0;
            Int32            idDefaultOrganization = 0;
            StatusProfile    defaultStatus         = StatusProfile.Active;
            SearchProfilesBy defaultSearch         = SearchProfilesBy.Contains;

            List <Organization> organizations = Service.GetAvailableOrganizations(UserContext.CurrentUserID, (module.ViewProfiles || module.Administration) ? SearchCommunityFor.SystemManagement : SearchCommunityFor.CommunityManagement);

            if (organizations.Any() || module.Administration || module.ViewProfiles)
            {
                View.LoadAvailableOrganizations(organizations, idDefaultOrganization);
                View.LoadProfileTypes(Service.GetAvailableProfileTypes(View.SelectedIdOrganization), idDefaultProfileType);

                List <dtoBaseProvider> providers = Service.GetAuthenticationProviders(UserContext.Language.Id, true).Where(p => p.isEnabled).ToList();

                View.LoadAuthenticationProviders(providers, idDefaultProvider);

                View.LoadAvailableStatus(Service.GetAvailableStatus(View.SelectedIdOrganization, View.SelectedIdProfileType), defaultStatus);
                View.LoadSearchProfilesBy(GetSearchByItems(module), defaultSearch, UserSelectionType.SystemUsers);
                if (idDefaultProfileType == (int)UserTypeStandard.Employee)
                {
                    View.LoadAgencies(Service.GetAvailableAgencies(View.SelectedIdOrganization), idDefaultAgency, UserSelectionType.SystemUsers);
                }

                dtoFilters filter = View.GetCurrentProfileFilters;
                View.SearchProfileFilters = filter;
                View.InitializeWordSelector(Service.GetAvailableStartLetter(filter, View.UnavailableIdUsers));
                SetDefaultColumns(filter.IdProfileType, module.Administration || module.ViewProfiles, filter.Status);
                View.LoadProfiles(new List <dtoProfileItem <dtoBaseProfile> >());
            }
            else
            {
                View.NoPermission();
            }
        }
Example #2
0
        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();
        }
        private void InitializeFilters()
        {
            View.OrderAscending = true;
            View.OrderBy        = OrderProfilesBy.SurnameAndName;
            Boolean    loadFilters = View.PreloadedReloadFilters;
            dtoFilters filters     = null;

            if (loadFilters)
            {
                filters = View.GetSavedFilters;
            }

            Int32            idDefaultProfileType  = 0;
            long             idDefaultProvider     = 0;
            long             idDefaultAgency       = 0;
            Int32            idDefaultOrganization = 0;
            StatusProfile    defaultStatus         = StatusProfile.Active;
            SearchProfilesBy defaultSearch         = SearchProfilesBy.Contains;

            View.CurrentModuleView = View.PreLoadedView;
            View.CurrentModuleCode = View.PreLoadedModuleCode;
            int pageIndex = 0;

            if (loadFilters && filters != null)
            {
                idDefaultOrganization = filters.IdOrganization;
                idDefaultProfileType  = filters.IdProfileType;
                idDefaultProvider     = filters.idProvider;

                if (idDefaultProfileType == (int)UserTypeStandard.Employee)
                {
                    idDefaultAgency = filters.IdAgency;
                }
                defaultStatus = filters.Status;
                defaultSearch = filters.SearchBy;
                if (!String.IsNullOrEmpty(filters.StartWith) && !Service.DefaultChars().Contains(filters.StartWith))
                {
                    filters.StartWith = "#";
                }
                View.CurrentStartWith = filters.StartWith;
                View.CurrentValue     = filters.Value;
                View.OrderAscending   = filters.Ascending;
                View.OrderBy          = filters.OrderBy;
                pageIndex             = filters.PageIndex;
                View.CurrentPageSize  = filters.PageSize;
            }
            else
            {
                View.CurrentPageSize = View.PreLoadedPageSize;
            }

            List <Organization> organizations = Service.GetAvailableOrganizations(UserContext.CurrentUserID, (View.CurrentModuleIdCommunity < 1) ? SearchCommunityFor.SystemManagement : SearchCommunityFor.CommunityManagement);

            if (organizations != null && organizations.Any())
            {
                View.LoadAvailableOrganizations(organizations, idDefaultOrganization);
                View.LoadProfileTypes(Service.GetAvailableProfileTypes(View.SelectedIdOrganization), idDefaultProfileType);

                List <dtoBaseProvider> providers = Service.GetAuthenticationProviders(UserContext.Language.Id, true).Where(p => p.isEnabled).ToList();
                View.LoadAvailableStatus(Service.GetAvailableStatus(View.SelectedIdOrganization, View.SelectedIdProfileType), defaultStatus);
                View.LoadSearchProfilesBy(GetSearchByItems(), defaultSearch);
                if (idDefaultProfileType == (int)UserTypeStandard.Employee)
                {
                    View.LoadAgencies(Service.GetAvailableAgencies(View.SelectedIdOrganization), idDefaultAgency);
                }

                View.SearchFilters = View.GetCurrentFilters;
                if (loadFilters && filters != null)
                {
                    LoadProfiles(filters.PageIndex, filters.PageSize);
                }
                else if (filters == null)
                {
                    View.InitializeWordSelector(Service.GetAvailableStartLetter(View.GetCurrentFilters));
                }
            }
            else
            {
                View.NoPermissionToAdmin();
            }
        }