当前位置: 首页>>代码示例>>C#>>正文


C# Department.GetChildDeptID方法代码示例

本文整理汇总了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;
        }
开发者ID:BGCX261,项目名称:zhoulijinrong-svn-to-git,代码行数:66,代码来源:User.cs

示例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;
 }
开发者ID:BGCX261,项目名称:zhoulijinrong-svn-to-git,代码行数:21,代码来源:User.cs

示例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;
 }
开发者ID:BGCX261,项目名称:zhoulijinrong-svn-to-git,代码行数:16,代码来源:Role.cs


注:本文中的Department.GetChildDeptID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。