123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using CB.Entity;
- using CB.Data;
- namespace CB.TVUCenter.Web
- {
- public partial class index : System.Web.UI.Page
- {
- protected StringBuilder ConsultString = new StringBuilder();
- protected StringBuilder AnnouncementString = new StringBuilder();
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- BindInfo(11);
- }
- }
- /// <summary>
- /// 咨询
- /// </summary>
- /// <returns>
- ///
- /// <returns>
- private void BindInfo(int displayCount)
- {
- int Record = 0;
- List<TopicInfo> lists = TopicService.ToPaging("205,206", 15, 1, out Record,"Tid DESC").ToList();
- if (lists == null && lists.Count < 1) return;
- displayCount = lists.Count < displayCount ? lists.Count : displayCount;
- for (int i = 0; i < displayCount; i++)
- {
- if (i < 3) BindConsult(lists[i], i);
- else BindAnnouncement(lists[i]);
- }
- }
- /// <summary>
- /// 绑定中间的咨询/公告
- /// </summary>
- /// <param name="list"></param>
- /// <param name="id"></param>
- private void BindConsult(TopicInfo list, int id)
- {
- string img = "";
- string consult = "";
- if (list.ListThumbsURL != null && list.ListThumbsURL.Count > 0)
- img = "<img src='" + list.ListThumbsURL[0] + @"' width='120' height='96'/>";
- if (id == 0 || img == "")
- consult = "<li><a href='info_" + list.Id + "_" + list.Cid + @".html'>
- <h3 title='" + list.Title + "'>" + (list.Title.Length > 20 ? list.Title.Substring(0, 20) : list.Title) + @"</h3>
- <p>" + (list.Context.Length > 80 ? list.Context.Substring(0, 80) + "……" : list.Context) + @"</p>
- </a></li>";
- else
- consult = @"<li><a href='info_" + list.Id + "_" + list.Cid + @".html'>
- <div class='figure'>" + img + @"</div>
- <div class='works' title='" + list.Title + "'><h4>" + (list.Title.Length > 20 ? list.Title.Substring(0, 20) : list.Title) + @"</h4><p>" + (list.Context.Length > 80 ? list.Context.Substring(0, 80) + "……" : list.Context) + @"</p>
- </div>
- </a></li>";
- ConsultString.Append(consult);
- }
- /// <summary>
- /// 绑定右边的列表
- /// </summary>
- /// <param name="list"></param>
- private void BindAnnouncement(TopicInfo list)
- {
- string Announcement = " <li><a href='info_" + list.Id + "_" + list.Cid + @".html' title='" + list.Title + "'><span></span>"
- + (list.Title.Length > 20 ? list.Title.Substring(0, 20) : list.Title) + @"</a>
- <span class='time'>" + list.Addtime.ToString("MM-dd") + "</span></li>";
- AnnouncementString.Append(Announcement);
- }
- }
- }
|