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;
using CB.Common;
namespace CB.TVUCenter.Web
{
public partial class info : System.Web.UI.Page
{
protected string TopicType = "", TopicAuthor = "", TopicContent = ""
, TopicTitle = "", CreateTime = "", FullImage="";
protected StringBuilder ListString = new StringBuilder();
protected StringBuilder ListImage = new StringBuilder();
protected void Page_Load(object sender, EventArgs e)
{
int id = WRequest.GetQueryInt("id");
if (!IsPostBack)
{
TopicInfo info = TopicService.Get(id);
string topicTypeId = WRequest.GetQueryString("cid");
if (info == null) return;
TopicAuthor = info.UserName;
TopicContent = info.Context;
TopicTitle = info.Title;
CreateTime = info.Addtime.ToString("yyyy-MM-dd HH:mm:ss");
GetTopicType(topicTypeId);
BindConsult(4, topicTypeId);
BindConsult(2);
if (topicTypeId == "208")
{
FullImage = "
";
}
}
}
private void GetTopicType(string topicTypeId)
{
switch (topicTypeId)
{
case "205":
TopicType = "咨询";
break;
case "206":
TopicType = "公告";
break;
case "208":
TopicType = "实景展示";
break;
}
}
///
/// 绑定中间的咨询/公告
///
///
///
private void BindConsult(int displayCount, string topicTypeId)
{
int Record = 0;
List lists = TopicService.ToPaging(topicTypeId, 10, 1, out Record, "Tid DESC").ToList();
displayCount = (displayCount > lists.Count) ? lists.Count : displayCount;
for (int i = 0; i < displayCount; i++)
{
string img = "";
string consult = "";
if (lists[i].ListThumbsURL != null && lists[i].ListThumbsURL.Count > 0)
img = "
";
consult = @"" + img
+ "" + (lists[i].Title.Length > 20 ? lists[i].Title.Substring(0, 20) : lists[i].Title) + @"
";
ListString.Append(consult);
}
}
///
/// 绑定实景展示图片列表
///
///
///
private void BindConsult(int displayCount)
{
int Record = 0;
List lists = TopicService.ToPaging("208", 10, 1, out Record, "Tid DESC").ToList();
displayCount = (displayCount > lists.Count) ? lists.Count : displayCount;
for (int i = 0; i < displayCount; i++)
{
string img = "";
if (lists[i].ListThumbsURL != null && lists[i].ListThumbsURL.Count > 0)
img = "
";
string image = @"";
ListImage.Append(image);
}
}
}
}