public void InitView(long idAgency)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         dtoAgency agency = Service.GetDtoAgency(idAgency);
         if (agency == null)
         {
             View.DisplayAgencyUnknown();
         }
         else
         {
             ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
             if (module.ViewProfileDetails || module.Administration)
             {
                 View.LoadAgencyInfo(agency);
             }
             else
             {
                 View.DisplayNoPermission();
             }
         }
     }
 }
        public void InitView()
        {
            Int32 idUser = View.PreloadedIdProfile;

            if (UserContext.isAnonymous)
            {
                View.NoPermission();
            }
            else
            {
                ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
                if (module.DeleteProfile || module.Administration)
                {
                    Person person = CurrentManager.GetPerson(idUser);
                    if (person == null)
                    {
                        View.DisplayProfileUnknown();
                    }
                    else
                    {
                        View.IdProfile = idUser;
                        dtoProfilePermission permission = new dtoProfilePermission(UserContext.UserTypeID, person.TypeID);
                        View.DisplayProfileInfo(person.SurnameAndName);
                        View.AllowDelete = permission.Delete;
                    }
                }
                else
                {
                    View.NoPermission();
                }
            }
        }
Beispiel #3
0
        public void InitView()
        {
            ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
            Boolean hasPermission          = (module.Administration || module.AddProfile);
            Int32   IdProfileType          = View.PreloadedIdProfileType;

            View.AllowBackTomanagement = hasPermission;
            if (hasPermission && AllowProfileCreation(IdProfileType))
            {
                View.AvailableSteps = Service.GetStandardProfileWizardStep(WizardType.Administration);
                View.InitializeStep(ProfileWizardStep.OrganizationSelector);
                if (IdProfileType == 0)
                {
                    View.GotoStep(ProfileWizardStep.ProfileTypeSelector, true);
                }
                else
                {
                    View.InitializeProfileTypeSelector(IdProfileType);
                    UpdateStepsToSkip(ProfileWizardStep.ProfileTypeSelector, true);
                    MoveToNextStep(ProfileWizardStep.ProfileTypeSelector);
                }
            }
            else
            {
                View.DisplayNoPermission();
            }
        }
        public void InitView()
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Int32 idCommunity = View.PreLoadedIdCommunity;
                if (idCommunity == -1)
                {
                    idCommunity = UserContext.CurrentCommunityID;
                }

                View.CurrentModuleIdCommunity = idCommunity;
                ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
                if (module.ViewProfiles || module.Administration)
                {
                    InitializeFilters();
                }
                else
                {
                    View.NoPermission();
                }
            }
        }
Beispiel #5
0
        public void InitView()
        {
            long idAgency = View.PreloadedIdAgency;

            if (UserContext.isAnonymous)
            {
                View.NoPermission();
            }
            else
            {
                ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
                if (module.DeleteProfile || module.Administration)
                {
                    if (Service.ExistAgency(idAgency))
                    {
                        View.IdAgency = idAgency;
                        dtoAgency agency = Service.GetDtoAgency(idAgency);
                        View.DisplayAgencyInfo(agency);
                        View.AllowDelete = (agency.EmployeeNumber == 0);
                    }
                    else
                    {
                        View.DisplayAgencyUnknown();
                    }
                }
                else
                {
                    View.NoPermission();
                }
            }
        }
Beispiel #6
0
 public void ChangeOrganization(Int32 idOrganization, Int32 idProfileType, int currentPageIndex, int currentPageSize)
 {
     View.LoadProfileTypes(Service.GetAvailableProfileTypes(idOrganization), idProfileType);
     idProfileType = View.SelectedIdProfileType;
     View.LoadAvailableStatus(Service.GetAvailableStatus(idOrganization, idProfileType), View.SelectedProfileStatus);
     View.LoadSearchProfilesBy(GetSearchByItems(ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID)), View.SelectedSearchBy, UserSelectionType.SystemUsers);
     LoadProfiles(currentPageIndex, currentPageSize, true);
 }
