public void Add(IssueSeverityType type, string text, object tag) { if (type != IssueSeverityType.None) { // Check if ParentNode has an Application, IssueObjectType and IssueObjectId defined or // it's not possible to add to the IssueList. Give an exception! if (ParentNode.Application == null || ParentNode.IssueObjectType == null || ParentNode.IssueObjectId == null) { throw new Exception("You may not create any Issues to a IssueNode that doesn't have Application, IssueObjectType and IssueObjectId set!"); } // Check if issue exist already Issue currentIssue = analyzeService.FindIssue(ParentNode.Application.Id, (IssueObjectType)ParentNode.IssueObjectType, ParentNode.IssueObjectId, GetTitle(), text); if (currentIssue != null) { // Set the tag and the severity type currentIssue.Tag = tag; currentIssue.Severity = type; // Save Issue analyzeService.SaveOrUpdateIssue(currentIssue); } else { // Create the new Issue currentIssue = new Issue(); currentIssue.Application = ParentNode.Application; currentIssue.ObjectType = (IssueObjectType)ParentNode.IssueObjectType; currentIssue.ObjectId = ParentNode.IssueObjectId; currentIssue.Severity = type; currentIssue.Tag = tag; currentIssue.Text = text; currentIssue.Title = GetTitle(); currentIssue.Hidden = false; // Save the Issue analyzeService.SaveOrUpdateIssue(currentIssue); } // Add the found or created issue to the list. base.Add(currentIssue); } }