private void PopulateUserGroups() { Facade.IReferenceData refData = new Facade.ReferenceData(); DataSet dsRoles = refData.GetAllRoles(); ListItem liClientRole = null; foreach (DataRow dr in dsRoles.Tables[0].Rows) { ListItem li = new ListItem(); li.Value = dr["RoleId"].ToString(); li.Text = dr["Description"].ToString(); if (m_isClient && li.Text == "Clients") { liClientRole = li; } if (!m_isClient || (m_isClient && li.Text != "Clients")) { lbAvailableRoles.Items.Add(li); } } if (liClientRole != null && m_isClient) { lbSelectedRoles.Items.Add(liClientRole); txtSelectedRoles.Value += "," + liClientRole.Value; } }
private void BindGrid() { Facade.UserAdmin facUserAdmin = new Facade.UserAdmin(); Facade.IReferenceData refData = new Facade.ReferenceData(); DataSet dsUserGroups = refData.GetAllRoles(); dgUserGroups.DataSource = dsUserGroups; dgUserGroups.DataBind(); }
private void PopulateUserGroups(Entities.User user) { Facade.IReferenceData refData = new Facade.ReferenceData(); DataSet dsRoles = refData.GetAllRoles(); bool Selected; cboTeam.ClearSelection(); ListItem teamMember = cboTeam.Items.FindByValue(user.TeamId.ToString()); if (teamMember != null) { teamMember.Selected = true; } foreach (DataRow dr in dsRoles.Tables[0].Rows) { ListItem li = new ListItem(dr["Description"].ToString(), dr["RoleId"].ToString()); Selected = false; string[] Roles = user.Roles.Split(','); foreach (string role in Roles) { if (role == dr["RoleId"].ToString()) { Selected = true; } } if (Selected) { lbSelectedRoles.Items.Add(li); } else { lbAvailableRoles.Items.Add(li); } } string _Roles = ""; lblMessage.Text = ""; foreach (ListItem li in lbSelectedRoles.Items) { _Roles += "," + li.Value; if (int.Parse(li.Value) == (int)eUserRole.Planner) { lblMessage.Text = "CAUTION: This user is a Planner. If you remove the Planner role, or remove this user, then all drivers assigned to this user will be unassigned."; } } txtSelectedRoles.Value = _Roles; }