Example #1
0
 /// <summary>
 /// 根据角色获得用户,支持多个
 /// </summary>
 /// <param name="sRoles">角色名,支持多个</param>
 /// <param name="bFalg">属于或不属于该角色的用户</param>
 /// <returns></returns>
 private static ViewBase GetUserByRoles(string sRoles,bool bFalg)
 {
     string[] strArray = sRoles.Split(',');
     string strRoles = string.Empty;
     foreach (string str in strArray)
     {
         if (strRoles.Length > 0)
         {
             strRoles += ",";
         }
         strRoles += "'" + str + "'";
     }
     string strCondition = bFalg ? "d.Name in (" + strRoles + ")" : "d.Name not in (" + strRoles + ")";
     ViewRoleUser vwRoleUser = new ViewRoleUser(true);
     vwRoleUser.Field = @"DISTINCT a.ID,a.NO,a.Name,a.Domain,a.UserID,a.PWD,a.OfficePhone,a.D_Class,
                         a.MobilePhone,a.Email,a.SortNum,a.RecordStatus,a.Remark,a.EditDate,a.IsCancel,
                         CASE a.IsCancel WHEN '1' THEN '启用' ELSE '注销'END AS HideStatue";
     vwRoleUser.BaseCondition = sRoles.Length > 0 ? strCondition : "1<>1";
     return vwRoleUser;
 }
Example #2
0
 /// <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;
 }
Example #3
0
 /// <summary>
 /// 获取部门用户
 /// </summary>
 /// <param name="eStatus">状态:注销,正常</param>
 /// <returns></returns>
 public ViewBase GetUsers(Common.UserStatus eStatus)
 {
     ViewRoleUser vwRoleUesr = new ViewRoleUser();
     vwRoleUesr.BaseCondition = "d.ID = " + base.ID.ToString() + " AND a.IsCancel = " + ((int)eStatus).ToString();
     return vwRoleUesr;
 }
Example #4
0
 /// <summary>
 /// 根据部门获得当前角色下的人
 /// </summary>
 /// <param name="iDeptID">部门ID</param>
 /// <returns></returns>
 public ViewBase GetUserByCurrDept(int iDeptID)
 {
     ViewBase vw = new ViewRoleUser();
     string strCon = iDeptID == 0 ? " a.IsCancel = 1 " : "a.IsCancel = 1 AND b.FK_DeptID = " + iDeptID.ToString();
     vw.Field = @"DISTINCT e.Name AS PostName,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,b.ID AS DpuID,b.LeaderType,
                                         CASE a.IsCancel WHEN '1' THEN '启用' ELSE '注销'END AS HideStatue,
                                         CASE b.LeaderType WHEN '1' THEN '领导' WHEN '2' THEN '负责人' WHEN '3' THEN '领导;负责人' END AS LeaderTypeName ";
     vw.BaseCondition = strCon + " AND d.ID = " + base.ID.ToString();
     return vw;
 }