internal static Story CreateStory(StoryXmlResponse e) { var lStory = new Story() { AcceptedDate = e.accepted_at, //Attachments = CreatedDate = e.created_at, UpdatedDate = e.updated_at, CurrentState = (StoryStateEnum)Enum.Parse(typeof(StoryStateEnum), e.current_state, true), Description = e.description, Estimate = e.estimate, Id = e.id, Name = e.name, //Notes = OwnedBy = e.owned_by, ProjectId = e.project_id, RequestedBy = e.requested_by, //Tasks = Type = (StoryTypeEnum)Enum.Parse(typeof(StoryTypeEnum), e.story_type, true), Url = new Uri(e.url) }; if (e.attachments != null) { e.attachments.ToList().ForEach(a => lStory.Attachments.Add(a)); } if (e.notes != null) { e.notes.ToList().ForEach(a => lStory.Notes.Add(new Note() { Id = a.id, Author = a.author, Description = a.text, NoteDate = a.noted_at == null ? null : a.noted_at.DateTime })); } if (e.tasks != null) { e.tasks.ToList().ForEach(a => lStory.Tasks.Add(a)); } return(lStory); }
internal static Story CreateStory(StoryXmlResponse e) { var lStory = new Story() { AcceptedDate = e.accepted_at, //Attachments = CreatedDate = e.created_at, UpdatedDate = e.updated_at, CurrentState = (StoryStateEnum) Enum.Parse(typeof (StoryStateEnum), e.current_state, true), Description = e.description, Estimate = e.estimate, Id = e.id, Name = e.name, //Notes = OwnedBy = e.owned_by, ProjectId = e.project_id, RequestedBy = e.requested_by, //Tasks = Type = (StoryTypeEnum)Enum.Parse(typeof(StoryTypeEnum), e.story_type, true), Url = new Uri(e.url) }; if (e.attachments != null) e.attachments.ToList().ForEach(a => lStory.Attachments.Add(a)); if (e.notes != null) e.notes.ToList().ForEach(a => lStory.Notes.Add(new Note() { Id = a.id, Author = a.author, Description = a.text, NoteDate = a.noted_at == null ? null : a.noted_at.DateTime })); if (e.tasks != null) e.tasks.ToList().ForEach(a => lStory.Tasks.Add(a)); return lStory; }
internal static Story CreateStory(StoryXmlResponse e) { var lStory = new Story() { AcceptedDate = e.accepted_at, //Attachments = CreatedDate = e.created_at, UpdatedDate = e.updated_at, Deadline = e.deadline, CurrentState = (StoryStateEnum) Enum.Parse(typeof (StoryStateEnum), e.current_state, true), Description = e.description, Estimate = e.estimate, Id = e.id, Name = e.name, //Notes = OwnedBy = e.owned_by, ProjectId = e.project_id, RequestedBy = e.requested_by, //Tasks = Type = (StoryTypeEnum)Enum.Parse(typeof(StoryTypeEnum), e.story_type, true), Url = new Uri(e.url) }; if (e.attachments != null) e.attachments.ToList().ForEach(a => lStory.Attachments.Add(a)); if (e.labels != null) { var labels = e.labels.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); labels.ToList().ForEach(a => lStory.Labels.Add(a)); } if (e.notes != null) e.notes.ToList().ForEach(a => lStory.Notes.Add(new Note() { Id = a.id, Author = a.author, Description = a.text, NoteDate = a.noted_at == null ? null : a.noted_at.DateTime })); if (e.tasks != null) e.tasks.ToList().ForEach(a => lStory.Tasks.Add(new Task() { Id = a.id, Description = a.description, Position = a.position, IsCompleted = a.complete, CreatedDate = a.created_at == null ? null : a.created_at.DateTime })); return lStory; }
internal static Story CreateStory(StoryXmlResponse e) { if (e == null) { return(new Story()); } var lStory = new Story() { AcceptedDate = e.accepted_at, //Attachments = CreatedDate = e.created_at, UpdatedDate = e.updated_at, CurrentState = (StoryStateEnum)Enum.Parse(typeof(StoryStateEnum), e.current_state, true), Description = e.description, Estimate = e.estimate, Id = e.id, Name = e.name, //Notes = OwnedBy = e.owned_by, ProjectId = e.project_id, RequestedBy = e.requested_by, //Tasks = Type = (StoryTypeEnum)Enum.Parse(typeof(StoryTypeEnum), e.story_type, true), Url = new Uri(e.url) }; if (e.labels != null) { foreach (var label in e.labels) { lStory.Labels.Add(new Label { CreatedDate = label.created_at, Id = label.id, Name = label.name, UpdatedDate = label.updated_at }); } } if (e.attachments != null) { foreach (var attachment in e.attachments) { lStory.Attachments.Add(attachment); } } if (e.notes != null) { foreach (var note in e.notes) { lStory.Notes.Add(new Note() { Id = note.id, Author = note.author, Description = note.text, NoteDate = note.noted_at }); } } if (e.tasks != null) { foreach (var task in e.tasks) { lStory.Tasks.Add(task); } } return(lStory); }