/// <summary> /// Updates an existing folder. /// </summary> /// <param name="reader"></param> private void EditFolder(IDataReader reader) { FileTreeItem.UpdateFileItem(PageId, Name.Text, false, true, false, String.Empty, SiteId); // update folder access foreach (ListItem item in RolesList.Items) { if (item.Selected) { using (IDataReader reader1 = FileTreeItem.PageAccessGetByRoleIdPageId(item.Value, PageId)) { if (!reader1.Read()) { FileTreeItem.AddPageAccess(item.Value, PageId); } reader1.Close(); } } else { using (IDataReader reader2 = FileTreeItem.PageAccessGetByRoleIdPageId(item.Value, PageId)) { if (reader2.Read()) { FileTreeItem.DeletePageAccess((int)reader2["PageAccessId"]); } reader2.Close(); } } } }
/// <summary> /// Binds the roles. /// </summary> private void BindRoles() { RolesList.DataSource = Roles.GetAllRoles(); RolesList.DataBind(); foreach (ListItem item in RolesList.Items) { using (IDataReader reader = FileTreeItem.PageAccessGetByRoleIdPageId(item.Value, PageId)) { if (reader.Read()) { item.Selected = true; } else { item.Selected = false; } reader.Close(); } } // select Everyone role in case it is a new folder if (PageId <= 0) { ListItem everyoneItem = RolesList.Items.FindByValue(AppRoles.EveryoneRole); if (everyoneItem != null) { everyoneItem.Selected = true; } } }