/// <summary> /// Bind data for this control. /// </summary> private void BindData() { // list roles of this board DataTable dt = DB.group_list(PageContext.PageBoardID, null); // set repeater datasource this.RoleListYaf.DataSource = dt; // clear cached list of roles this._availableRoles.Clear(); // get all provider roles foreach (string role in RoleMembershipHelper.GetAllRoles()) { // make filter string, we want to filer by role name string filter = "Name='{0}'".FormatWith(role.Replace("'", "''")); // get given role of YAF DataRow[] rows = dt.Select(filter); // if this role is not in YAF DB, add it to the list of provider roles for syncing if (rows.Length == 0) { // doesn't exist in the Yaf Groups this._availableRoles.Add(role); } } // check if there are any roles for syncing if (this._availableRoles.Count > 0) { // make it datasource this.RoleListNet.DataSource = this._availableRoles; } else { // no datasource for provider roles this.RoleListNet.DataSource = null; } // bind data to controls DataBind(); }
/// <summary> /// Bind data for this control. /// </summary> private void BindData() { // list roles of this board DataTable dt = this.GetRepository <Group>().List(boardId: this.PageContext.PageBoardID); // set repeater datasource this.RoleListYaf.DataSource = dt; // clear cached list of roles this._availableRoles.Clear(); // get all provider roles foreach (string role in from role in RoleMembershipHelper.GetAllRoles() let filter = "Name='{0}'".FormatWith(role.Replace("'", "''")) let rows = dt.Select(filter) where rows.Length == 0 select role) { // doesn't exist in the Yaf Groups this._availableRoles.Add(role); } // check if there are any roles for syncing if (this._availableRoles.Count > 0 && !Config.IsDotNetNuke) { // make it datasource this.RoleListNet.DataSource = this._availableRoles; } else { // no datasource for provider roles this.RoleListNet.DataSource = null; } // bind data to controls this.DataBind(); }
/// <summary> /// Bind data for this control. /// </summary> private void BindData() { // list roles of this board var dt = this.GetRepository <Group>().List(boardId: this.PageContext.PageBoardID); // set repeater data-source this.RoleListYaf.DataSource = dt; // clear cached list of roles this.availableRoles.Clear(); // get all provider roles foreach (var role in from role in RoleMembershipHelper.GetAllRoles() let rows = dt.Select(g => g.Name == role) where dt.Count == 0 select role) { // doesn't exist in the Yaf Groups this.availableRoles.Add(role); } // check if there are any roles for syncing if (this.availableRoles.Count > 0 && !Config.IsDotNetNuke) { // make it datasource this.RoleListNet.DataSource = this.availableRoles; } else { // no datasource for provider roles this.RoleListNet.DataSource = null; } // bind data to controls this.DataBind(); }