Пример #1
0
 private void FillListBox()
 {
     Userods.RefreshCache();
     UserGroups.RefreshCache();
     GroupPermissions.RefreshCache();
     listUser.BeginUpdate();
     listUser.Items.Clear();
     if (PrefC.GetBool(PrefName.UserNameManualEntry))
     {
         //Because _listUsers is used to verify the user name typed in, we need to include both non-hidden and CEMT users for offices that type in their credentials instead of picking.
         _listUsers = Userods.GetUsers(true);
     }
     else if (checkShowCEMTUsers.Checked)             //Only show list of CEMT users.
     {
         _listUsers = Userods.GetUsersForCEMT().Where(x => !x.IsHidden).ToList();
     }
     else              //This will be the most common way to fill the user list.  Only includes non-hidden, non-CEMT users.
     {
         _listUsers = Userods.GetUsers();
     }
     _listUsers.ForEach(x => listUser.Items.Add(x));
     if (UserNumPrompt > 0)
     {
         listUser.SelectedIndex = _listUsers.FindIndex(x => x.UserNum == UserNumPrompt);            //can be -1 if not found
     }
     else if (Security.CurUser != null)
     {
         listUser.SelectedIndex = _listUsers.FindIndex(x => x.UserNum == Security.CurUser.UserNum); //can be -1 if not found
     }
     if (listUser.SelectedIndex == -1 && listUser.Items.Count > 0)                                  //It is possible there are no users in the list if all users are CEMT users.
     {
         listUser.SelectedIndex = 0;
     }
     listUser.EndUpdate();
 }
Пример #2
0
 private void FillListBox()
 {
     Userods.RefreshCache();
     UserGroups.RefreshCache();
     GroupPermissions.RefreshCache();
     listUser.BeginUpdate();
     listUser.Items.Clear();
     shortList = UserodC.ShortList;
     for (int i = 0; i < shortList.Count; i++)
     {
         listUser.Items.Add(shortList[i]);
         if (Security.CurUser != null && shortList[i].UserNum == Security.CurUser.UserNum)
         {
             listUser.SelectedIndex = i;
         }
     }
     if (listUser.SelectedIndex == -1)
     {
         listUser.SelectedIndex = 0;
     }
     listUser.EndUpdate();
 }