private static int ResolveFormTypeCollection(List<FormType> dbFormTypes, FormType parentFormType, int level) { int count = 0; foreach (var formtype in dbFormTypes.Where(f => f.Parent == parentFormType)) { count++; _formtypes.Add(formtype); formtype.TreeLevel = level; formtype.IsTreeLeaf = true; formtype.Enabled = true; level++; // 如果这个节点下没有子节点,则这是个终结节点 int childCount = ResolveFormTypeCollection(dbFormTypes, formtype, level); if (childCount != 0) { formtype.IsTreeLeaf = false; } level--; } return count; }
public object Clone() { FormType formtype = new FormType { ID = ID, Name = Name, SortIndex = SortIndex, TreeLevel = TreeLevel, Enabled = Enabled, IsTreeLeaf = IsTreeLeaf }; return formtype; }