|
@@ -92,20 +92,20 @@ public static class OrgExtensions
|
|
orgLevel == CalcOrgLevel(orgCode);
|
|
orgLevel == CalcOrgLevel(orgCode);
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 根据orgCode获取该部门所属对应级别的上级部门code
|
|
|
|
|
|
+ /// 根据orgCode获取该部门所属对应级别的上级部门code(中心直属下级部门无效)
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="orgCode"></param>
|
|
|
|
|
|
+ /// <param name="orgId"></param>
|
|
/// <param name="orgLevel">默认获取一级部门</param>
|
|
/// <param name="orgLevel">默认获取一级部门</param>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
- public static string GetHigherOrgCode(this string orgCode, int orgLevel = 1)
|
|
|
|
|
|
+ public static string GetHigherOrgCode(this string orgId, int orgLevel = 1)
|
|
{
|
|
{
|
|
- if (string.IsNullOrEmpty(orgCode))
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(orgId))
|
|
throw UserFriendlyException.SameMessage("无效部门编码");
|
|
throw UserFriendlyException.SameMessage("无效部门编码");
|
|
- ////中心算做一级部门
|
|
|
|
- //if (orgLevel == 1 && orgCode == OrgSeedData.CenterCode) return orgCode;
|
|
|
|
|
|
+ //中心算做一级部门
|
|
|
|
+ if (orgLevel == 1 && orgId.IsCenter()) return orgId;
|
|
|
|
|
|
- // return orgCode.Substring(0, 3 * (orgLevel + 1));
|
|
|
|
- return orgCode.Substring(0, 3 * orgLevel);
|
|
|
|
|
|
+ return orgId.Substring(0, 3 * (orgLevel + 1));
|
|
|
|
+ //return orgId.Substring(0, 3 * orgLevel);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -118,18 +118,18 @@ public static class OrgExtensions
|
|
return orgCode.Substring(orgCode.Length - 3, 3);
|
|
return orgCode.Substring(orgCode.Length - 3, 3);
|
|
}
|
|
}
|
|
|
|
|
|
- public static bool IsCenter(this string orgCode)
|
|
|
|
|
|
+ public static bool IsCenter(this string orgId)
|
|
{
|
|
{
|
|
- if (string.IsNullOrEmpty(orgCode))
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(orgId))
|
|
throw UserFriendlyException.SameMessage("无效部门编码");
|
|
throw UserFriendlyException.SameMessage("无效部门编码");
|
|
- return orgCode == OrgSeedData.CenterId;
|
|
|
|
|
|
+ return orgId == OrgSeedData.CenterId;
|
|
}
|
|
}
|
|
|
|
|
|
- public static bool IsBelongCenter(this string orgCode)
|
|
|
|
- {
|
|
|
|
- if (string.IsNullOrEmpty(orgCode))
|
|
|
|
- throw UserFriendlyException.SameMessage("无效部门编码");
|
|
|
|
- var upperOrg = orgCode.GetHigherOrgCode();
|
|
|
|
- return IsCenter(upperOrg);
|
|
|
|
- }
|
|
|
|
|
|
+ //public static bool IsBelongCenter(this string orgCode)
|
|
|
|
+ //{
|
|
|
|
+ // if (string.IsNullOrEmpty(orgCode))
|
|
|
|
+ // throw UserFriendlyException.SameMessage("无效部门编码");
|
|
|
|
+ // var upperOrg = orgCode.GetHigherOrgCode();
|
|
|
|
+ // return IsCenter(upperOrg);
|
|
|
|
+ //}
|
|
}
|
|
}
|