示例#1
0
        public static List <UserApplication> GetAllUsersApps(SelectApplications selectApplications, string applicationName = null)
        {
            List <UserApplication>   allUsers  = new List <UserApplication>();
            MembershipUserCollection tempUsers = new MembershipUserCollection();

            switch (selectApplications)
            {
            case SelectApplications.All:
            {
                //foreach (string appName in GetAllApplicationNames())
                foreach (Application application in ApplicationsBLL.GetApplications(ApplicationsOptionAll.False))
                {
                    string appName = application.ApplicationName;
                    Membership.ApplicationName = appName;
                    Roles.ApplicationName      = appName;
                    tempUsers = Membership.GetAllUsers();

                    foreach (MembershipUser user in tempUsers)
                    {
                        string        version        = user.Comment;
                        string        imageURL       = String.Format(@"{0}/{1}/{2}/{3}/{4}.jpg", cloudinaryStoreURL, version, cloudinaryAccountsFolder, appName, user.UserName);
                        string        userRolestring = RolesBLL.GetRolesForUserInOneString(appName, user.UserName);
                        List <string> userRoles      = RolesBLL.GetRolesForUserByApplication(appName, user.UserName);
                        allUsers.Add(new UserApplication(user, appName, imageURL, userRolestring, userRoles));
                    }
                }

                Membership.ApplicationName = "ShopHelperAsp";
                Roles.ApplicationName      = "ShopHelperAsp";
                break;
            }

            case SelectApplications.SpecifucApplication:
            {
                Membership.ApplicationName = applicationName;
                tempUsers = Membership.GetAllUsers();

                foreach (MembershipUser user in tempUsers)
                {
                    string version   = user.Comment;
                    string imageURL  = String.Format(@"{0}/{1}/{2}/{3}/{4}.jpg", cloudinaryStoreURL, version, cloudinaryAccountsFolder, applicationName, user.UserName);
                    string userRoles = RolesBLL.GetRolesForUserInOneString(applicationName, user.UserName);
                    allUsers.Add(new UserApplication(user, applicationName, imageURL, userRoles));
                }

                Membership.ApplicationName = "ShopHelperAsp";
                break;
            }
            }
            return(allUsers);
        }
示例#2
0
        public static List <Application> GetRolesApplications()
        {
            List <Application> allApplicationsRolesList = new List <Application>();

            foreach (Application application in ApplicationsBLL.GetApplications(ApplicationsOptionAll.False))
            {
                if (application.ApplicationName != "---Select Application---")
                {
                    Application appRolse = new Application();
                    appRolse.ApplicationName = application.ApplicationName;
                    Roles.ApplicationName    = application.ApplicationName;
                    string[] applicationRoles = Roles.GetAllRoles();
                    appRolse.ApplicationRoles = new List <string>(applicationRoles);
                    allApplicationsRolesList.Add(appRolse);
                }
            }
            Roles.ApplicationName = "ShopHelperAsp";
            return(allApplicationsRolesList);
        }