/// <summary> /// 得到一个人员的所在组织显示 /// </summary> /// <param name="id">人员ID</param> /// <param name="isShowRoot">是否显示根</param> /// <returns></returns> public string GetOrganizesShowHtml(Guid id, bool isShowRoot = true) { var organizeUsers = new OrganizeUser().GetListByUserId(id); StringBuilder stringBuilder = new StringBuilder(); Organize organize = new Organize(); foreach (var organizeUser in organizeUsers) { var parentsName = organize.GetParentsName(organizeUser.OrganizeId, isShowRoot); stringBuilder.Append("<div>"); if (!parentsName.IsNullOrWhiteSpace()) { stringBuilder.Append(parentsName + " \\ "); } stringBuilder.Append(organize.GetName(organizeUser.OrganizeId)); if (organizeUser.IsMain == 0) { stringBuilder.Append("<span style='color:#999;'>[兼任]</span>"); } stringBuilder.Append("</div>"); } return(stringBuilder.ToString()); }
/// <summary> /// 得到一个人员的主要组织显示 /// </summary> /// <param name="id">人员ID</param> /// <param name="isShowRoot">是否显示根</param> /// <returns></returns> public string GetOrganizeMainShowHtml(Guid id, bool isShowRoot = true) { var organizeUser = new OrganizeUser().GetMainByUserId(id); if (null == organizeUser) { return(""); } else { Organize organize = new Organize(); string parentsName = organize.GetParentsName(organizeUser.OrganizeId, isShowRoot); return((parentsName.IsNullOrWhiteSpace() ? "" : parentsName + " \\ ") + organize.GetName(organizeUser.OrganizeId)); } }