/// <summary> /// Create a new Story object. /// </summary> /// <param name="storyId">Initial value of the StoryId property.</param> /// <param name="assignedTo">Initial value of the AssignedTo property.</param> /// <param name="assignedDate">Initial value of the AssignedDate property.</param> /// <param name="completedDate">Initial value of the CompletedDate property.</param> /// <param name="description">Initial value of the Description property.</param> /// <param name="duration">Initial value of the Duration property.</param> /// <param name="estimatedCompletedDate">Initial value of the EstimatedCompletedDate property.</param> /// <param name="estimatedDuration">Initial value of the EstimatedDuration property.</param> /// <param name="isArchived">Initial value of the IsArchived property.</param> /// <param name="isCompleted">Initial value of the IsCompleted property.</param> /// <param name="projectId">Initial value of the ProjectId property.</param> /// <param name="sprintId">Initial value of the SprintId property.</param> /// <param name="startDate">Initial value of the StartDate property.</param> /// <param name="statusId">Initial value of the StatusId property.</param> /// <param name="modifiedBy">Initial value of the ModifiedBy property.</param> /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param> /// <param name="createdBy">Initial value of the CreatedBy property.</param> /// <param name="createdDate">Initial value of the CreatedDate property.</param> public static Story CreateStory(global::System.Int32 storyId, global::System.Int32 assignedTo, global::System.DateTime assignedDate, global::System.DateTime completedDate, global::System.String description, global::System.Decimal duration, global::System.DateTime estimatedCompletedDate, global::System.Decimal estimatedDuration, global::System.Boolean isArchived, global::System.Boolean isCompleted, global::System.Int32 projectId, global::System.Int32 sprintId, global::System.DateTime startDate, global::System.Int32 statusId, global::System.Int32 modifiedBy, global::System.DateTime modifiedDate, global::System.Int32 createdBy, global::System.DateTime createdDate) { Story story = new Story(); story.StoryId = storyId; story.AssignedTo = assignedTo; story.AssignedDate = assignedDate; story.CompletedDate = completedDate; story.Description = description; story.Duration = duration; story.EstimatedCompletedDate = estimatedCompletedDate; story.EstimatedDuration = estimatedDuration; story.IsArchived = isArchived; story.IsCompleted = isCompleted; story.ProjectId = projectId; story.SprintId = sprintId; story.StartDate = startDate; story.StatusId = statusId; story.ModifiedBy = modifiedBy; story.ModifiedDate = modifiedDate; story.CreatedBy = createdBy; story.CreatedDate = createdDate; return story; }
/// <summary> /// Deprecated Method for adding a new object to the Stories EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToStories(Story story) { base.AddObject("Stories", story); }
public StoryData Insert(StoryData data) { using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var story = new Story(); DataMapper.Map(data, story); ctx.ObjectContext.AddToStories(story); ctx.ObjectContext.SaveChanges(); data.StoryId = story.StoryId; return data; } }
private void Fetch(Story story, StoryData storyData) { DataMapper.Map(story, storyData); storyData.AssignedToUser = new UserData(); if (story.AssignedTo != 0) { DataMapper.Map(story.AssignedToUser, storyData.AssignedToUser); } storyData.Project = new ProjectData(); DataMapper.Map(story.Project, storyData.Project); storyData.Sprint = new SprintData(); if (story.SprintId != 0) { DataMapper.Map(story.Sprint, storyData.Sprint); } storyData.Status = new StatusData(); storyData.IsOpened = story.Status.IsStarted; storyData.IsCompleted = story.Status.IsCompleted; DataMapper.Map(story.Status, storyData.Status); storyData.CreatedByUser = new UserData(); DataMapper.Map(story.CreatedByUser, storyData.CreatedByUser); storyData.ModifiedByUser = new UserData(); DataMapper.Map(story.ModifiedByUser, storyData.ModifiedByUser); }
public StoryData Update(StoryData data) { using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities> .GetManager(Database.ApplicationConnection, false)) { var story = new Story { StoryId = data.StoryId }; ctx.ObjectContext.Stories.Attach(story); DataMapper.Map(data, story); ctx.ObjectContext.SaveChanges(); return data; } }
internal static void Map(StoryData source, Story destination) { destination.StoryId = source.StoryId; destination.AssignedTo = source.AssignedTo; destination.AssignedDate = source.AssignedDate; destination.CompletedDate = source.CompletedDate; destination.Description = source.Description; destination.Duration = source.Duration; destination.EstimatedCompletedDate = source.EstimatedCompletedDate; destination.EstimatedDuration = source.EstimatedDuration; destination.IsArchived = source.IsArchived; destination.IsCompleted = source.IsCompleted; destination.ProjectId = source.ProjectId; destination.SprintId = source.SprintId; destination.StartDate = source.StartDate; destination.StatusId = source.StatusId; destination.ModifiedBy = source.ModifiedBy; destination.ModifiedDate = source.ModifiedDate; destination.CreatedBy = source.CreatedBy; destination.CreatedDate = source.CreatedDate; }