//根据组织架构的ID获取职位 public string GetPosLayoutByStruct(string structId) { using (SysPositionRepository posRep = new SysPositionRepository(new DBContainer())) { IQueryable <SysPosition> queryData = posRep.GetList(); IQueryable <SysPosition> query = queryData.Where(a => a.DepId == structId).OrderBy(a => a.Sort); StringBuilder sb = new StringBuilder(); if (query.Count() > 0) { sb.Append("<ul>"); foreach (var r in query) { sb.Append("<li data-options=\"attributes:{'id':'" + r.Id + "'}\">"); sb.AppendFormat("<span>{0}</span>", r.Name); } sb.Append("</ul>"); } return(sb.ToString()); } }