private void BindGroupUsers(int GroupID)
        {
            lbUsers.Items.Clear();
            DataTable dt = GetResTable;

            int RoleId = -1;

            if (ddRole.Items.Count > 0)
            {
                RoleId = int.Parse(ddRole.SelectedValue);
            }
            //int RoleId = int.Parse(ddRole.SelectedValue);
            using (IDataReader rdr = SecureGroup.GetListActiveUsersInGroup(GroupID))
            {
                while (rdr.Read())
                {
                    DataRow[] dr = dt.Select("PrincipalId = " + (int)rdr["UserId"] + " AND RoleId = " + RoleId);
                    if (dr.Length == 0)
                    {
                        lbUsers.Items.Add(new ListItem(rdr["LastName"].ToString() +
                                                       " " + rdr["FirstName"].ToString(), rdr["UserId"].ToString()));
                    }
                }
            }
        }
Beispiel #2
0
        private void BindGroupUsers(int groupId)
        {
            lbUsers.Items.Clear();
            DataTable dt = (DataTable)ViewState["Resources"];

            if (groupId > 0)
            {
                using (IDataReader reader = SecureGroup.GetListActiveUsersInGroup(groupId))
                {
                    while (reader.Read())
                    {
                        DataRow[] dr = dt.Select("UserId = " + (int)reader["UserId"]);
                        if (dr.Length == 0)
                        {
                            lbUsers.Items.Add(new ListItem((string)reader["LastName"] + ", " + (string)reader["FirstName"], reader["UserId"].ToString()));
                        }
                    }
                }
            }
            else             // Favorites
            {
                DataTable favorites = Mediachase.IBN.Business.Common.GetListFavoritesDT(ObjectTypes.User);
                foreach (DataRow row in favorites.Rows)
                {
                    DataRow[] dr = dt.Select("UserId = " + (int)row["ObjectId"]);
                    if (dr.Length == 0)
                    {
                        lbUsers.Items.Add(new ListItem((string)row["Title"], row["ObjectId"].ToString()));
                    }
                }
            }
        }
Beispiel #3
0
        private void BindGroupUsers(int groupId)
        {
            lbAvailable.Items.Clear();
            ArrayList alSelected = new ArrayList();

            foreach (ListItem liSelected in lbSelected.Items)
            {
                alSelected.Add(int.Parse(liSelected.Value));
            }

            if (groupId > 0)
            {
                using (IDataReader reader = SecureGroup.GetListActiveUsersInGroup(groupId))
                {
                    while (reader.Read())
                    {
                        if (!alSelected.Contains((int)reader["UserId"]))
                        {
                            lbAvailable.Items.Add(new ListItem(reader["LastName"].ToString() + " " + reader["FirstName"].ToString(), reader["UserId"].ToString()));
                        }
                    }
                }
            }
            else if (groupId == 0)              // Favorites
            {
                DataTable favorites = Mediachase.IBN.Business.Common.GetListFavoritesDT(ObjectTypes.User);
                foreach (DataRow row in favorites.Rows)
                {
                    if (!alSelected.Contains((int)row["ObjectId"]))
                    {
                        lbAvailable.Items.Add(new ListItem((string)row["Title"], row["ObjectId"].ToString()));
                    }
                }
            }
            else
            {
                using (IDataReader reader = Project.GetListTeamMemberNamesWithManager(-groupId))
                {
                    while (reader.Read())
                    {
                        if (!alSelected.Contains((int)reader["UserId"]))
                        {
                            lbAvailable.Items.Add(new ListItem(reader["LastName"].ToString() + " " + reader["FirstName"].ToString(), reader["UserId"].ToString()));
                        }
                    }
                }
            }
        }
        private void BindGroupUsers(int groupId)
        {
            lbUsers.Items.Clear();
            DataTable dt = (DataTable)ViewState["Participants"];

            if (groupId > 0)
            {
                btnAddGroup.Visible = true;
                using (IDataReader reader = SecureGroup.GetListActiveUsersInGroup(groupId))
                {
                    while (reader.Read())
                    {
                        DataRow[] dr = dt.Select("PrincipalId = " + (int)reader["UserId"]);
                        if (dr.Length == 0)
                        {
                            lbUsers.Items.Add(new ListItem((string)reader["LastName"] + " " + (string)reader["FirstName"], reader["UserId"].ToString()));
                        }
                    }
                }
            }
            else if (groupId == 0)              // Favorites
            {
                DataTable favorites = Mediachase.IBN.Business.Common.GetListFavoritesDT(ObjectTypes.User);
                foreach (DataRow row in favorites.Rows)
                {
                    DataRow[] dr = dt.Select("PrincipalId = " + (int)row["ObjectId"]);
                    if (dr.Length == 0)
                    {
                        lbUsers.Items.Add(new ListItem((string)row["Title"], row["ObjectId"].ToString()));
                    }
                }
            }
            else
            {
                btnAddGroup.Visible = false;
                using (IDataReader reader = Project.GetListTeamMemberNamesWithManager(-groupId))
                {
                    while (reader.Read())
                    {
                        DataRow[] dr = dt.Select("PrincipalId = " + (int)reader["UserId"]);
                        if (dr.Length == 0)
                        {
                            lbUsers.Items.Add(new ListItem((string)reader["LastName"] + " " + (string)reader["FirstName"], reader["UserId"].ToString()));
                        }
                    }
                }
            }
        }
Beispiel #5
0
        private void BindGroupUsers(int GroupID)
        {
            lbUsers.Items.Clear();
            DataTable dt = (DataTable)ViewState["Participants"];

            using (IDataReader rdr = SecureGroup.GetListActiveUsersInGroup(GroupID))
            {
                while (rdr.Read())
                {
                    DataRow[] dr = dt.Select("UserId = " + (int)rdr["UserId"]);
                    if (dr.Length == 0)
                    {
                        lbUsers.Items.Add(new ListItem(rdr["LastName"].ToString() + " " + rdr["FirstName"].ToString(), rdr["UserId"].ToString()));
                    }
                }
            }
        }
 private void BindGroupUsers(int GroupID)
 {
     lbUsers.Items.Clear();
     using (IDataReader rdr = SecureGroup.GetListActiveUsersInGroup(GroupID))
     {
         string str = "";
         while (rdr.Read())
         {
             str += rdr["UserId"].ToString() + ",";
             ListItem lItm = lstSelected.Items.FindByValue(rdr["UserId"].ToString());
             if (lItm == null)
             {
                 lbUsers.Items.Add(new ListItem((string)rdr["LastName"] + " " + (string)rdr["FirstName"], rdr["UserId"].ToString()));
             }
         }
         iGroupFields.Value = str;
     }
 }