Beispiel #7
0
        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 InitView(Int32 idProfile, Boolean forAdd)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplayWorkinkSessionTimeout();
            }
            else
            {
                ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
                if (module.AddAuthenticationProviderToProfile || module.Administration)
                {
                    Person person = CurrentManager.GetPerson(idProfile);
                    if (person == null)
                    {
                        View.DisplayProfileUnknown();
                    }
                    else
                    {
                        View.SetTitle(person.SurnameAndName);
                        View.idDefaultProvider  = person.IdDefaultProvider;
                        View.idProfile          = person.Id;
                        View.CurrentIdLoginInfo = 0;
                        dtoProfilePermission permission = GetProfilePermission(person.TypeID);
                        //View.AllowAddprovider = permission.ManageAuthentication && (module.RenewPassword || module.Administration);
                        View.AllowEdit          = permission.ManageAuthentication;
                        View.AllowRenewPassword = permission.RenewPassword && (module.RenewPassword || module.Administration);
                        View.AllowSetPassword   = permission.SetPassword && (module.RenewPassword || module.Administration);

                        List <dtoUserProvider> userProviders = Service.GetProfileProviders(idProfile, true);
                        List <dtoBaseProvider> providers     = Service.GetAvailableAuthenticationProviders(UserContext.Language.Id, idProfile);
                        Boolean AllowAddprovider             = (providers.Count > 0 && ((module.AddAuthenticationProviderToProfile || module.Administration)) && permission.ManageAuthentication);
                        View.AllowAddprovider        = AllowAddprovider;
                        View.AvailableProvidersCount = providers.Count;
                        if (forAdd && AllowAddprovider)
                        {
                            View.AddUserProviders(providers);
                        }
                        else
                        {
                            View.LoadItems(userProviders);
                        }
                    }
                }
                else
                {
                    View.DisplayNoPermission();
                }
            }
        }
        public void InitView(Int32 idProfile)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Person person = CurrentManager.GetPerson(idProfile);
                if (person == null)
                {
                    View.DisplayProfileUnknown();
                }
                else
                {
                    ModuleProfileManagement module     = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
                    dtoProfilePermission    permission = new dtoProfilePermission(UserContext.UserTypeID, person.TypeID);


                    if (module.ViewProfileDetails || module.Administration)
                    {
                        List <ProfileInfoTab> tabs = null;
                        if (permission.Info || permission.AdvancedInfo)
                        {
                            View.idDefaultProvider = person.IdDefaultProvider;
                            View.IdProfile         = person.Id;
                            View.IdProfileType     = person.TypeID;
                            View.LoadProfileInfo(idProfile, person.SurnameAndName, person.FotoPath, person.TypeID);

                            tabs = GetAvailableTabs(permission);
                        }

                        if (tabs == null || tabs.Count == 0)
                        {
                            View.DisplayNoPermissionForProfile();
                        }
                        else
                        {
                            View.LoadTabs(tabs);
                            View.DisplayBaseInfo(person.Id, permission.AdvancedInfo);
                        }
                    }
                    else
                    {
                        View.DisplayNoPermission();
                    }
                }
            }
        }
        private void SetupOtherProviders()
        {
            Int32 idProfile = View.idProfile;
            dtoProfilePermission permission = new dtoProfilePermission();
            Person person = CurrentManager.GetPerson(idProfile);

            if (person != null)
            {
                permission = GetProfilePermission(person.TypeID);
            }
            ModuleProfileManagement module        = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
            List <dtoUserProvider>  userProviders = Service.GetProfileProviders(idProfile, true);
            List <dtoBaseProvider>  providers     = Service.GetAvailableAuthenticationProviders(UserContext.Language.Id, idProfile);
            Boolean AllowAddprovider = (providers.Count > 0 && ((module.AddAuthenticationProviderToProfile || module.Administration)) && permission.ManageAuthentication);

            View.AllowAddprovider        = AllowAddprovider;
            View.AvailableProvidersCount = providers.Count;
        }
