Пример #1
0
 public UiViewUpdatedEvent(IAcSession acSession, UiViewBase source, IUiViewUpdateIo input)
     : base(acSession, source)
 {
     if (input == null)
     {
         throw new System.ArgumentNullException("input");
     }
     this.Input = input;
 }
Пример #2
0
            private void Handle(IAcSession acSession, IUiViewUpdateIo input, bool isCommand)
            {
                var         acDomain       = _set._acDomain;
                var         viewRepository = acDomain.RetrieveRequiredService <IRepository <UiView> >();
                UiViewState bkState;

                if (!acDomain.UiViewSet.TryGetUiView(input.Id, out bkState))
                {
                    throw new NotExistException();
                }
                UiView entity;
                var    stateChanged = false;

                lock (Locker)
                {
                    UiViewState state;
                    if (!acDomain.UiViewSet.TryGetUiView(input.Id, out state))
                    {
                        throw new NotExistException();
                    }
                    entity = viewRepository.GetByKey(input.Id);
                    if (entity == null)
                    {
                        throw new NotExistException();
                    }

                    entity.Update(input);

                    var newState = UiViewState.Create(acDomain, entity);
                    stateChanged = newState != bkState;
                    if (stateChanged)
                    {
                        Update(newState);
                    }
                    if (isCommand)
                    {
                        try
                        {
                            viewRepository.Update(entity);
                            viewRepository.Context.Commit();
                        }
                        catch
                        {
                            if (stateChanged)
                            {
                                Update(bkState);
                            }
                            viewRepository.Context.Rollback();
                            throw;
                        }
                    }
                }
                if (isCommand && stateChanged)
                {
                    acDomain.MessageDispatcher.DispatchMessage(new UiViewUpdatedEvent(acSession, entity, input, isPrivate: true));
                }
            }
Пример #3
0
 public UiViewUpdatedEvent(IAcSession acSession, UiViewBase source, IUiViewUpdateIo input)
     : base(acSession, source)
 {
     if (input == null)
     {
         throw new System.ArgumentNullException("input");
     }
     this.Input = input;
 }
Пример #4
0
 internal UiViewUpdatedEvent(IAcSession acSession, UiViewBase source, IUiViewUpdateIo input, bool isPrivate)
     : this(acSession, source, input)
 {
     this.IsPrivate = isPrivate;
 }
Пример #5
0
 internal UiViewUpdatedEvent(IAcSession acSession, UiViewBase source, IUiViewUpdateIo input, bool isPrivate)
     : this(acSession, source, input)
 {
     this.IsPrivate = isPrivate;
 }
Пример #6
0
 public void Update(IUiViewUpdateIo input)
 {
     this.Tooltip = input.Tooltip;
     this.Icon = input.Icon;
 }
Пример #7
0
 public void Update(IUiViewUpdateIo input)
 {
     this.Tooltip = input.Tooltip;
     this.Icon    = input.Icon;
 }