コード例 #1
0
ファイル: DsdSet.cs プロジェクト: mingkongbin/anycmd
 public void Update(IDsdSetUpdateIo input)
 {
     this.Description = input.Description;
     this.IsEnabled = input.IsEnabled;
     this.Name = input.Name;
     this.DsdCard = input.DsdCard;
 }
コード例 #2
0
ファイル: DsdSet.cs プロジェクト: HuZeHua/InternetDemo
 public void Update(IDsdSetUpdateIo input)
 {
     this.Description = input.Description;
     this.IsEnabled   = input.IsEnabled;
     this.Name        = input.Name;
     this.DsdCard     = input.DsdCard;
 }
コード例 #3
0
ファイル: Events.cs プロジェクト: HuZeHua/InternetDemo
 public DsdSetUpdatedEvent(IAcSession acSession, DsdSetBase source, IDsdSetUpdateIo output)
     : base(acSession, source)
 {
     if (output == null)
     {
         throw new System.ArgumentNullException("output");
     }
     this.Output = output;
 }
コード例 #4
0
 public DsdSetUpdatedEvent(IAcSession acSession, DsdSetBase source, IDsdSetUpdateIo output)
     : base(acSession, source)
 {
     if (output == null)
     {
         throw new System.ArgumentNullException("output");
     }
     this.Output = output;
 }
コード例 #5
0
ファイル: Events.cs プロジェクト: HuZeHua/InternetDemo
 internal DsdSetUpdatedEvent(IAcSession acSession, DsdSetBase source, IDsdSetUpdateIo input, bool isPrivate)
     : this(acSession, source, input)
 {
     this.IsPrivate = isPrivate;
 }
コード例 #6
0
ファイル: DsdSetSet.cs プロジェクト: zszqwe/anycmd
            private void Handle(IAcSession acSession, IDsdSetUpdateIo input, bool isCommand)
            {
                var         acDomain         = _set._acDomain;
                var         dsdSetRepository = acDomain.RetrieveRequiredService <IRepository <DsdSet> >();
                DsdSetState bkState;

                if (!acDomain.DsdSetSet.TryGetDsdSet(input.Id, out bkState))
                {
                    throw new NotExistException();
                }
                DsdSet entity;
                bool   stateChanged;

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

                    entity.Update(input);

                    var newState = DsdSetState.Create(entity);
                    stateChanged = newState != bkState;
                    if (stateChanged)
                    {
                        Update(newState);
                    }
                    if (isCommand)
                    {
                        try
                        {
                            dsdSetRepository.Update(entity);
                            dsdSetRepository.Context.Commit();
                        }
                        catch
                        {
                            if (stateChanged)
                            {
                                Update(bkState);
                            }
                            dsdSetRepository.Context.Rollback();
                            throw;
                        }
                    }
                }
                if (isCommand && stateChanged)
                {
                    acDomain.MessageDispatcher.DispatchMessage(new DsdSetUpdatedEvent(acSession, entity, input, isPrivate: true));
                }
            }
コード例 #7
0
 internal DsdSetUpdatedEvent(IAcSession acSession, DsdSetBase source, IDsdSetUpdateIo input, bool isPrivate)
     : this(acSession, source, input)
 {
     this.IsPrivate = isPrivate;
 }