public FormAddUserForRole(role role, sql3238345Entities context)
        {
            InitializeComponent();
            this.role    = role;
            this.context = context;
            IList <user> allUsers        = context.users.Local;
            IList <user> userForCombobox = allUsers.Except(role.users).ToList();

            if (userForCombobox.Count != 0)
            {
                userComboBox.ItemsSource   = userForCombobox;
                userComboBox.SelectedIndex = 0;
            }
            else
            {
                MessageBox.Show("no user to select...");
                this.Close();
            }
        }
コード例 #2
0
        public FormAddRoleForUser(user user, sql3238345Entities context)
        {
            InitializeComponent();
            this.user    = user;
            this.context = context;
            IList <role> allRoles         = context.roles.Local;
            IList <role> RolesForCombobox = allRoles.Except(user.roles).ToList();

            if (RolesForCombobox.Count != 0)
            {
                roleComboBox.ItemsSource   = RolesForCombobox;
                roleComboBox.SelectedIndex = 0;
            }
            else
            {
                MessageBox.Show("no roles to select...");
                this.Close();
            }
        }