void showdetailinfo() { MSForumTopicDAL topicDal = new MSForumTopicDAL(); DataSet ds = topicDal.GetTopicDetail(strID); MSForumTopic topicModel = DataConvert.DataRowToModel <MSForumTopic>(ds.Tables[0].Rows[0]); topictitle.Text = topicModel.TopicTitle; hd_content.Value = topicModel.TopicDesc; MSForumTopicAtlasDAL AtlasDal = new MSForumTopicAtlasDAL(); DataSet atlasds = AtlasDal.GetMSFTAtlasList(" AND TID='" + strID + "' "); if (atlasds != null && atlasds.Tables.Count > 0 && atlasds.Tables[0].Rows.Count > 0) { topicaltaslist = ""; string atlasimg = ""; for (int i = 0; i < atlasds.Tables[0].Rows.Count; i++) { atlasimg = atlasds.Tables[0].Rows[i]["ImgUrl"].ToString(); topicaltaslist += "<img src=\"../../Comment/" + atlasimg + "\" />"; } } if (strAction == "show") { this.btnReset.Visible = false; this.btnSave.Visible = false; } }
/// <summary> /// 图集上传 /// </summary> /// <returns></returns> private Boolean SaveImages() { HttpFileCollection files = HttpContext.Current.Request.Files; try { MSForumTopicAtlas atlasModel = new MSForumTopicAtlas(); atlasModel.TID = strTid; for (int iFile = 0; iFile < files.Count; iFile++) { //检查文件扩展名字 HttpPostedFile postedFile = files[iFile]; string fileName, fileExtension, file_oldid, file_id; //取出精确到毫秒的时间做文件的名称 string my_file_id = DateTime.Now.ToString("yyyyMMddHHmmssfff") + iFile.ToString(); fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); file_id = my_file_id + fileExtension; if (fileName != "" && fileName != null && fileName.Length > 0) { fileExtension = System.IO.Path.GetExtension(fileName); string saveurl, modelimgurl; saveurl = modelimgurl = "ForumImg/"; saveurl = Server.MapPath(saveurl); if (!Directory.Exists(saveurl)) { Directory.CreateDirectory(saveurl); } int length = postedFile.ContentLength; if (length > 512000) { file_oldid = "old" + file_id; postedFile.SaveAs(saveurl + file_oldid); JQDialog.ystp(saveurl + file_oldid, saveurl + file_id, 15); File.Delete(saveurl + file_oldid); } else { postedFile.SaveAs(saveurl + file_id); } atlasModel.ID = Guid.NewGuid().ToString("N").ToUpper(); atlasModel.ImgState = 0; atlasModel.ImgUrl = modelimgurl + file_id; atlasModel.ImgName = topictitle; MSForumTopicAtlasDAL atlasDal = new MSForumTopicAtlasDAL(); atlasDal.AddMSForumTopicAtlas(atlasModel); } } return(true); } catch (System.Exception Ex) { return(false); } }
void showdetailinfo() { MSForumCommentDAL CommDal = new MSForumCommentDAL(); DataSet ds = CommDal.GetCommentDetail(strID); MSForumComment CommModel = DataConvert.DataRowToModel <MSForumComment>(ds.Tables[0].Rows[0]); hd_content.Value = CommModel.Ctext; MSForumTopicAtlasDAL AtlasDal = new MSForumTopicAtlasDAL(); DataSet atlasds = AtlasDal.GetMSFTAtlasList(" AND TID='comm" + strID + "' "); if (atlasds != null && atlasds.Tables.Count > 0 && atlasds.Tables[0].Rows.Count > 0) { topicaltaslist = ""; string atlasimg = ""; for (int i = 0; i < atlasds.Tables[0].Rows.Count; i++) { atlasimg = atlasds.Tables[0].Rows[i]["ImgUrl"].ToString(); topicaltaslist += "<img src=\"../../Comment/" + atlasimg + "\" />"; } } }
void getTemplate() { #region --------------帖子详细-------------------------- MSForumTopic TopicModel = new MSForumTopic(); MSForumTopicDAL TopicDel = new MSForumTopicDAL(); DataSet TopicDs = TopicDel.GetTopicDetail(strtid); if (null != TopicDs && TopicDs.Tables.Count > 0 && TopicDs.Tables[0].Rows.Count > 0) { TopicModel = DataConvert.DataRowToModel <MSForumTopic>(TopicDs.Tables[0].Rows[0]); } #endregion #region -----------帖子图集---------------- List <MSForumTopicAtlas> atlasModelList = new List <MSForumTopicAtlas>(); MSForumTopicAtlasDAL atlasDal = new MSForumTopicAtlasDAL(); DataSet altasDs = atlasDal.GetMSFTAtlasList(" and tid='" + strtid + "'"); if (altasDs != null && altasDs.Tables.Count > 0 && altasDs.Tables[0].Rows.Count > 0) { foreach (DataRow row in altasDs.Tables[0].Rows) { MSForumTopicAtlas atlasModel = DataConvert.DataRowToModel <MSForumTopicAtlas>(row); atlasModelList.Add(atlasModel); } } #endregion #region ---------点赞或喜欢------------ MSForumTopicLoveDAL lovelikeDal = new MSForumTopicLoveDAL(); string likecount = lovelikeDal.GetLoveOrLikeCount(strtid, "tlike").ToString(); string lovecount = lovelikeDal.GetLoveOrLikeCount(strtid, "tlove").ToString(); #endregion #region ---------评论列表以及图集信息------------ List <CommentListGetSet> commentModelList = new List <CommentListGetSet>(); MSForumCommentDAL commentDal = new MSForumCommentDAL(); DataSet commentDs = commentDal.GetCommentList(" and a.tid='" + strtid + "' "); List <MSForumTopicAtlas> commatlasModelList = new List <MSForumTopicAtlas>(); int commentcount = 0; if (commentDs != null && commentDs.Tables.Count > 0 && commentDs.Tables[0].Rows.Count > 0) { foreach (DataRow row in commentDs.Tables[0].Rows) { CommentListGetSet commentModel = DataConvert.DataRowToModel <CommentListGetSet>(row); string cmmid = commentModel.ID; if (commentModel.NickName == null || commentModel.NickName == "") { commentModel.NickName = "游客"; } #region ------------评论图集----------------------- DataSet commaltasDs = atlasDal.GetMSFTAtlasList(" and tid='comm" + cmmid + "'"); if (commaltasDs != null && commaltasDs.Tables.Count > 0 && commaltasDs.Tables[0].Rows.Count > 0) { foreach (DataRow commrow in commaltasDs.Tables[0].Rows) { MSForumTopicAtlas atlasModel = DataConvert.DataRowToModel <MSForumTopicAtlas>(commrow); commatlasModelList.Add(atlasModel); } } #endregion commentModelList.Add(commentModel); } } try { commentcount = commentDs.Tables[0].Rows.Count; } catch (Exception) { commentcount = 0; } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/commentlist.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); context.TempData["topicdetail"] = TopicModel; context.TempData["altaslist"] = atlasModelList; context.TempData["commentlist"] = commentModelList; context.TempData["commentatlaslist"] = commatlasModelList; context.TempData["commentcount"] = commentcount; context.TempData["errorscript"] = errorscript; context.TempData["likecount"] = likecount; context.TempData["lovecount"] = lovecount; context.TempData["fid"] = strfid; context.TempData["uid"] = strUid; context.TempData["footer"] = "奥琦微商易"; t.Render(Response.Output); }