Example #1
0
        public void FindAll(ListBox listBoxUsers, bool isAll, bool isAdm)
        {
            Collection <User>    userS    = UserDAO.FindAll();
            Collection <Contact> contactS = ContactDAO.FindAll();

            foreach (User user in userS)
            {
                Contact currentContact = getContact(contactS, user.ContactId);
                user.Contact = currentContact;
                listBoxUsers.DisplayMember = "Login";

                if (isAll == true)
                {
                    listBoxUsers.Items.Add(user);
                }
                else
                {
                    if (isAdm == false)
                    {
                        if (user.IsAdmin == false)
                        {
                            listBoxUsers.Items.Add(user);
                        }
                    }
                    else
                    {
                        if (user.IsAdmin == true)
                        {
                            listBoxUsers.Items.Add(user);
                        }
                    }
                }
            }
        }