Esempio n. 1
0
        public SchemaObjectBase ChangeOwner(SCBase obj, SCOrganization targetOrg)
        {
            SCChangeOwnerExecutor executor = new SCChangeOwnerExecutor(SCOperationType.ChangeOwner, obj, targetOrg)
            {
                NeedStatusCheck = this.NeedValidationAndStatusCheck
            };

            if (this._NeedCheckPermissions)
            {
                CheckPermissions(SCOperationType.ChangeOwner, SchemaDefine.GetSchema("Organizations"), "DeleteChildren", obj.Properties.GetValue("OwnerID", string.Empty));
                CheckPermissions(SCOperationType.ChangeOwner, targetOrg.Schema, "AddChildren", targetOrg.ID);
            }

            SchemaObjectBase result = null;

            ExecuteWithActions(SCOperationType.ChangeOwner, () => SCActionContext.Current.DoActions(() => result = (SchemaObjectBase)executor.Execute()));

            return(result);
        }
		public SchemaObjectBase ChangeOwner(SCBase obj, SCOrganization targetOrg)
		{
			SCChangeOwnerExecutor executor = new SCChangeOwnerExecutor(SCOperationType.ChangeOwner, obj, targetOrg) { NeedStatusCheck = this.NeedValidationAndStatusCheck };

			if (this._NeedCheckPermissions)
			{
				CheckPermissions(SCOperationType.ChangeOwner, SchemaDefine.GetSchema("Organizations"), "DeleteChildren", obj.Properties.GetValue("OwnerID", string.Empty));
				CheckPermissions(SCOperationType.ChangeOwner, targetOrg.Schema, "AddChildren", targetOrg.ID);
			}

			SchemaObjectBase result = null;

			ExecuteWithActions(SCOperationType.ChangeOwner, () => SCActionContext.Current.DoActions(() => result = (SchemaObjectBase)executor.Execute()));

			return result;
		}