本文整理汇总了C#中Department.GetChildDeptID方法的典型用法代码示例。如果您正苦于以下问题:C# Department.GetChildDeptID方法的具体用法?C# Department.GetChildDeptID怎么用?C# Department.GetChildDeptID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Department
的用法示例。
在下文中一共展示了Department.GetChildDeptID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUserByRole
/// <summary>
/// 返回某部门(大于,小于,等于..)某角色的人员
/// </summary>
/// <param name="strRoleName">角色名称(多个以“,”分隔)</param>
/// <param name="enumOp">操作符枚举</param>
/// <param name="strDeptId">部门ID(多个以“,”分隔)</param>
/// <param name="iFloorCode">iFCode:部门层 0自己,>0 子部门层数,-1所有</param>
/// <returns></returns>
public static ViewBase GetUserByRole(string strRoleName, Common.Operators enumOp, string strDeptId, int iFloorCode)
{
ViewUser vUser = new ViewUser(true);
vUser.Field = @" Distinct a.ID,a.NO,a.Name,a.Domain,a.UserID,a.PWD,a.OfficePhone,a.MobilePhone,a.Email,a.SortNum,
a.Remark,a.EditDate,D_Class,a.ID AS UID,a.UserID AS ADCode,
CASE a.IsCancel WHEN '1' THEN '启用' ELSE '注销'END AS HideStatue";
vUser.SetJoin();
StringBuilder strWhere = new StringBuilder(100);
strWhere.Append(" A.RecordStatus = 1 and RU.RecordStatus = 1 and R.RecordStatus = 1 and DPU.RecordStatus = 1 and A.IsCancel = 1 ");
if (!string.IsNullOrEmpty(strRoleName))
{
string[] strRoleNames = strRoleName.Split(',');
for (int i = 0; i < strRoleNames.Length; i++)
{
if (enumOp == Common.Operators.ne)
{
strWhere.Append(" and R.Name " + Common.GetOperator(enumOp) + "'" + strRoleNames[i] + "'");
}
else
{
if (i == 0)
{
strWhere.Append(" and ( R.Name " + Common.GetOperator(enumOp) + "'" + strRoleNames[i] + "'");
}
else
{
strWhere.Append(" or R.Name " + Common.GetOperator(enumOp) + "'" + strRoleNames[i] + "'");
}
}
}
if (enumOp != Common.Operators.ne)
{
strWhere.Append(" ) ");
}
}
if(!string.IsNullOrEmpty(strDeptId))
{
strWhere.Append(" and DPU.FK_DeptID in ( ");
string[] strDeptIds = strDeptId.Split(',');
Department enDept = new Department();
for (int i = 0; i < strDeptIds.Length; i++)
{
strWhere.Append(strDeptIds[i] + "," + enDept.GetChildDeptID(int.Parse(strDeptIds[i]), iFloorCode));
if (!strWhere.ToString().EndsWith(","))
{
strWhere.Append(",");
}
}
strWhere.Remove(strWhere.Length - 1,1);
strWhere.Append(" ) ");
}
vUser.BaseCondition = strWhere.ToString();
return vUser;
}
示例2: GetChildDeptConSelf
/// <summary>
/// 当前用户所在部门的所有字部门
/// </summary>
/// <returns></returns>
public ViewBase GetChildDeptConSelf()
{
Department dpt = new Department();
string strDepts = string.Empty;
foreach (Department dept in this.Depts.Ens)
{
if (strDepts.Length > 0 && !strDepts.EndsWith(","))
{
strDepts += ",";
}
strDepts += dpt.GetChildDeptID(dept.ID,-1);
}
strDepts = strDepts.Length > 0 && strDepts.EndsWith(",") ? strDepts.Substring(0, strDepts.Length - 1) : strDepts;
ViewBase vwDept = new ViewDepartment();
vwDept.BaseCondition = strDepts.Length > 0 ? "(a.ID IN (" + strDepts + ") OR a.ID IN(" + this.Depts.IDs + "))" : " a.ID IN(" + this.Depts.IDs + ")";
return vwDept;
}
示例3: GetUserByDept
/// <summary>
/// 根据部门ID获得角色下的人(在某个部门具有当前角色的人)
/// </summary>
/// <param name="iDeptID">部门ID</param>
/// <param name="eStatus">eStatus</param>
/// <returns></returns>
public ViewBase GetUserByDept(int iDeptID, Common.UserStatus eStatus)
{
Department dpt = new Department();
string strSubDptIDs = dpt.GetChildDeptID(iDeptID, -1);
string strCondition = "(d.ID = " + base.ID.ToString() + " AND b.FK_DeptID = " + iDeptID.ToString() + ")";
strCondition = strSubDptIDs.Length > 0 ? "(" + strCondition + "OR (d.ID = " + base.ID.ToString() + " AND b.FK_DeptID IN (" + strSubDptIDs + ")))" : strCondition;
ViewBase vw = new ViewRoleUser();
vw.BaseCondition = strCondition + " AND a.IsCancel = " + ((int)eStatus).ToString();
return vw;
}