public bool IsValid() { return(!string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(Description) && Uri.IsWellFormedUriString(Url.ToString(), UriKind.RelativeOrAbsolute) && Uri.IsWellFormedUriString(ParentStoryUrl.ToString(), UriKind.RelativeOrAbsolute) && KeyIdentifiers != null && KeyIdentifiers.Any() ? KeyIdentifiers.All(s => s.IsValid()) : true && TestCases != null && TestCases.Any() ? TestCases.All(s => s.IsValid()) : true && Checkups != null && Checkups.Any() ? Checkups.All(s => s.IsValid()) : true && Attachments != null && Attachments.Any() ? Attachments.All(s => Uri.IsWellFormedUriString(s.Value, UriKind.RelativeOrAbsolute)) : true && Queries != null && Queries.Any() ? Queries.All(s => Uri.IsWellFormedUriString(s.Value, UriKind.RelativeOrAbsolute)) : true && Scripts != null && Scripts.Any() ? Scripts.All(s => Uri.IsWellFormedUriString(s.Value, UriKind.RelativeOrAbsolute)) : true && SubTasks.Any() ? SubTasks.All(s => s.IsValid()) : true); }
/// <summary> /// Update the Status of a Task when one of its Substaks changes its Status /// When a task is Semi-done, will put a minus sign on its CheckBox /// EDIT: Will use the default windows style that puts a little box in the checkbox /// </summary> private void UpdateTaskStatus() { //If at least one subtask is Done, then the task is semidone if (SubTasks.Any(task => task.Status == TaskStatus.Done) && SubTasks.Any(task => task.Status != TaskStatus.Done)) { this.Status = TaskStatus.SemiDone; } else { if (SubTasks.All(task => task.Status == TaskStatus.Done)) { this.Status = TaskStatus.Done; } ; if (SubTasks.All(task => task.Status == TaskStatus.NotDone)) { this.Status = TaskStatus.NotDone; } if (SubTasks.All(task => task.Status == TaskStatus.SemiDone)) { this.Status = TaskStatus.SemiDone; } } }
private FlowDocument BuildDocument() { var doc = new FlowDocument(); doc.LineStackingStrategy = System.Windows.LineStackingStrategy.BlockLineHeight; doc.LineHeight = 12; doc.Blocks.Add(new Paragraph(new Bold(new Run("Summary")))); doc.Blocks.Add(new Paragraph(new Run(" " + Title))); doc.Blocks.Add(new Paragraph(new Bold(new Run("Description")))); doc.Blocks.Add(new Paragraph(new Run(" " + Description))); doc.Blocks.Add(new Paragraph(new Bold(new Run("Url")))); var url = new Hyperlink(new Run(Url.ToString())); doc.Blocks.Add(new Paragraph(url)); doc.Blocks.Add(new Paragraph(new Bold(new Run("Parent Story")))); var parentUrl = new Hyperlink(new Run(ParentStoryUrl.ToString())); parentUrl.NavigateUri = ParentStoryUrl; doc.Blocks.Add(new Paragraph(parentUrl)); doc.Blocks.Add(new Paragraph(new Italic(new Run("Status: " + Status.ToString())))); doc.Blocks.Add(new Paragraph(new Italic(new Run("Date Started: " + DateStarted.Value.ToString("yyyy-MM-dd hh:mm:ss"))))); if (DateEnded.HasValue && DateEnded.Value != DateTime.MinValue) { doc.Blocks.Add(new Paragraph(new Italic(new Run("Date Ended: " + DateEnded.Value.ToString("yyyy-MM-dd hh:mm:ss"))))); } if (Attachments.Any()) { doc.Blocks.Add(new Paragraph(new Bold(new Run("Attachments")))); foreach (var item in Attachments) { var itemUri = new Uri(item.Value); var itemUrl = new Hyperlink(new Run(item.Value)); doc.Blocks.Add(new Paragraph(itemUrl)); } } if (AcceptanceCriteria.Any()) { doc.Blocks.Add(new Paragraph(new Bold(new Run("Acceptance Criteria")))); foreach (var item in AcceptanceCriteria) { doc.Blocks.Add(new Paragraph(new Run(" + " + item.Value))); } } if (DeveloperCriteria.Any()) { doc.Blocks.Add(new Paragraph(new Bold(new Run("Development Criteria")))); foreach (var item in DeveloperCriteria) { doc.Blocks.Add(new Paragraph(new Run(" + " + item.Value))); } } var i = 0; var j = 0; if (KeyIdentifiers.Any()) { doc.Blocks.Add(new Paragraph(new Bold(new Run("Key Identifiers")))); foreach (var item in KeyIdentifiers) { doc.Blocks.Add(new Paragraph(new Run(" " + (++i).ToString() + ". " + item.Description))); if (item.Questions.Any()) { j = 0; doc.Blocks.Add(new Paragraph(new Italic(new Run(" Questions")))); foreach (var q in item.Questions) { doc.Blocks.Add(new Paragraph(new Run(" " + (++j).ToString() + ".Q. " + q.Ask))); doc.Blocks.Add(new Paragraph(new Run(" A. " + q.Answer))); } } } } if (Issues.Any()) { i = 0; doc.Blocks.Add(new Paragraph(new Bold(new Run("Issues")))); foreach (var item in Issues) { doc.Blocks.Add(new Paragraph(new Run(" " + (++i).ToString() + ". " + item.Description))); doc.Blocks.Add(new Paragraph(new Italic(new Run(" Is Open: " + item.IsOpen.ToString())))); } } if (Queries.Any()) { doc.Blocks.Add(new Paragraph(new Bold(new Run("Queries")))); foreach (var item in Queries) { var itemUri = new Uri(item.Value); var itemUrl = new Hyperlink(new Run(item.Value)); doc.Blocks.Add(new Paragraph(itemUrl)); } } if (Scripts.Any()) { doc.Blocks.Add(new Paragraph(new Bold(new Run("Scripts")))); foreach (var item in Scripts) { var itemUri = new Uri(item.Value); var itemUrl = new Hyperlink(new Run(item.Value)); doc.Blocks.Add(new Paragraph(itemUrl)); } } if (TestCases.Any()) { i = 0; doc.Blocks.Add(new Paragraph(new Bold(new Run("Test Cases")))); foreach (var item in TestCases) { doc.Blocks.Add(new Paragraph(new Run(" " + (++i).ToString() + ". " + item.Description))); doc.Blocks.Add(new Paragraph(new Italic(new Run(" Status: " + item.Status.ToString())))); if (item.Steps.Any()) { j = 0; doc.Blocks.Add(new Paragraph(new Italic(new Run(" Steps")))); foreach (var q in item.Steps) { doc.Blocks.Add(new Paragraph(new Run(" " + (++j).ToString() + ". " + q.Value))); } } } } if (Checkups.Any()) { i = 0; doc.Blocks.Add(new Paragraph(new Bold(new Run("Checkups")))); foreach (var item in Checkups) { doc.Blocks.Add(new Paragraph(new Run(" " + (++i).ToString() + ". " + item.Description))); doc.Blocks.Add(new Paragraph(new Italic(new Run(" Applied: " + item.Applied.ToString())))); } } if (SubTasks.Any()) { i = 0; doc.Blocks.Add(new Paragraph(new Bold(new Run("SubTasks")))); foreach (var item in SubTasks) { doc.Blocks.Add(new Paragraph(new Run(" " + (++i).ToString() + ". " + item.Title))); doc.Blocks.Add(new Paragraph(new Italic(new Run(" Status: " + item.Status)))); } } return(doc); }