/// <summary> /// 用户是否在某部门 /// </summary> /// <param name="userId">用户主键</param> /// <param name="organizeName">部门名称</param> /// <returns>存在</returns> public bool IsInOrganize(string userId, string organizeName) { bool result = false; // 把部门的主键找出来 List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >(); parameters.Add(new KeyValuePair <string, object>(BaseOrganizeEntity.FieldFullName, organizeName)); parameters.Add(new KeyValuePair <string, object>(BaseOrganizeEntity.FieldEnabled, 1)); parameters.Add(new KeyValuePair <string, object>(BaseOrganizeEntity.FieldDeletionStateCode, 0)); BaseOrganizeManager organizeManager = new BaseOrganizeManager(this.UserInfo); string organizeId = organizeManager.GetId(parameters); if (string.IsNullOrEmpty(organizeId)) { return(result); } // 用户组织机构关联关系 string[] organizeIds = this.GetAllOrganizeIds(userId); if (organizeIds == null || organizeIds.Length == 0) { return(result); } // 用户的部门是否存在这些部门里 result = StringUtil.Exists(organizeIds, organizeId); return(result); }