private void BindUsers(int GroupId)
        {
            UsersList.Items.Clear();
            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("UserId", typeof(string)));                                           // 0
            dt.Columns.Add(new DataColumn("UserName", typeof(string)));                                         // 1
            DataRow dr;

            dr    = dt.NewRow();
            dr[0] = allUsers;
            dr[1] = LocRM.GetString("All");
            dt.Rows.Add(dr);

            if (GroupId > 0)
            {
                using (IDataReader reader = SecureGroup.GetListAllUsersInGroup(GroupId))
                {
                    while (reader.Read())
                    {
                        if ((byte)reader["Activity"] == (byte)Mediachase.IBN.Business.User.UserActivity.Active)
                        {
                            dr    = dt.NewRow();
                            dr[0] = reader["UserId"].ToString();
                            dr[1] = reader["LastName"].ToString() + " " + reader["FirstName"].ToString();
                            dt.Rows.Add(dr);
                        }
                    }
                }
            }

            DataView dv = dt.DefaultView;

            UsersList.DataSource     = dv;
            UsersList.DataTextField  = "UserName";
            UsersList.DataValueField = "UserId";
            UsersList.DataBind();

            //Saved Value
            if (_pc["MV_User"] != null)
            {
                UsersList.ClearSelection();
                try
                {
                    UsersList.SelectedValue = _pc["MV_User"];
                }
                catch
                {
                    UsersList.SelectedIndex = 0;
                    _pc["MV_User"]          = UsersList.SelectedValue;
                }
            }
        }
Beispiel #2
0
 private void usersList_SelectionChanged(object sender, EventArgs e)
 {
     UsersList.ClearSelection();
 }