Inheritance: System.Data.Objects.DataClasses.EntityObject
Esempio n. 1
0
 internal static void Map(HourData source, Hour destination)
 {
     destination.HourId = source.HourId;
     destination.Date = source.Date;
     destination.Duration = source.Duration;
     destination.IsArchived = source.IsArchived;
     destination.Notes = source.Notes;
     destination.StoryId = source.StoryId;
     destination.UserId = source.UserId;
     destination.CreatedBy = source.CreatedBy;
     destination.CreatedDate = source.CreatedDate;
     destination.ModifiedBy = source.ModifiedBy;
     destination.ModifiedDate = source.ModifiedDate;
 }
Esempio n. 2
0
        public HourData Insert(HourData data)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                           .GetManager(Database.ApplicationConnection, false))
            {
                var hour = new Hour();

                DataMapper.Map(data, hour);

                ctx.ObjectContext.AddToHours(hour);

                ctx.ObjectContext.SaveChanges();

                data.HourId = hour.HourId;

                return data;
            }
        }
Esempio n. 3
0
        private void Fetch(Hour hour, HourData hourData)
        {
            DataMapper.Map(hour, hourData);

            hourData.Project = new ProjectData();
            hourData.ProjectId = hour.Story.ProjectId;
            DataMapper.Map(hour.Story.Project, hourData.Project);

            hourData.Sprint = new SprintData();
            if (hourData.SprintId != 0)
            {
                DataMapper.Map(hour.Story.Sprint, hourData.Sprint);
            }

            hourData.Story = new StoryData();
            DataMapper.Map(hour.Story, hourData.Story);

            hourData.User = new UserData();
            DataMapper.Map(hour.User, hourData.User);

            hourData.CreatedByUser = new UserData();
            DataMapper.Map(hour.CreatedByUser, hourData.CreatedByUser);

            hourData.ModifiedByUser = new UserData();
            DataMapper.Map(hour.ModifiedByUser, hourData.ModifiedByUser);
        }
Esempio n. 4
0
        public HourData Update(HourData data)
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                         .GetManager(Database.ApplicationConnection, false))
            {
                var hour =
                    new Hour
                    {
                        HourId = data.HourId
                    };

                ctx.ObjectContext.Hours.Attach(hour);

                DataMapper.Map(data, hour);

                ctx.ObjectContext.SaveChanges();

                return data;
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Hours EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToHours(Hour hour)
 {
     base.AddObject("Hours", hour);
 }
 /// <summary>
 /// Create a new Hour object.
 /// </summary>
 /// <param name="hourId">Initial value of the HourId property.</param>
 /// <param name="date">Initial value of the Date property.</param>
 /// <param name="duration">Initial value of the Duration property.</param>
 /// <param name="isArchived">Initial value of the IsArchived property.</param>
 /// <param name="notes">Initial value of the Notes property.</param>
 /// <param name="storyId">Initial value of the StoryId property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 /// <param name="modifiedBy">Initial value of the ModifiedBy property.</param>
 /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param>
 public static Hour CreateHour(global::System.Int32 hourId, global::System.DateTime date, global::System.Decimal duration, global::System.Boolean isArchived, global::System.String notes, global::System.Int32 storyId, global::System.Int32 userId, global::System.Int32 createdBy, global::System.DateTime createdDate, global::System.Int32 modifiedBy, global::System.DateTime modifiedDate)
 {
     Hour hour = new Hour();
     hour.HourId = hourId;
     hour.Date = date;
     hour.Duration = duration;
     hour.IsArchived = isArchived;
     hour.Notes = notes;
     hour.StoryId = storyId;
     hour.UserId = userId;
     hour.CreatedBy = createdBy;
     hour.CreatedDate = createdDate;
     hour.ModifiedBy = modifiedBy;
     hour.ModifiedDate = modifiedDate;
     return hour;
 }