private void populateRolesAndGroups(MNameValuePair profile) { int mSecurityEntityId = int.Parse(ClientChoicesState[MClientChoices.SecurityEntityId].ToString()); DataView mDVRoles = RoleUtility.GetAllRolesBySecurityEntity(mSecurityEntityId).DefaultView; DataView mDVGroups = GroupUtility.GetAllGroupsBySecurityEntity(mSecurityEntityId).DefaultView; try { ctlGroups.SelectedItems = NameValuePairUtility.GetSelectedGroups(m_NVPToUpdate.Id); ctlRoles.SelectedItems = NameValuePairUtility.GetSelectedRoles(m_NVPToUpdate.Id); } catch (Exception ex) { Logger mLog = Logger.Instance(); mLog.Debug(ex); } ctlGroups.DataSource = mDVGroups; ctlGroups.DataField = "Name"; ctlGroups.DataBind(); ctlRoles.DataSource = mDVRoles; ctlRoles.DataField = "Name"; ctlRoles.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { MAccountProfile updatingAccount = null; MGroupProfile mGroupProfile = GroupUtility.GetProfile(int.Parse(HttpContext.Current.Request["GroupSeqId"])); txtEditID.Text = mGroupProfile.Id.ToString(); litGroup.Text = mGroupProfile.Name; HttpContext.Current.Session.Add("EditId", mGroupProfile.Id); updatingAccount = AccountUtility.CurrentProfile(); DataView myDataView = RoleUtility.GetAllRolesBySecurityEntity(int.Parse(ClientChoicesState[MClientChoices.SecurityEntityId].ToString())).DefaultView; if (!updatingAccount.IsSystemAdmin) { String rowFilter = "IS_SYSTEM <> 1 AND IS_SYSTEM_ONLY <> 1"; myDataView.RowFilter = rowFilter; } try { MGroupProfile myGroupProfile = new MGroupProfile(); myGroupProfile = GroupUtility.GetProfile(int.Parse(txtEditID.Text.ToString())); litGroup.Text = myGroupProfile.Name; MGroupRoles mProfile = new MGroupRoles(); mProfile.SecurityEntityId = int.Parse(ClientChoicesState[MClientChoices.SecurityEntityId].ToString()); mProfile.GroupSeqId = int.Parse(txtEditID.Text.ToString()); ctlMembers.SelectedItems = GroupUtility.GetSelectedRoles(mProfile); } catch (Exception ex) { Logger log = Logger.Instance(); log.Debug(ex); } ctlMembers.DataSource = myDataView; ctlMembers.DataField = "Name"; ctlMembers.DataBind(); }