public IWorkItem CreateWorkItem(string workItemType, string title, string description) { EnsureConnected(); if (TrackerService == null) { return null; } IWorkItem newItem = null; var tracker = TrackerService.GetTrackerList(_currentProject.Id).Where(tr => string.Compare(tr.Title, workItemType, true) == 0).FirstOrDefault(); if (tracker == null) { return newItem; } var artifact = TrackerService.CreateArtifact(tracker.Id, title, description, Group: "", Category: "", Status: "Open", Customer: "", Priority: 4, EstimatedHours: 0, AssignedTo: "", ReleaseID: "", FlexFields: null, FlexFieldTypes: null, AttachmentFileName: "", AttachmentMimeType: "", AttachmentFileId: ""); if (artifact != null) { artifact.FlexFields["Project"] = Connection.ProjectName; IAttachmentDO attachment = null; TrackerService.SetArtifactData(artifact, "", attachment); newItem = new TeamForgeArtifact() { Id = artifact.ID, Title = artifact.Title, Description = artifact.Description }; } return newItem; }
public IWorkItem GetWorkItem(string id) { EnsureConnected(); if (TrackerService == null) { return null; } TeamForgeArtifact tfTracker = null; var filters = TrackerService.CreateArtifactFilterCollection(); var trackerList = TrackerService.GetTrackerList(_currentProject.Id); var artifact = TrackerService.GetArtifactList(_currentProject.Id, filters).Where(a => string.Compare(a.Id, id, true) == 0).FirstOrDefault(); if (artifact != null) { tfTracker = new TeamForgeArtifact() { Id = artifact.Id, Title = artifact.Title, Description = artifact.Description }; } return tfTracker; }