info.aspx.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Web;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. using CB.Entity;
  9. using CB.Data;
  10. using CB.Common;
  11. namespace CB.TVUCenter.Web
  12. {
  13. public partial class info : System.Web.UI.Page
  14. {
  15. protected string TopicType = "", TopicAuthor = "", TopicContent = ""
  16. , TopicTitle = "", CreateTime = "", FullImage="";
  17. protected StringBuilder ListString = new StringBuilder();
  18. protected StringBuilder ListImage = new StringBuilder();
  19. protected void Page_Load(object sender, EventArgs e)
  20. {
  21. int id = WRequest.GetQueryInt("id");
  22. if (!IsPostBack)
  23. {
  24. TopicInfo info = TopicService.Get(id);
  25. string topicTypeId = WRequest.GetQueryString("cid");
  26. if (info == null) return;
  27. TopicAuthor = info.UserName;
  28. TopicContent = info.Context;
  29. TopicTitle = info.Title;
  30. CreateTime = info.Addtime.ToString("yyyy-MM-dd HH:mm:ss");
  31. GetTopicType(topicTypeId);
  32. BindConsult(4, topicTypeId);
  33. BindConsult(2);
  34. if (topicTypeId == "208")
  35. {
  36. FullImage = "<img src='" + info.FileURL + @"' />";
  37. }
  38. }
  39. }
  40. private void GetTopicType(string topicTypeId)
  41. {
  42. switch (topicTypeId)
  43. {
  44. case "205":
  45. TopicType = "咨询";
  46. break;
  47. case "206":
  48. TopicType = "公告";
  49. break;
  50. case "208":
  51. TopicType = "实景展示";
  52. break;
  53. }
  54. }
  55. /// <summary>
  56. /// 绑定中间的咨询/公告
  57. /// </summary>
  58. /// <param name="list"></param>
  59. /// <param name="id"></param>
  60. private void BindConsult(int displayCount, string topicTypeId)
  61. {
  62. int Record = 0;
  63. List<TopicInfo> lists = TopicService.ToPaging(topicTypeId, 10, 1, out Record, "Tid DESC").ToList();
  64. displayCount = (displayCount > lists.Count) ? lists.Count : displayCount;
  65. for (int i = 0; i < displayCount; i++)
  66. {
  67. string img = "";
  68. string consult = "";
  69. if (lists[i].ListThumbsURL != null && lists[i].ListThumbsURL.Count > 0)
  70. img = "<img src='" + lists[i].ListThumbsURL[0] + "' />";
  71. consult = @"<li><a href='info_" + lists[i].Id + "_" + lists[i].Cid + @".html'>" + img
  72. + "<h4 title='" + lists[i].Title + "'>" + (lists[i].Title.Length > 20 ? lists[i].Title.Substring(0, 20) : lists[i].Title) + @"</h4>
  73. </a></li>";
  74. ListString.Append(consult);
  75. }
  76. }
  77. /// <summary>
  78. /// 绑定实景展示图片列表
  79. /// </summary>
  80. /// <param name="list"></param>
  81. /// <param name="id"></param>
  82. private void BindConsult(int displayCount)
  83. {
  84. int Record = 0;
  85. List<TopicInfo> lists = TopicService.ToPaging("208", 10, 1, out Record, "Tid DESC").ToList();
  86. displayCount = (displayCount > lists.Count) ? lists.Count : displayCount;
  87. for (int i = 0; i < displayCount; i++)
  88. {
  89. string img = "";
  90. if (lists[i].ListThumbsURL != null && lists[i].ListThumbsURL.Count > 0)
  91. img = "<img src='" + lists[i].ListThumbsURL[0] + @"' class='ListImage'/>";
  92. string image = @"<div class='show_img'><a href='info_" + lists[i].Id + "_" + lists[i].Cid + @".html'>" + img + "<p>" + lists[i].Title + "</a></p></div>";
  93. ListImage.Append(image);
  94. }
  95. }
  96. }
  97. }