private string GetList(int groupID) { if (groupID == 1 || groupID == 2) { if (LocatingServiceUtil.IsAvailable()) { IServiceApi serviceApi = LocatingServiceUtil.Instance <IServiceApi>(); TagStatusView[] tagsView = serviceApi.GetTagOnSentry(); if (tagsView == null) { return(""); } var q = tagsView.Where(_d => _d != null && _d.HostTag.HostGroupId.Contains(groupID)).Select(_d => new { HostId = _d.HostTag.HostId, HostName = _d.HostTag.HostName, Mac = _d.Mac, HostPhotoPath = "../TagUsers/UserPhoto.ashx?id=" + _d.HostTag.HostId }); StringBuilder sb = new StringBuilder(""); foreach (var log in q) { sb.AppendFormat(@" <td width=4></td> <td width=100 align=center valign=top><img src={0} width=100 height=120 /><br/><br/> 姓名:{1}<br/> 标签:{2}</td> ", log.HostPhotoPath, log.HostName, log.Mac); } if (sb.Length > 0) { sb.Insert(0, "<table border=0 cellspacing=0 cellpadding=0><tr>"); sb.Append("</tr></table>"); } return(sb.ToString()); } } return(""); }