예제 #1
0
 public void Update(ISsdSetUpdateIo input)
 {
     this.Description = input.Description;
     this.IsEnabled = input.IsEnabled;
     this.Name = input.Name;
     this.SsdCard = input.SsdCard;
 }
예제 #2
0
 public void Update(ISsdSetUpdateIo input)
 {
     this.Description = input.Description;
     this.IsEnabled   = input.IsEnabled;
     this.Name        = input.Name;
     this.SsdCard     = input.SsdCard;
 }
예제 #3
0
 public SsdSetUpdatedEvent(IAcSession acSession, SsdSetBase source, ISsdSetUpdateIo output)
     : base(acSession, source)
 {
     if (output == null)
     {
         throw new System.ArgumentNullException("output");
     }
     this.Output = output;
 }
예제 #4
0
 public SsdSetUpdatedEvent(IAcSession acSession, SsdSetBase source, ISsdSetUpdateIo output)
     : base(acSession, source)
 {
     if (output == null)
     {
         throw new System.ArgumentNullException("output");
     }
     this.Output = output;
 }
예제 #5
0
 internal SsdSetUpdatedEvent(IAcSession acSession, SsdSetBase source, ISsdSetUpdateIo input, bool isPrivate)
     : this(acSession, source, input)
 {
     this.IsPrivate = isPrivate;
 }
예제 #6
0
            private void Handle(IAcSession acSession, ISsdSetUpdateIo input, bool isCommand)
            {
                var         acDomain         = _set._acDomain;
                var         ssdSetDic        = _set._ssdSetDic;
                var         ssdSetRepository = acDomain.RetrieveRequiredService <IRepository <SsdSet, Guid> >();
                SsdSetState bkState;

                if (!acDomain.SsdSetSet.TryGetSsdSet(input.Id, out bkState))
                {
                    throw new NotExistException();
                }
                SsdSet entity;
                var    stateChanged = false;

                lock (Locker)
                {
                    SsdSetState oldState;
                    if (!acDomain.SsdSetSet.TryGetSsdSet(input.Id, out oldState))
                    {
                        throw new NotExistException();
                    }
                    if (acDomain.SsdSetSet.Any(a => a.Name.Equals(input.Name, StringComparison.OrdinalIgnoreCase) && a.Id != input.Id))
                    {
                        throw new ValidationException("重复的静态责任分离角色组名");
                    }
                    entity = ssdSetRepository.GetByKey(input.Id);
                    if (entity == null)
                    {
                        throw new NotExistException();
                    }

                    entity.Update(input);

                    var newState = SsdSetState.Create(entity);
                    stateChanged = newState != bkState;
                    if (stateChanged)
                    {
                        Update(newState);
                    }
                    if (isCommand)
                    {
                        try
                        {
                            ssdSetRepository.Update(entity);
                            ssdSetRepository.Context.Commit();
                        }
                        catch
                        {
                            if (stateChanged)
                            {
                                Update(bkState);
                            }
                            ssdSetRepository.Context.Rollback();
                            throw;
                        }
                    }
                }
                if (isCommand && stateChanged)
                {
                    acDomain.MessageDispatcher.DispatchMessage(new SsdSetUpdatedEvent(acSession, entity, input, isPrivate: true));
                }
            }
예제 #7
0
 internal SsdSetUpdatedEvent(IAcSession acSession, SsdSetBase source, ISsdSetUpdateIo input, bool isPrivate)
     : this(acSession, source, input)
 {
     this.IsPrivate = isPrivate;
 }