Ejemplo n.º 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();
 }
Ejemplo n.º 2
0
        private void FormLogOn_Load(object sender, System.EventArgs e)
        {
            TextBox textSelectOnLoad = textPassword;

            if (PrefC.GetBool(PrefName.UserNameManualEntry))
            {
                listUser.Visible = false;
                textUser.Visible = true;
                textSelectOnLoad = textUser; //Focus should start with user name text box.
            }
            else                             //Show a list of users.
                                             //Only show the show CEMT user check box if not manually typing user names and there are CEMT users present in the db.
            {
                if (Userods.GetUsersForCEMT().Count > 0)
                {
                    checkShowCEMTUsers.Visible = true;
                }
            }
            FillListBox();
            this.Focus();              //Attempted fix, customers had issue with UI not defaulting focus to this form on startup.
            textSelectOnLoad.Select(); //Give focus to appropriate text box.
        }