Exemplo n.º 1
0
        internal static HourInfo FetchHourInfo(Data.Hour data)
        {
            var result = new HourInfo();

            result.Fetch(data);
            return(result);
        }
Exemplo n.º 2
0
        protected void Insert(Data.Hour data)
        {
            data.HourId      = this.ReadProperty(HourIdProperty);
            data.CreatedBy   = ((BusinessIdentity)Csla.ApplicationContext.User.Identity).UserId;
            data.CreatedDate = DateTime.Now;

            this.Update(data);
        }
Exemplo n.º 3
0
        protected override void DataPortal_DeleteSelf()
        {
            using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities>
                             .GetManager(Database.ApplicationConnection, false))
            {
                var data = new Data.Hour
                {
                    HourId = this.ReadProperty(HourIdProperty)
                };

                ctx.ObjectContext.Hours.DeleteObject(data);

                ctx.ObjectContext.SaveChanges();
            }
        }
Exemplo n.º 4
0
        protected override void DataPortal_DeleteSelf()
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                        .GetManager(Database.ApplicationConnection, false))
            {
                var data = new Data.Hour
                {
                    HourId = this.ReadProperty(HourIdProperty)
                };

                ctx.ObjectContext.Hours.DeleteObject(data);

                ctx.ObjectContext.SaveChanges();
            }
        }
Exemplo n.º 5
0
 protected void Update(Data.Hour data)
 {
     if (this.IsSelfDirty)
     {
         data.ProjectId    = this.ReadProperty(ProjectIdProperty);
         data.TaskId       = this.ReadProperty(TaskIdProperty);
         data.UserId       = this.ReadProperty(UserIdProperty);
         data.Date         = this.ReadProperty(DateProperty);
         data.Duration     = this.ReadProperty(DurationProperty);
         data.Labels       = this.ReadProperty(LabelsProperty);
         data.IsArchived   = this.ReadProperty(IsArchivedProperty);
         data.Notes        = this.ReadProperty(NotesProperty);
         data.ModifiedBy   = ((BusinessIdentity)Csla.ApplicationContext.User.Identity).UserId;
         data.ModifiedDate = DateTime.Now;
     }
 }
Exemplo n.º 6
0
        protected override void DataPortal_Insert()
        {
            using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities>
                             .GetManager(Database.ApplicationConnection, false))
            {
                var data = new Data.Hour();

                this.Insert(data);

                ctx.ObjectContext.AddToHours(data);

                ctx.ObjectContext.SaveChanges();

                this.LoadProperty(HourIdProperty, data.HourId);
                this.LoadProperty(CreatedByProperty, data.CreatedBy);
                this.LoadProperty(CreatedDateProperty, data.CreatedDate);
            }
        }
Exemplo n.º 7
0
        protected override void DataPortal_Insert()
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                        .GetManager(Database.ApplicationConnection, false))
            {
                var data = new Data.Hour();

                this.Insert(data);

                ctx.ObjectContext.AddToHours(data);

                ctx.ObjectContext.SaveChanges();

                this.LoadProperty(HourIdProperty, data.HourId);
                this.LoadProperty(CreatedByProperty, data.CreatedBy);
                this.LoadProperty(CreatedDateProperty, data.CreatedDate);
            }
        }
Exemplo n.º 8
0
        protected override void DataPortal_Update()
        {
            using (var ctx = Csla.Data.ObjectContextManager <ApplicationEntities>
                             .GetManager(Database.ApplicationConnection, false))
            {
                var data = new Data.Hour
                {
                    HourId = this.ReadProperty(HourIdProperty)
                };

                ctx.ObjectContext.Hours.Attach(data);

                this.Update(data);

                ctx.ObjectContext.SaveChanges();

                this.LoadProperty(ModifiedByProperty, data.ModifiedBy);
                this.LoadProperty(ModifiedDateProperty, data.ModifiedDate);
            }
        }
Exemplo n.º 9
0
        protected override void DataPortal_Update()
        {
            using (var ctx = Csla.Data.ObjectContextManager<ApplicationEntities>
                        .GetManager(Database.ApplicationConnection, false))
            {
                var data = new Data.Hour
                {
                    HourId = this.ReadProperty(HourIdProperty)
                };

                ctx.ObjectContext.Hours.Attach(data);

                this.Update(data);

                ctx.ObjectContext.SaveChanges();

                this.LoadProperty(ModifiedByProperty, data.ModifiedBy);
                this.LoadProperty(ModifiedDateProperty, data.ModifiedDate);
            }
        }
Exemplo n.º 10
0
 protected void Fetch(Data.Hour data)
 {
     this.LoadProperty(HourIdProperty, data.HourId);
     this.LoadProperty(ProjectIdProperty, data.ProjectId);
     this.LoadProperty(ProjectNameProperty, data.Project.Name);
     this.LoadProperty(TaskIdProperty, data.TaskId);
     this.LoadProperty(TaskNameProperty, data.TaskName);
     this.LoadProperty(UserProperty, UserInfo.FetchUserInfo(data.User));
     this.LoadProperty(UserIdProperty, data.UserId);
     this.LoadProperty(UserNameProperty, data.User.Name);
     this.LoadProperty(DateProperty, data.Date);
     this.LoadProperty(DurationProperty, data.Duration);
     this.LoadProperty(LabelsProperty, data.Labels);
     this.LoadProperty(IsArchivedProperty, data.IsArchived);
     this.LoadProperty(NotesProperty, data.Notes);
     this.LoadProperty(ModifiedByProperty, data.ModifiedBy);
     this.LoadProperty(ModifiedByNameProperty, data.ModifiedByUser.Name);
     this.LoadProperty(ModifiedDateProperty, data.ModifiedDate);
     this.LoadProperty(CreatedByProperty, data.CreatedBy);
     this.LoadProperty(CreatedByNameProperty, data.CreatedByUser.Name);
     this.LoadProperty(CreatedDateProperty, data.CreatedDate);
 }