void getTemplate() { #region -----------获取客户信息--------- MSCustomers CustomerModel = new MSCustomers(); MSCustomersDAL CustomerDal = new MSCustomersDAL(); DataSet CustomerDs; if (strUid != null && strUid != "") { CustomerDs = CustomerDal.GetCustomerDetail(strUid); if (null != CustomerDs && CustomerDs.Tables.Count > 0 && CustomerDs.Tables[0].Rows.Count > 0) { CustomerModel = DataConvert.DataRowToModel <MSCustomers>(CustomerDs.Tables[0].Rows[0]); if (CustomerModel.NickName == null || CustomerModel.NickName == "" || CustomerModel.NickName.ToLower() == "null") { CustomerModel.NickName = "游客"; } } } #endregion #region ----------获取帖子列表---------------- MSForumTopicDAL topicDal = new MSForumTopicDAL(); List <TopicModelList> topicModellist = new List <TopicModelList>(); int topicCount = 0; DataSet topiclistds = topicDal.GetMSForumTopicList(" and a.[UID]='" + strUid + "' ", 0); if (topiclistds != null && topiclistds.Tables.Count > 0 && topiclistds.Tables[0].Rows.Count > 0) { topicCount = topiclistds.Tables[0].Rows.Count; foreach (DataRow row in topiclistds.Tables[0].Rows) { TopicModelList topicmodel = DataConvert.DataRowToModel <TopicModelList>(row); if (topicmodel.NickName == null || topicmodel.NickName == "" || topicmodel.NickName.Length < 1) { topicmodel.NickName = "游客"; } if (topicmodel.HeadImg == null || topicmodel.HeadImg == "") { topicmodel.HeadImg = "images/2.png"; } string msg = topicmodel.TopicDesc; msg = JQDialog.GetTextFromHTML(msg); if (msg.Length > 250) { msg = msg.ToString().Substring(0, 100) + "..."; } topicmodel.TopicDesc = msg; topicModellist.Add(topicmodel); } } #endregion #region --------------获取喜欢 总数------------------ int likecount = 0; MSForumTopicLoveDAL likeDal = new MSForumTopicLoveDAL(); try { likecount = likeDal.GetLoveOrLikeCountByUID(strUid, "tlike"); } catch (Exception) { likecount = 0; } #endregion #region ------------获取消息总数--------------- int msgcount = 0; MSForumCommentDAL commentDal = new MSForumCommentDAL(); try { msgcount = commentDal.GetCommentCountByUID(strUid); } catch (Exception) { msgcount = 0; } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/othertopiclist.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); context.TempData["mytopiclist"] = topicModellist; context.TempData["topiccount"] = topicCount; context.TempData["customer"] = CustomerModel; context.TempData["fid"] = strfid; context.TempData["likecount"] = likecount; context.TempData["msgcount"] = msgcount; context.TempData["errorscript"] = errorscript; context.TempData["uid"] = strUid; context.TempData["myuid"] = strMyUid; context.TempData["footer"] = "奥琦微商易"; t.Render(Response.Output); }
void GetTopicList() { #region ---------------论坛详细---------------------- MSForumSetDAL ForumDal = new MSForumSetDAL(); MSForumTopicDAL topicDal = new MSForumTopicDAL(); MSForumSet ForumModel = new MSForumSet(); string pagetitle = string.Empty; int topicCount = 0; int forumvisit = 0; DataSet ForumDs = ForumDal.GetMSForumSetDetail(strfid); if (ForumDs != null && ForumDs.Tables.Count > 0 && ForumDs.Tables[0].Rows.Count > 0) { ForumModel = DataConvert.DataRowToModel <MSForumSet>(ForumDs.Tables[0].Rows[0]); pagetitle = ForumModel.FTitle; forumvisit = ForumModel.Visit; } try { topicCount = Convert.ToInt32(topicDal.GetMSForumTopicCount(strfid)); } catch (Exception) { topicCount = 0; } forumvisit = forumvisit + 1; if (strUID != null && strUID != "") { ForumDal.UpdateForumVist(forumvisit, strfid); } #endregion #region --------------获取帖子列表------------------ List <TopicModelList> topicModellist = new List <TopicModelList>(); DataSet topiclistds = topicDal.GetMSForumTopicList(" and a.fid='" + strfid + "' ", 0); if (topiclistds != null && topiclistds.Tables.Count > 0 && topiclistds.Tables[0].Rows.Count > 0) { foreach (DataRow row in topiclistds.Tables[0].Rows) { TopicModelList topicmodel = DataConvert.DataRowToModel <TopicModelList>(row); if (topicmodel.NickName == null || topicmodel.NickName == "" || topicmodel.NickName.Length < 1) { topicmodel.NickName = "游客"; } if (topicmodel.HeadImg == null || topicmodel.HeadImg == "") { topicmodel.HeadImg = "images/2.png"; } string msg = topicmodel.TopicDesc; msg = JQDialog.GetTextFromHTML(msg); if (msg.Length > 250) { msg = msg.ToString().Substring(0, 100) + "..."; } topicmodel.TopicDesc = msg; topicModellist.Add(topicmodel); } } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/index.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); context.TempData["errorscript"] = errorscript; context.TempData["uid"] = strUID; context.TempData["title"] = pagetitle; context.TempData["ForumDetail"] = ForumModel; context.TempData["topicCount"] = topicCount; context.TempData["topiclist"] = topicModellist; context.TempData["forumvisit"] = forumvisit; context.TempData["footer"] = "奥琦微商易"; t.Render(Response.Output); }