本文整理汇总了C#中Operations.AddAdminUnitWithMembers方法的典型用法代码示例。如果您正苦于以下问题:C# Operations.AddAdminUnitWithMembers方法的具体用法?C# Operations.AddAdminUnitWithMembers怎么用?C# Operations.AddAdminUnitWithMembers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Operations
的用法示例。
在下文中一共展示了Operations.AddAdminUnitWithMembers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportOneUnit
private void ImportOneUnit(MCS.Library.SOA.DataObjects.Security.SCObjectSet objectSet, Operations.IFacade exec, ImportContextWrapper wrapper, SchemaObjectBase parent, int totalSteps, AdminUnit unit)
{
int currentStep = 0;
var scopes = (from m in objectSet.Membership where m.ContainerID == unit.ID && m.MemberSchemaType == AUCommon.SchemaAUAdminScope && m.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal join o in objectSet.Objects on m.ID equals o.ID where o.SchemaType == AUCommon.SchemaAUAdminScope && o.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal select (AUAdminScope)o).ToArray();
var roles = (from m in objectSet.Membership where m.ContainerID == unit.ID && m.MemberSchemaType == AUCommon.SchemaAdminUnitRole && m.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal join o in objectSet.Objects on m.ID equals o.ID where o.SchemaType == AUCommon.SchemaAdminUnitRole && o.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal select (AURole)o).ToArray();
try
{
currentStep++;
wrapper.SetStatusAndLog(currentStep, totalSteps, "正在导入管理单元" + unit.GetQualifiedName());
exec.AddAdminUnitWithMembers(unit, (AdminUnit)parent, roles, scopes);
ImportRoleMembers(objectSet, exec, wrapper, totalSteps, unit, currentStep, roles);
ImportConditions(objectSet, exec, wrapper, totalSteps, unit, currentStep, scopes);
if (this.ImportSubUnits)
{
wrapper.IncreaseLevel();
var subs = (from r in objectSet.Relations where r.ParentID == unit.ID && r.ChildSchemaType == AUCommon.SchemaAdminUnit && r.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal join o in objectSet.Objects on r.ID equals o.ID where o.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal && o.SchemaType == AUCommon.SchemaAdminUnit select (AdminUnit)o).ToArray();
int count = subs.Length;
foreach (AdminUnit s in subs)
{
ImportOneUnit(objectSet, exec, wrapper, unit, count, s);
}
wrapper.DecreaseLevel();
}
}
catch (Exception ex)
{
wrapper.IncreaseError();
wrapper.SetStatusAndLog(currentStep, totalSteps, string.Format("导入单元 {0} 失败,原因是:{1}", unit.GetQualifiedName(), ex.ToString()));
}
}