public static Boolean IsInherited(FzSchemeEntity scheme, List<FzRelationEntity> relations) { try { foreach (FzRelationEntity relation in relations) { if (scheme.Equals(relation.Scheme)) { return true; //break; } } } catch { } return false; }
private void DeleteScheme(FzSchemeEntity delScheme) { if (FzSchemeBLL.IsInherited(delScheme, fdbEntity.Relations)) { MessageBox.Show("Scheme is being inherited!"); } else { DialogResult result = new DialogResult(); result = MessageBox.Show("Delete this scheme ?", "Delete scheme " + delScheme.SchemeName, MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { if (currentScheme != null && delScheme.Equals(currentScheme)) { //CloseCurrentScheme(); AddRowDefault(); } DeleteTreeNode(delScheme.SchemeName, delScheme, null, null); } } }