Beispiel #11
0
        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;
                }
            }
        }
Beispiel #12
0
        private List <SearchProfilesBy> GetSearchByItems(ModuleProfileManagement module)
        {
            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.ViewProfiles)
            {
                list.Add(SearchProfilesBy.Mail);
            }
            if (View.AllowSearchByTaxCode && (module.Administration || module.ViewProfiles))
            {
                list.Add(SearchProfilesBy.TaxCode);
            }

            return(list);
        }
 public void InitView()
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
         if (module.ViewProfiles || module.Administration)
         {
             InitializeFilters();
         }
         else
         {
             View.NoPermission();
         }
     }
 }
        public void InitView()
        {
            Int32 IdProfile = View.PreloadedIdProfile;

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
                View.AllowManagement = (module.ViewProfiles || module.Administration);

                if (module.AddAuthenticationProviderToProfile || module.Administration)
                {
                    Person person = CurrentManager.GetPerson(IdProfile);
                    View.IdProfile = (person == null) ? 0 : IdProfile;
                    if (person == null)
                    {
                        View.DisplayProfileUnknown();
                    }
                    else
                    {
                        View.SetTitle(person.SurnameAndName);
                        View.IdProfileType = person.TypeID;

                        dtoProfilePermission permission = new dtoProfilePermission(UserContext.UserTypeID, person.TypeID);

                        List <dtoBaseProvider> providers = Service.GetAvailableAuthenticationProviders(UserContext.Language.Id, IdProfile);
                        Boolean AllowAddprovider         = (providers.Count > 0 && ((module.AddAuthenticationProviderToProfile || module.Administration)) && permission.ManageAuthentication);
                        View.AllowEditProfile = (permission.Edit);
                        View.AllowAddprovider = AllowAddprovider;
                        View.InitializeControl(IdProfile);
                    }
                }
                else
                {
                    View.DisplayNoPermission();
                }
            }
        }
 public void InitView(Int32 idProfile)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
         View.AllowManagement = (module.EditProfile || module.Administration || module.ViewProfiles);
         if (module.EditProfile || module.Administration)
         {
             Person person = CurrentManager.GetPerson(idProfile);
             if (person == null)
             {
                 View.DisplayProfileUnknown();
             }
             else
             {
                 View.IdProfile     = person.Id;
                 View.IdProfileType = person.TypeID;
                 dtoProfilePermission permission = new dtoProfilePermission(UserContext.UserTypeID, person.TypeID);
                 View.AllowEdit = permission.Edit;
                 View.AllowManageAuthentications = permission.ManageAuthentication;
                 View.LoadProfileName(person.SurnameAndName);
                 if (permission.Edit)
                 {
                     View.LoadProfile(person.Id, person.TypeID);
                 }
                 else
                 {
                     View.DisplayNoPermission();
                 }
             }
         }
         else
         {
             View.DisplayNoPermission();
         }
     }
 }
Beispiel #16
0
        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);
        }
Beispiel #17
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();
            }
        }
Beispiel #18
0
 public void InitView(Int32 idProfile)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
         View.AllowManagement = (module.EditProfile || module.Administration || module.ViewProfiles);
         if (module.EditProfile || module.Administration)
         {
             Person person = CurrentManager.GetPerson(idProfile);
             if (person == null)
             {
                 View.DisplayProfileUnknown();
             }
             else
             {
                 View.IdProfile = person.Id;
                 dtoProfilePermission permission = new dtoProfilePermission(UserContext.UserTypeID, person.TypeID);
                 View.AllowSubscribeToCommunity = permission.Edit;
                 View.LoadProfileName(person.SurnameAndName);
                 if (permission.Edit)
                 {
                     InitializeSteps();
                     View.GotoStep(CommunitySubscriptionWizardStep.SelectCommunities, true);
                 }
                 else
                 {
                     View.DisplayNoPermission();
                 }
             }
         }
         else
         {
             View.DisplayNoPermission();
         }
     }
 }
