protected override void OnPreRender(EventArgs e) { this.spObjName.InnerText = string.Format("{0}({1})", this.Object.Name, this.Object.VisibleName); this.RenderInitJson(); if (TimePointContext.Current.UseCurrentTime && Util.SuperVisiorMode == false) { AU.AUCommon.DoDbAction(() => this.allParents = PC.Adapters.SchemaRelationObjectAdapter.Instance.LoadByObjectID(this.Object.ID)); var parentSet = new HashSet <string>(); foreach (var item in this.allParents) { if (item.Status == SchemaObjectStatus.Normal) { parentSet.Add(item.ParentID); } } this.containerPermissions = AU.Adapters.AUAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, parentSet); } base.OnPreRender(e); }
public DeleteSelfAction(SchemaObjectBase item) { this.item = item; item.ClearRelativeData(); this.parentRelations = item.CurrentParentRelations; this.containerRelations = SCMemberRelationAdapter.Instance.LoadByMemberID(item.ID).FilterByStatus(SchemaObjectStatusFilterTypes.Normal); }
public SCOrganizationRelativeExecutor(SCOperationType opType, SCOrganization parent, SCBase data) : base(opType, data) { parent.NullCheck("organization"); data.ClearRelativeData(); parent.ClearRelativeData(); this._Parent = parent; this._Relation = PrepareRelationObject(parent, data); if (this.OperationType == SCOperationType.AddOrganization) { this._AclContainer = PrepareAclContainer(parent, data); } if (data is SCUser) { this._TargetParentRelations = data.CurrentParentRelations; if (this.OperationType == SCOperationType.AddUser && this._TargetParentRelations.Count == 0) { SCUser user = (SCUser)data; user.OwnerID = parent.ID; user.OwnerName = parent.Properties.GetValue("Name", string.Empty); } } }
public SCOrganizationRelativeExecutor(SCOperationType opType, SCOrganization parent, SCBase data) : base(opType, data) { parent.NullCheck("organization"); data.ClearRelativeData(); parent.ClearRelativeData(); this._Parent = parent; this._Relation = PrepareRelationObject(parent, data); if (this.OperationType == SCOperationType.AddOrganization) this._AclContainer = PrepareAclContainer(parent, data); if (data is SCUser) { this._TargetParentRelations = data.CurrentParentRelations; if (this.OperationType == SCOperationType.AddUser && this._TargetParentRelations.Count == 0) { SCUser user = (SCUser)data; user.OwnerID = parent.ID; user.OwnerName = parent.Properties.GetValue("Name", string.Empty); } } }
/// <summary> /// 获取最接近的父级(Schema或者另一个Unit) /// </summary> /// <returns></returns> public SCRelationObject GetCurrentVeryParentRelation() { SCRelationObject result = null; SCParentsRelationObjectCollection parents = null; AUCommon.DoDbAction(() => { parents = PC.Adapters.SchemaRelationObjectAdapter.Instance.LoadByObjectID(this.ID); }); result = FindActualParent(result, parents); return(result); }
private static SCRelationObject FindActualParent(SCRelationObject result, SCParentsRelationObjectCollection parents) { SCRelationObject toSchema = null, toUnit = null; foreach (SCRelationObject r in parents) { if (r.ParentSchemaType == AUCommon.SchemaAUSchema) { if (toSchema == null || r.Status == SchemaObjectStatus.Normal) { toSchema = r; } } else if (r.ParentSchemaType == AUCommon.SchemaAdminUnit) { if (toUnit == null || r.Status == SchemaObjectStatus.Normal) { toUnit = r; } } } if (toSchema == null && toUnit != null) { result = toUnit; } else if (toUnit == null && toSchema != null) { result = toSchema; } else if (toUnit == null && toSchema == null) { result = null; } else if (toUnit.Status == SchemaObjectStatus.Normal && toSchema.Status == SchemaObjectStatus.Normal) { throw new AUObjectValidationException("管理单元存在错误的关系"); } else if (toUnit.Status == SchemaObjectStatus.Normal) { result = toUnit; } else { result = toSchema; } return(result); }
private static SCRelationObject FindActualParent(SCRelationObject result, SCParentsRelationObjectCollection parents) { SCRelationObject toSchema = null, toUnit = null; foreach (SCRelationObject r in parents) { if (r.ParentSchemaType == AUCommon.SchemaAUSchema) { if (toSchema == null || r.Status == SchemaObjectStatus.Normal) toSchema = r; } else if (r.ParentSchemaType == AUCommon.SchemaAdminUnit) { if (toUnit == null || r.Status == SchemaObjectStatus.Normal) toUnit = r; } } if (toSchema == null && toUnit != null) result = toUnit; else if (toUnit == null && toSchema != null) result = toSchema; else if (toUnit == null && toSchema == null) result = null; else if (toUnit.Status == SchemaObjectStatus.Normal && toSchema.Status == SchemaObjectStatus.Normal) throw new AUObjectValidationException("管理单元存在错误的关系"); else if (toUnit.Status == SchemaObjectStatus.Normal) result = toUnit; else result = toSchema; return result; }
protected override void OnPreRender(EventArgs e) { this.spObjName.InnerText = string.Format("{0}({1})", this.Object.Name, this.Object.VisibleName); this.RenderInitJson(); if (TimePointContext.Current.UseCurrentTime && Util.SuperVisiorMode == false) { AU.AUCommon.DoDbAction(() => this.allParents = PC.Adapters.SchemaRelationObjectAdapter.Instance.LoadByObjectID(this.Object.ID)); var parentSet = new HashSet<string>(); foreach (var item in this.allParents) { if (item.Status == SchemaObjectStatus.Normal) { parentSet.Add(item.ParentID); } } this.containerPermissions = AU.Adapters.AUAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, parentSet); } base.OnPreRender(e); }