Ejemplo n.º 1
0
        public void ChangePositionInfo(string operationUserId, PositionChangeInfo changeInfo)
        {
            User     opUser   = this.OrganizationManager.UserManager.GetUserById(operationUserId);
            Position position = this.OrganizationManager.PositionManager.GetPositionById(changeInfo.ID);

            position.Change(opUser, changeInfo);
        }
Ejemplo n.º 2
0
        public virtual void Change(User operationUser, PositionChangeInfo changeInfo)
        {
            if (operationUser == null)
            {
                throw new ArgumentNullException("operationUser");
            }
            if (string.IsNullOrWhiteSpace(changeInfo.Name))
            {
                throw new ArgumentNullException("name");
            }
            if (changeInfo.ParentId == this.ID)
            {
                throw new PositionParentCannotSelfException();
            }

            if (this.Parent != null && changeInfo.Name != this.Name)
            {
                Position position = this.Parent.Children.FirstOrDefault(x => x.Name == changeInfo.Name);
                if (position != null)
                {
                    throw new PositionNameReapeatException();
                }
            }

            if (this.Changing != null)
            {
                this.Changing(this, changeInfo);
            }

            this.Name     = changeInfo.Name;
            this.Remark   = changeInfo.Remark;
            this.ParentId = changeInfo.ParentId;
            this.Parent   = null;

            if (this.Changed != null)
            {
                this.Changed(this, changeInfo);
            }
        }