Ejemplo n.º 1
0
        protected override void OnSaving()
        {
            if (WorkItem.State == null)
            {
                return;
            }
            base.OnSaving();
            DynamicEntity.ObjectId   = EntityId;
            DynamicEntity.ObjectType = ObjectType;
            var parentEntity  = DynamicDataServiceContext.GetOrNew(ObjectType, EntityId);
            var dynamicEntity = new SysBits.Reflection.ReflectionProxy(parentEntity);

            dynamicEntity.TrySetProperty("ModifiedById", AuthorizationManager.CurrentUserId);
            dynamicEntity.TrySetProperty("ModifiedOn", DateTime.Now);
            if (View.AppandDescription)
            {
                object description;
                if (dynamicEntity.TryGetProperty("Description", out description))
                {
                    string appandedDescription = description != null
                                                    ? description.ToString() + DynamicEntity.NoteText
                                                    : DynamicEntity.NoteText;

                    dynamicEntity.SetProperty("Description", appandedDescription);
                    DynamicDataServiceContext.UpdateObject(parentEntity);
                }
            }
            if (View.UpdateLatestFeadback)
            {
                object latestFeedbackOn;
                if (dynamicEntity.TryGetProperty("LatestFeedbackOn", out latestFeedbackOn))
                {
                    dynamicEntity.SetProperty("LatestFeedbackOn", DateTime.Now);
                    DynamicDataServiceContext.UpdateObject(parentEntity);
                }
            }
        }