public IEnumerable <object> GetAll(string typeAlias, string sortColumn, string sortOrder) { var t = Helper.GetUIOMaticTypeByAlias(typeAlias, throwNullError: true); return(_service.GetAll(t, sortColumn, sortOrder)); }
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { var nodes = new TreeNodeCollection(); var types = Helper.GetUIOMaticFolderTypes().OrderBy(x => x.GetCustomAttribute <UIOMaticFolderAttribute>(false).Order); foreach (var type in types) { var attri = (UIOMaticFolderAttribute)Attribute.GetCustomAttribute(type, typeof(UIOMaticFolderAttribute)); if (attri == null) { continue; } var alias = attri.Alias.IsNullOrWhiteSpace() ? type.Name : attri.Alias; if (attri.ParentAlias == id) { var attri2 = attri as UIOMaticAttribute; if (attri2 != null) { if (attri2.HideFromTree) { continue; } // UIOMatic node if (attri2.RenderType == UIOMaticRenderType.Tree) { // Tree node var node = this.CreateTreeNode( alias, id, queryStrings, attri.FolderName, attri.FolderIcon, true, "uiomatic"); nodes.Add(node); } else { // List view node var node = this.CreateTreeNode( alias, id, queryStrings, attri.FolderName, attri.FolderIcon, false, "uiomatic/uiomatic/list/" + alias); node.SetContainerStyle(); nodes.Add(node); } } else { // Just a folder var node = this.CreateTreeNode( attri.Alias, id, queryStrings, attri.FolderName, attri.FolderIcon, true, "uiomatic"); nodes.Add(node); } } else if (id == alias) { var attri2 = attri as UIOMaticAttribute; if (attri2 != null) { if (attri2.HideFromTree) { continue; } var primaryKeyPropertyName = type.GetPrimaryKeyName(); if (attri2.RenderType == UIOMaticRenderType.Tree) { // List nodes foreach (dynamic item in _service.GetAll(type, attri2.SortColumn, attri2.SortOrder)) { var node = CreateTreeNode( ((object)item).GetPropertyValue(primaryKeyPropertyName) + "?ta=" + id, id, queryStrings, item.ToString(), attri2.ItemIcon, false); nodes.Add(node); } } } } } return(nodes); }