1 ///2 /// 递归改变组织树选中状态。 3 /// 4 /// 5 private void RecursionOrgDataTreeStatus(OrgData org) 6 { 7 foreach (var item in org.Nodes) 8 { 9 item.IsChecked = org.IsChecked;10 if (item.Nodes.Count > 0)11 {12 RecursionOrgDataTreeStatus(item);13 }14 }15 }16 17 18 /// 获取选中的组织数据。19 /// 20 private void GetCheckedOrgData()21 {22 foreach (OrgData orgData in orgDataCollection)23 {24 if(orgData.IsChecked)receiverData.Add(orgData);25 if (orgData.HasChild)26 {27 GetCheckedOrgChildData(orgData);28 }29 }30 }31 ///32 /// 获取选中组织中子节点选中的数据。33 /// 34 private void GetCheckedOrgChildData(OrgData org)35 {36 foreach (OrgData orgData in org.Nodes)37 {38 if(orgData.IsChecked)receiverData.Add(orgData);39 if (orgData.HasChild) GetCheckedOrgChildData(orgData);40 }41 }42 43 44 ///45 ///递归取父级节点下选中的节点。46 /// 47 /// 48 private void GetCheckedOrgDataByOrgParent(OrgData org)49 {50 if (org == null) return;51 if (org.Parent == null && org.IsChecked) receiverData.Add(org);52 if (org.Parent != null)53 {54 foreach (var node in org.Parent.Nodes)55 {56 if (node.IsChecked) receiverData.Add(node);57 }58 }59 GetCheckedOrgDataByOrgParent(org.Parent);60 }61 62 63 64 ///65 /// 递归删除节点的父级节点。66 /// 67 /// 68 private void DeletedOrgData(OrgData org)69 {70 if (org == null) return;71 if (org.Parent == null) return;72 receiverData.Remove(org.Parent);73 DeletedOrgData(org.Parent);74 }