public string GetNoticesContent(string userName, int pageSize, int pageIndex) { int totalRecord = 0; QJVRMS.Business.NoticeWS.NoticesService notices = new QJVRMS.Business.NoticeWS.NoticesService(); DataTable dt = notices.GetNotices(pageSize, pageIndex, ref totalRecord); if (dt == null || dt.Rows.Count == 0) { return(string.Empty); } StringBuilder sb = new StringBuilder(); sb.Append("<table border=\"0\" cellspacing=\"0\" width=\"100%\" class=\"table\">"); sb.Append("<tr class=\"head\">"); sb.Append("<td style=\"width:180px\">公告名称</td>"); sb.Append("<td style=\"width:250px\">公告内容</td>"); sb.Append("<td style=\"width:100px\">发布时间</td>"); sb.Append("<td style=\"width:100px\">发布人</td>"); sb.Append("<td style=\"width:80px\">编辑</td>"); sb.Append("</tr>"); string content = string.Empty; string noticeName = string.Empty; for (int i = 0; i < dt.Rows.Count; i++) { if (i % 2 == 0) { sb.Append("<tr id=\"tr" + dt.Rows[i]["NoticeId"].ToString() + "\" class=\"both\">"); } else { sb.Append("<tr id=\"tr" + dt.Rows[i]["NoticeId"].ToString() + "\" class=\"cell\">"); } noticeName = dt.Rows[i]["NoticeName"].ToString(); noticeName = noticeName.Length > 14 ? noticeName.Substring(0, 14) : noticeName; sb.Append("<td>" + noticeName + "</td>"); content = dt.Rows[i]["NoticeContent"].ToString(); content = content.Length > 15 ? content.Substring(0, 15) + "..." : content; sb.Append("<td>" + content + "</td>"); sb.Append("<td>" + Convert.ToDateTime(dt.Rows[i]["NoticeDate"].ToString()).ToString("yyyy-MM-dd") + "</td>"); sb.Append("<td>" + dt.Rows[i]["Creator"].ToString() + "</td>"); sb.Append("<td>"); sb.Append("<a href=\"javascript:GetNotice('" + dt.Rows[i]["NoticeId"].ToString() + "', '" + userName + "')\" >编辑</a>"); sb.Append(" "); sb.Append("<a href=\"javascript:DeleteNotice('" + dt.Rows[i]["NoticeId"].ToString() + "')\" >删除</a>"); sb.Append("</td>"); sb.Append("</tr>"); } sb.Append("</table>"); if (totalRecord > pageSize) { sb.Append(GetPage(pageSize, pageIndex, totalRecord, userName)); } return(sb.ToString()); }
public string GetNoticesContent(string userName, int pageSize, int pageIndex) { int totalRecord = 0; QJVRMS.Business.NoticeWS.NoticesService notices = new QJVRMS.Business.NoticeWS.NoticesService(); DataTable dt = notices.GetNotices(pageSize, pageIndex, ref totalRecord); if (dt == null || dt.Rows.Count == 0) return string.Empty; StringBuilder sb = new StringBuilder(); sb.Append("<table border=\"0\" cellspacing=\"0\" width=\"100%\" class=\"table\">"); sb.Append("<tr class=\"head\">"); sb.Append("<td style=\"width:180px\">公告名称</td>"); sb.Append("<td style=\"width:250px\">公告内容</td>"); sb.Append("<td style=\"width:100px\">发布时间</td>"); sb.Append("<td style=\"width:100px\">发布人</td>"); sb.Append("<td style=\"width:80px\">编辑</td>"); sb.Append("</tr>"); string content = string.Empty; string noticeName = string.Empty; for (int i = 0; i < dt.Rows.Count; i++) { if(i%2 ==0) sb.Append("<tr id=\"tr" + dt.Rows[i]["NoticeId"].ToString() + "\" class=\"both\">"); else sb.Append("<tr id=\"tr" + dt.Rows[i]["NoticeId"].ToString() + "\" class=\"cell\">"); noticeName = dt.Rows[i]["NoticeName"].ToString(); noticeName = noticeName.Length > 14 ? noticeName.Substring(0, 14) : noticeName; sb.Append("<td>" + noticeName + "</td>"); content = dt.Rows[i]["NoticeContent"].ToString(); content = content.Length > 15 ? content.Substring(0, 15) + "..." : content; sb.Append("<td>" + content + "</td>"); sb.Append("<td>" + Convert.ToDateTime(dt.Rows[i]["NoticeDate"].ToString()).ToString("yyyy-MM-dd") + "</td>"); sb.Append("<td>" + dt.Rows[i]["Creator"].ToString() + "</td>"); sb.Append("<td>"); sb.Append("<a href=\"javascript:GetNotice('" + dt.Rows[i]["NoticeId"].ToString() + "', '" + userName + "')\" >编辑</a>"); sb.Append(" "); sb.Append("<a href=\"javascript:DeleteNotice('" + dt.Rows[i]["NoticeId"].ToString() + "')\" >删除</a>"); sb.Append("</td>"); sb.Append("</tr>"); } sb.Append("</table>"); if (totalRecord > pageSize) sb.Append(GetPage(pageSize, pageIndex, totalRecord, userName)); return sb.ToString(); }
public string ShowNoticesAll(string userName, int pageSize, int pageIndex) { int totalRecord = 0; QJVRMS.Business.NoticeWS.NoticesService notices = new QJVRMS.Business.NoticeWS.NoticesService(); DataTable dt = notices.GetNotices(pageSize, pageIndex, ref totalRecord); if (dt == null || dt.Rows.Count == 0) { return(string.Empty); } StringBuilder sb = new StringBuilder(); sb.Append("<table border=\"0\" cellspacing=\"0\" width=\"100%\" class=\"table\">"); sb.Append("<tr class=\"head\">"); sb.Append("<td style=\"width:180px\">公告名称</td>"); sb.Append("<td style=\"width:250px\">公告内容</td>"); sb.Append("<td style=\"width:100px\">发布时间</td>"); sb.Append("<td style=\"width:100px\">发布人</td>"); sb.Append("</tr>"); string content = string.Empty; for (int i = 0; i < dt.Rows.Count; i++) { sb.Append("<tr id=\"tr" + dt.Rows[i]["NoticeId"].ToString() + "\" class=\"cell\">"); //sb.Append("<td><a href=\"Notices.aspx?noticeId=" + dt.Rows[i]["NoticeId"].ToString() + "\" >" + dt.Rows[i]["NoticeName"].ToString() + "</a></td>"); sb.Append("<td><a href=\"javascript:OnNotices('" + dt.Rows[i]["NoticeId"].ToString() + "');\">" + dt.Rows[i]["NoticeName"].ToString() + "</a></td>"); content = dt.Rows[i]["NoticeContent"].ToString(); content = content.Length > 30 ? content.Substring(0, 30) + "..." : content; sb.Append("<td>" + content + "</td>"); sb.Append("<td>" + Convert.ToDateTime(dt.Rows[i]["NoticeDate"].ToString()).ToString("yyyy-MM-dd") + "</td>"); sb.Append("<td>" + dt.Rows[i]["Creator"].ToString() + "</td>"); sb.Append("</tr>"); } sb.Append("</table>"); if (totalRecord > pageSize) { sb.Append(GetPage(pageSize, pageIndex, totalRecord, userName)); } return(sb.ToString()); }
public string ShowNoticesAll(string userName, int pageSize, int pageIndex) { int totalRecord = 0; QJVRMS.Business.NoticeWS.NoticesService notices = new QJVRMS.Business.NoticeWS.NoticesService(); DataTable dt = notices.GetNotices(pageSize, pageIndex, ref totalRecord); if (dt == null || dt.Rows.Count == 0) return string.Empty; StringBuilder sb = new StringBuilder(); sb.Append("<table border=\"0\" cellspacing=\"0\" width=\"100%\" class=\"table\">"); sb.Append("<tr class=\"head\">"); sb.Append("<td style=\"width:180px\">公告名称</td>"); sb.Append("<td style=\"width:250px\">公告内容</td>"); sb.Append("<td style=\"width:100px\">发布时间</td>"); sb.Append("<td style=\"width:100px\">发布人</td>"); sb.Append("</tr>"); string content = string.Empty; for (int i = 0; i < dt.Rows.Count; i++) { sb.Append("<tr id=\"tr" + dt.Rows[i]["NoticeId"].ToString() + "\" class=\"cell\">"); //sb.Append("<td><a href=\"Notices.aspx?noticeId=" + dt.Rows[i]["NoticeId"].ToString() + "\" >" + dt.Rows[i]["NoticeName"].ToString() + "</a></td>"); sb.Append("<td><a href=\"javascript:OnNotices('" + dt.Rows[i]["NoticeId"].ToString() + "');\">" + dt.Rows[i]["NoticeName"].ToString() + "</a></td>"); content = dt.Rows[i]["NoticeContent"].ToString(); content = content.Length > 30 ? content.Substring(0, 30) + "..." : content; sb.Append("<td>" + content + "</td>"); sb.Append("<td>" + Convert.ToDateTime(dt.Rows[i]["NoticeDate"].ToString()).ToString("yyyy-MM-dd") + "</td>"); sb.Append("<td>" + dt.Rows[i]["Creator"].ToString() + "</td>"); sb.Append("</tr>"); } sb.Append("</table>"); if (totalRecord > pageSize) sb.Append(GetPage(pageSize, pageIndex, totalRecord, userName)); return sb.ToString(); }