示例#1
0
        //void FillUserNameCombobox()
        //{
        //    Dictionary<Guid, string> userItemSource = new Dictionary<Guid, string>();
        //    foreach (AspUser user in _aspUsers)
        //    {
        //        if (!userItemSource.ContainsKey(user.UserId))
        //        {
        //            userItemSource.Add(user.UserId, user.UserName);
        //        }
        //    }
        //    uiUsers.ItemsSource = userItemSource;
        //    if(userItemSource.Count > 0)
        //        uiUsers.SelectedIndex = 0;
        //    RebindUserAccountData();
        //}

        void FillUserNameCombobox()
        {
            //if this user is Security Admin : user can create new, edit the user accounts.
            Dictionary <Guid, string> userItemSource = new Dictionary <Guid, string>();

            if (Globals.UserLogin.IsUserPortalAdministrator)
            {
                foreach (AspUser user in _aspUsers)
                {
                    if (!userItemSource.ContainsKey(user.UserId))
                    {
                        userItemSource.Add(user.UserId, user.UserName);
                    }
                }
                uiUsers.ItemsSource   = userItemSource;
                uiUsers.SelectedIndex = 0;
                RebindUserAccountData();
            }
            else if (Globals.UserLogin.IsUserSecurityAdministrator)
            {
                List <AspUser> filterUsers = SecurityHelper.FilterUserList(_aspUsers, _siteGroups);
                foreach (AspUser user in filterUsers)
                {
                    if (!userItemSource.ContainsKey(user.UserId))
                    {
                        userItemSource.Add(user.UserId, user.UserName);
                    }
                }

                userItemSource.OrderBy(i => i.Value);
                uiUsers.ItemsSource = userItemSource;
            }
            else
            {
                userItemSource.Add(Globals.UserLogin.UserUserId, Globals.UserLogin.UserName);
                uiUsers.ItemsSource   = userItemSource;
                uiUsers.SelectedIndex = 0;

                RebindUserAccountData();
                uiUsers.IsEnabled            = false;
                chkAccountApproved.IsEnabled = false;
                btnUnlock.IsEnabled          = false;
            }
        }
示例#2
0
 void ListAllAspUserCompleted(List <AspUser> userList)
 {
     _aspUsers = RemoveDuplicateUser(SecurityHelper.FilterUserList(userList, _siteGroup));
     DataServiceHelper.ListAspRoleAsync(null, ListRoleCompleted);
 }