Beispiel #19
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();
        }
 public void InitView(long idAgency)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
         View.AllowManagement = module.Administration;
         if (module.Administration)
         {
             dtoAgency agency = Service.GetDtoAgency(idAgency);
             if (agency == null && idAgency > 0)
             {
                 View.DisplayAgencyUnknown();
             }
             else
             {
                 View.IdAgency  = idAgency;
                 View.AllowEdit = true;
                 if (idAgency > 0)
                 {
                     View.LoadAgencyName(agency.Name);
                     View.LoadAgency(agency, Service.GetAgencyAvailableOrganizations(idAgency));
                 }
                 else
                 {
                     View.InitializeForAdd(Service.GetAgencyAvailableOrganizations(idAgency));
                 }
             }
         }
         else
         {
             View.DisplayNoPermission();
         }
     }
 }
 public void InitView()
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
         View.AllowManagement = (module.EditProfile || module.Administration || module.ViewProfiles);
         if (module.AddProfile || module.Administration)
         {
             View.PreviousStep     = AgencyImportStep.None;
             View.ImportIdentifier = System.Guid.NewGuid();
             InitializeSteps();
             View.GotoStep(AgencyImportStep.SourceCSV, true);
         }
         else
         {
             View.DisplayNoPermission();
         }
     }
 }
        public void InitView(Int32 idProfile)
        {
            Person person = CurrentManager.GetPerson(idProfile);

            if (person == null || UserContext.isAnonymous)
            {
                View.DisplayEmpty();
            }
            else
            {
                View.IdProfile = idProfile;
                ModuleProfileManagement module     = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);
                dtoProfilePermission    permission = new dtoProfilePermission(UserContext.UserTypeID, person.TypeID);

                if (module.ViewProfiles || module.Administration)
                {
                    InitializeFilters(person);
                }
                else
                {
                    View.DisplayEmpty();
                }
            }
        }
Beispiel #23
0
        private List <ProfileColumn> SetDefaultColumns(Int32 idRole, Int32 idProfileType, Boolean displayMail, ModuleProfileManagement pModule, SubscriptionStatus status)
        {
            List <ProfileColumn> columns = new List <ProfileColumn>();

            columns.Add(ProfileColumn.name);
            if (displayMail)
            {
                columns.Add(ProfileColumn.mail);
            }
            if (idRole <= 0)
            {
                columns.Add(ProfileColumn.communityrole);
            }
            if (idProfileType <= 0 && (pModule.Administration || pModule.ViewProfiles) && View.ShowSubscriptionsProfileTypeColumn)
            {
                columns.Add(ProfileColumn.type);
            }
            if (idProfileType == (int)UserTypeStandard.Company)
            {
                columns.Add(ProfileColumn.companyName);
            }
            if (idProfileType == (int)UserTypeStandard.Employee)
            {
                columns.Add(ProfileColumn.agency);
            }
            if (status == SubscriptionStatus.all || status == SubscriptionStatus.none)
            {
                columns.Add(ProfileColumn.status);
            }
            View.AvailableColumns = columns;
            return(columns);
        }
