/// <summary> /// 替换对象的图片属性 /// </summary> /// <param name="obj"></param> /// <param name="propertyName"></param> /// <param name="image"></param> /// <returns></returns> public SchemaObjectBase UpdateObjectImageProperty(SchemaObjectBase obj, string propertyName, ImageProperty image) { SCUpdateObjectImageExecutor executor = new SCUpdateObjectImageExecutor(SCOperationType.UpdateObjectImage, obj, propertyName, image) { NeedStatusCheck = true }; string ownerID = obj.Properties.GetValue("OwnerID", string.Empty); if (ownerID.IsNotEmpty()) { if (this._NeedCheckPermissions) { CheckPermissions(SCOperationType.UpdateObjectImage, SchemaDefine.GetSchema("Organizations"), "UpdateChildren", ownerID); } } else { if (this._NeedCheckPermissions) { CheckOrganizationChildrenPermissions(SCOperationType.UpdateObjectImage, "UpdateChildren", obj); } } SchemaObjectBase result = null; ExecuteWithActions(SCOperationType.UpdateObjectImage, () => SCActionContext.Current.DoActions(() => result = (SchemaObjectBase)executor.Execute())); return(result); }
/// <summary> /// 替换对象的图片属性 /// </summary> /// <param name="obj"></param> /// <param name="propertyName"></param> /// <param name="image"></param> /// <returns></returns> public SchemaObjectBase UpdateObjectImageProperty(SchemaObjectBase obj, string propertyName, ImageProperty image) { SCUpdateObjectImageExecutor executor = new SCUpdateObjectImageExecutor(SCOperationType.UpdateObjectImage, obj, propertyName, image) { NeedStatusCheck = true }; string ownerID = obj.Properties.GetValue("OwnerID", string.Empty); if (ownerID.IsNotEmpty()) { if (this._NeedCheckPermissions) CheckPermissions(SCOperationType.UpdateObjectImage, SchemaDefine.GetSchema("Organizations"), "UpdateChildren", ownerID); } else { if (this._NeedCheckPermissions) CheckOrganizationChildrenPermissions(SCOperationType.UpdateObjectImage, "UpdateChildren", obj); } SchemaObjectBase result = null; ExecuteWithActions(SCOperationType.UpdateObjectImage, () => SCActionContext.Current.DoActions(() => result = (SchemaObjectBase)executor.Execute())); return result; }