コード例 #1
0
        /// <summary>
        /// 将<see cref="SCBase"/>添加到<paramref name="targetOrg"/>
        /// </summary>
        /// <param name="orginalOrg">移动人员时必须指定此参数,表示人员的原始组织。</param>
        /// <param name="obj">表示要进行组织移动的对象</param>
        /// <param name="targetOrg">表示要将对象移动到其中的组织</param>
        /// <returns></returns>
        public SCRelationObject MoveObjectToOrganization(SCOrganization orginalOrg, SCBase obj, SCOrganization targetOrg)
        {
            SCMoveObjectExecutor executor = new SCMoveObjectExecutor(SCOperationType.MoveObject, orginalOrg, obj, targetOrg)
            {
                NeedStatusCheck = this.NeedValidationAndStatusCheck
            };

            if (orginalOrg != null)
            {
                CheckPermissions(SCOperationType.MoveObject, orginalOrg.Schema, "DeleteChildren", orginalOrg.ID);
            }

            CheckPermissions(SCOperationType.MoveObject, targetOrg.Schema, "AddChildren", targetOrg.ID);

            SCRelationObject result = null;

            ExecuteWithActions(SCOperationType.MoveObject, () => SCActionContext.Current.DoActions(() => result = (SCRelationObject)executor.Execute()));

            return(result);
        }
コード例 #2
0
		/// <summary>
		/// 将<see cref="SCBase"/>添加到<paramref name="targetOrg"/>
		/// </summary>
		/// <param name="orginalOrg">移动人员时必须指定此参数,表示人员的原始组织。</param>
		/// <param name="obj">表示要进行组织移动的对象</param>
		/// <param name="targetOrg">表示要将对象移动到其中的组织</param>
		/// <returns></returns>
		public SCRelationObject MoveObjectToOrganization(SCOrganization orginalOrg, SCBase obj, SCOrganization targetOrg)
		{
			SCMoveObjectExecutor executor = new SCMoveObjectExecutor(SCOperationType.MoveObject, orginalOrg, obj, targetOrg) { NeedStatusCheck = this.NeedValidationAndStatusCheck };

			if (orginalOrg != null)
				CheckPermissions(SCOperationType.MoveObject, orginalOrg.Schema, "DeleteChildren", orginalOrg.ID);

			CheckPermissions(SCOperationType.MoveObject, targetOrg.Schema, "AddChildren", targetOrg.ID);

			SCRelationObject result = null;

			ExecuteWithActions(SCOperationType.MoveObject, () => SCActionContext.Current.DoActions(() => result = (SCRelationObject)executor.Execute()));

			return result;
		}