/// <summary> /// 初始化页面 /// </summary> private void InitPageData() { EyouSoft.IBLL.CommunityStructure.IInfoArticle ibll = EyouSoft.BLL.CommunityStructure.InfoArticle.CreateInstance(); EyouSoft.Model.CommunityStructure.InfoArticle model = ibll.GetModel(ArticleId); if (model == null) { Utils.ShowError("未能找到您要查看的资讯!", "InfoArticle"); } TopicClassId = (int)model.TopicClassId; TopicAreasId = (int)model.AreaId; this.Page.Title = model.ArticleTitle; System.Text.StringBuilder strA = new System.Text.StringBuilder(); if (TopicClassId == 1) { strA.AppendFormat("<a href=\"/SupplierInfo/InfoArticle.aspx\">{0}</a>", Enum.GetName(typeof(EyouSoft.Model.CommunityStructure.TopicClass), TopicClassId)); } else if (TopicClassId > 0) { strA.AppendFormat("<a href=\"/SupplierInfo/SchoolIntroduction.aspx\">{0}</a>", Enum.GetName(typeof(EyouSoft.Model.CommunityStructure.TopicClass), TopicClassId)); } ltrTopicClass.Text = strA.ToString(); //小类别要判断 if (TopicAreasId > 0) { if (TopicAreasIds.Contains(TopicAreasId)) { ltrTopIcArea.Text = string.Format(" > <a href=\"/SupplierInfo/ArticleList.aspx?TypeId={0}&AreaId={1}\">{2}</a>", TopicClassId, TopicAreasId, Enum.GetName(typeof(EyouSoft.Model.CommunityStructure.TopicAreas), TopicAreasId)); } else { ltrTopIcArea.Text = string.Format(" > <a href=\"/SupplierInfo/SchoolIntroductionList.aspx?TypeId={0}&AreaId={1}\">{2}</a>", TopicClassId, TopicAreasId, Enum.GetName(typeof(EyouSoft.Model.CommunityStructure.TopicAreas), TopicAreasId)); } } if (string.IsNullOrEmpty(model.TitleColor)) { ltrTitle.Text = model.ArticleTitle; } else { ltrTitle.Text = string.Format("<font color=\"{0}\">", model.TitleColor) + model.ArticleTitle + "</font>"; } ltrTime.Text = model.IssueTime.ToString("yyyy年MM月dd日 hh:mm"); if (!string.IsNullOrEmpty(model.Source)) { ltrSource.Text = "来源:" + model.Source; } if (model.IsImage) { ltrImg.Text = string.Format("<img src=\"{0}\" alt=\"{1}\" width=\"600\" height=\"400\" />", Domain.FileSystem + model.ImgPath, model.ArticleTitle); } ltrInfo.Text = model.ArticleText; ltrTags.Text = string.IsNullOrEmpty(model.ArticleTag) ? string.Empty : model.ArticleTag.Replace(",", " "); ltrEditOR.Text = Utils.GetText(model.Editor, 6); if (model.PrevInfo != null) { ltrPrev.Text = string.Format("上一篇:<a href=\"/SupplierInfo/{0}?Id={1}\">{2}</a>", model.PrevInfo.TopicClassId == EyouSoft.Model.CommunityStructure.TopicClass.行业资讯 ? "ArticleInfo.aspx" : "SchoolIntroductionInfo.aspx", model.PrevInfo.ID, Utils.GetText(model.PrevInfo.ArticleTitle, 20)); } if (model.NextInfo != null) { ltrNext.Text = string.Format("下一篇:<a href=\"/SupplierInfo/{0}?Id={1}\">{2}</a>", model.NextInfo.TopicClassId == EyouSoft.Model.CommunityStructure.TopicClass.行业资讯 ? "ArticleInfo.aspx" : "SchoolIntroductionInfo.aspx", model.NextInfo.ID, Utils.GetText(model.NextInfo.ArticleTitle, 20)); } //绑定相关文章列表 rptRelatedArticle.DataSource = ibll.GetTopNumTagList(8, (EyouSoft.Model.CommunityStructure.TopicClass)TopicClassId, (EyouSoft.Model.CommunityStructure.TopicAreas)TopicAreasId, ArticleId); rptRelatedArticle.DataBind(); //绑定最新图文资讯 rptArticle.DataSource = ibll.GetTopNumPicList(5, null, null, true, null); rptArticle.DataBind(); ibll = null; model = null; }
/// <summary> /// 绑定图文列表 /// </summary> private void BindPicList() { StringBuilder strInfoHtml = new StringBuilder(); IList <EyouSoft.Model.CommunityStructure.InfoArticle> list = null; EyouSoft.IBLL.CommunityStructure.IInfoArticle InfoBll = EyouSoft.BLL.CommunityStructure.InfoArticle.CreateInstance(); switch (PartType) { #region 资讯 case PartTypes.资讯: list = InfoBll.GetTopNumPicList(TopNumber, EyouSoft.Model.CommunityStructure.TopicClass.行业资讯, null, true, null); if (list != null && list.Count > 0) { foreach (EyouSoft.Model.CommunityStructure.InfoArticle model in list) { strInfoHtml.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-bottom:1px dashed #ccc;\">"); strInfoHtml.Append("<tr>"); strInfoHtml.AppendFormat("<td width=\"48%\" height=\"108\"><img src=\"{0}\" width=\"120\" height=\"90\" /></td>", FileServerUrl + model.ImgThumb); strInfoHtml.AppendFormat("<td width=\"52%\" valign=\"top\"><strong><a href=\"/SupplierInfo/{0}?Id={1}\" class=\"heise\" title=\"{3}\">{2}</a></strong><br /><span class=\"huise\">{3}</span><a href=\"/SupplierInfo/{0}?Id={1}\"><span class=\"ff0000\">[详细]</span></a></td>", model.TopicClassId == EyouSoft.Model.CommunityStructure.TopicClass.行业资讯 ? "ArticleInfo.aspx" : "SchoolIntroductionInfo.aspx", model.ID, Utils.GetText(model.ArticleTitle, 7), model.ArticleTitle, Utils.GetText(model.ArticleText, 30)); strInfoHtml.Append("</tr>"); strInfoHtml.Append("</table>"); } } list = null; InfoBll = null; break; #endregion #region 顾问团队 case PartTypes.顾问团队: EyouSoft.IBLL.CommunityStructure.ICommunityAdvisor IAdvisorBll = EyouSoft.BLL.CommunityStructure.CommunityAdvisor.CreateInstance(); IList <EyouSoft.Model.CommunityStructure.CommunityAdvisor> AdvList = IAdvisorBll.GetCommunityAdvisorList(TopNumber, true); if (AdvList != null && AdvList.Count > 0) { foreach (EyouSoft.Model.CommunityStructure.CommunityAdvisor model in AdvList) { strInfoHtml.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-bottom:1px dashed #ccc; margin-top:5px; padding-bottom:2px;\">"); strInfoHtml.Append("<tr>"); strInfoHtml.AppendFormat("<td width=\"27%\"><img src=\"{0}\" width=\"59\" height=\"60\" /></td>", FileServerUrl + model.ImgPath); strInfoHtml.AppendFormat("<td width=\"73%\" valign=\"top\" align=\"left\"><strong>{0}</strong><br />", model.ContactName); strInfoHtml.AppendFormat("<div style=\"color:#585858;\" title=\"{1}\">{0}</div></td>", Utils.GetText(model.Achieve, 30), model.Achieve); strInfoHtml.Append("</tr>"); strInfoHtml.Append("</table>"); } } AdvList = null; IAdvisorBll = null; break; #endregion #region 宾访谈 case PartTypes.宾访谈: EyouSoft.IBLL.CommunityStructure.IHonoredGuest IGuestBll = EyouSoft.BLL.CommunityStructure.HonoredGuest.CreateInstance(); IList <EyouSoft.Model.CommunityStructure.HonoredGuest> GuestList = IGuestBll.GetTopNumList(TopNumber); if (GuestList != null && GuestList.Count > 0) { foreach (EyouSoft.Model.CommunityStructure.HonoredGuest model in GuestList) { strInfoHtml.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-bottom:1px dashed #ccc; margin-top:5px; padding-bottom:2px;\">"); strInfoHtml.Append("<tr>"); strInfoHtml.AppendFormat("<td width=\"30%\"><img src=\"{0}\" width=\"50\" height=\"50\" /></td>", FileServerUrl + model.ImgThumb); strInfoHtml.AppendFormat("<td width=\"70%\" valign=\"top\" style=\"text-align:left\"><strong title=\"{2}\">{0}</strong><br /><div style=\"margin-top:2px; color:#585858;\">{1}<br />", Utils.GetText(model.Title, 13), Utils.GetText(model.Content, 13), model.Title); strInfoHtml.AppendFormat("<span class=\"lanse\"><a href=\"/SupplierInfo/HonoredGuestInfo.aspx?id={0}\">[详细]</a></span></div></td>", model.ID); strInfoHtml.Append("</tr>"); strInfoHtml.Append("</table>"); } } GuestList = null; break; #endregion #region 业之星访谈 case PartTypes.业之星访谈: list = InfoBll.GetTopNumPicList(TopNumber, TopicClass, TopicArea, true, null); if (list != null && list.Count > 0) { foreach (EyouSoft.Model.CommunityStructure.InfoArticle model in list) { strInfoHtml.Append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"border-bottom:1px dashed #ccc; margin-top:5px; padding-bottom:2px;\">"); strInfoHtml.Append("<tr>"); strInfoHtml.AppendFormat("<td width=\"30%\"><img src=\"{0}\" width=\"50\" height=\"50\" /></td>", FileServerUrl + model.ImgThumb); strInfoHtml.AppendFormat("<td width=\"70%\" valign=\"top\" style=\"text-align:left\"><strong title=\"{2}\">{0}</strong><div style=\"margin-top:2px; color:#585858;\">{1}<br />", Utils.GetText(model.ArticleTitle, 26), "", model.ArticleTitle); strInfoHtml.AppendFormat("<span class=\"lanse\"><a target=\"_blank\" href=\"/SupplierInfo/ArticleInfo.aspx?id={0}\">[详细]</a></span></div></td>", model.ID); strInfoHtml.Append("</tr>"); strInfoHtml.Append("</table>"); } } list = null; break; #endregion } mainDiv.Controls.Add(new LiteralControl(string.Format(PicListHtmlFormat, PartCss, PartText, PartType == PartTypes.顾问团队 ? " <a href=\"/SupplierInfo/ApplicationTeam.aspx\" target=\"_blank\" class=\"heise12\">访谈申请</a>" : string.Empty, TextCss.Length > 0 ? " class=" + TextCss : "", strInfoHtml.ToString()))); }