Beispiel #24
0
        public void LoadProfiles(int currentPageIndex, int currentPageSize, Boolean updateSelection)
        {
            List <Int32> idRemoveUsers = View.UnavailableIdUsers;
            dtoFilters   filters       = View.SearchProfileFilters;
            PagerBase    pager         = new PagerBase();

            //if (filters.StartWith != View.CurrentStartWith)
            //    filters.StartWith = View.CurrentStartWith;

            pager.PageSize   = currentPageSize;  //Me.View.CurrentPageSize
            pager.Count      = (int)Service.ProfilesCount(filters, idRemoveUsers) - 1;
            pager.PageIndex  = currentPageIndex; // Me.View.CurrentPageIndex
            View.Pager       = pager;
            View.IsFirstLoad = false;

            //List<lm.Comol.Core.DomainModel.Helpers.AlphabetItem> aItems = ;
            //if (aItems.Where(i => i.Value == View.CurrentStartWith && i.isEnabled).Any())
            //    aItems.Where(i => i.Value == View.CurrentStartWith && i.isEnabled).FirstOrDefault().isSelected = true;
            //else if (aItems.Where(i => i.Value == View.CurrentStartWith && !i.isEnabled).Any())
            //{
            //    aItems.Where(i => i.Type == DomainModel.Helpers.AlphabetItemType.all).FirstOrDefault().isSelected = true;
            //    View.CurrentStartWith= "";
            //    filters.StartWith = "";
            //}
            if (updateSelection)
            {
                View.SelectedIdUsers = UpdateItemsSelection();
            }
            View.InitializeWordSelector(Service.GetAvailableStartLetter(filters, idRemoveUsers), filters.StartWith);
            filters.StartWith = View.CurrentStartWith;
            ModuleProfileManagement module = ModuleProfileManagement.CreatePortalmodule(UserContext.UserTypeID);

            List <dtoBaseProvider> providers = Service.GetAuthenticationProviders(UserContext.Language.Id, true);
            List <ProfileColumn>   columns   = SetDefaultColumns(filters.IdProfileType, module.Administration || module.ViewProfiles, filters.Status);

            if (View.SelectedIdProfileType != (int)UserTypeStandard.Employee)
            {
                View.UnLoadAgencies();
            }

            switch (filters.IdProfileType)
            {
            case (int)UserTypeStandard.Company:
                List <dtoProfileItem <dtoCompany> > companyUsers = Service.GetCompanyUserProfiles(filters, pager.PageIndex, currentPageSize, View.GetTranslatedProfileTypes, providers, idRemoveUsers);
                if (companyUsers.Where(i => i.Id == UserContext.CurrentUserID).Any())
                {
                    companyUsers.Where(i => i.Id == UserContext.CurrentUserID).ToList().ForEach(i => i.Permission.LogonAs = false);
                }
                View.LoadProfiles(companyUsers);
                break;

            case (int)UserTypeStandard.Employee:
                List <dtoProfileItem <dtoEmployee> > employeeUsers = Service.GetEmployeeProfiles(filters, pager.PageIndex, currentPageSize, View.GetTranslatedProfileTypes, providers, idRemoveUsers);
                if (employeeUsers.Where(i => i.Id == UserContext.CurrentUserID).Any())
                {
                    employeeUsers.Where(i => i.Id == UserContext.CurrentUserID).ToList().ForEach(i => i.Permission.LogonAs = false);
                }
                View.LoadProfiles(employeeUsers);
                break;
            //case (int)UserTypeStandard.ExternalUser:
            //    List<dtoProfileItem<dtoExternal>> externalUsers = Service.GetEmployeeProfiles(filters, pager.PageIndex, currentPageSize, View.GetTranslatedProfileTypes, providers);
            //    if (!columns.Contains(ProfileColumn.login))
            //        View.AvailableLogins = Service.GetProfilesLogin(externalUsers.Select(i => i.Profile.Id).ToList());
            //    if (externalUsers.Where(i => i.Id == UserContext.CurrentUserID).Any())
            //        externalUsers.Where(i => i.Id == UserContext.CurrentUserID).ToList().ForEach(i => i.Permission.LogonAs = false);
            //    View.LoadProfiles(externalUsers);
            //    break;
            //case (int)UserTypeStandard.Undergraduate:

            default:
                List <dtoProfileItem <dtoBaseProfile> > items = Service.GetProfiles(filters, pager.PageIndex, currentPageSize, View.GetTranslatedProfileTypes, providers, idRemoveUsers);
                View.LoadProfiles(items);
                break;
            }
        }