protected void Page_Load(object sender, EventArgs e) { if (!hasControls(course)) { CommonUtility.RedirectLoginUrl(); return; } if (!IsPostBack) { int topicId=0; if (CommonUtility.SafeCheckByParams<string>(Request["topicId"], ref topicId)) { DalOperationAboutBbs dal = new DalOperationAboutBbs(); DataSet ds = dal.GetTopicAndPostsByTopicId(topicId); txtTitle.Text = ds.Tables["1"].Rows[0]["topicTitle"].ToString().Trim(); Textarea1.Value = ds.Tables["1"].Rows[0]["topicContent"].ToString().Trim(); hidAttachmentId.Value = ds.Tables["1"].Rows[0]["attachmentIds"].ToString().Trim(); if ( ds.Tables["1"].Rows[0]["attachmentIds"].ToString().Length > 0) { DalOperationAttachments dalOperationAttachments = new DalOperationAttachments(); ltlAttachment.Text = dalOperationAttachments.GetAttachmentsList(ds.Tables["1"].Rows[0]["attachmentIds"].ToString(), ref iframeCount, true,string.Empty); } } else { Javascript.GoHistory(-1, Page); } } }
protected void PageDataBinds() { if (CommonUtility.SafeCheckByParams<string>(Request["topicId"], ref topicId)) { DalOperationAboutBbs dal = new DalOperationAboutBbs(); dal.AddTopicHits(topicId.ToString()); DataSet ds = dal.GetTopicAndPostsByTopicId(topicId); if (ds.Tables["1"].Rows.Count > 0 && ds.Tables["1"].Rows.Count > 0) { courseNo = ds.Tables["1"].Rows[0]["courseNo"].ToString(); topicName = ds.Tables["1"].Rows[0]["topicTitle"].ToString(); } if (Request["tag"] != null) { if (tag == "1") { courseNo = Request["courseNo"]; DalOperationAboutCourses dal1 = new DalOperationAboutCourses(); tagName = dal1.GetCoursesByNo(Request["courseNo"],Server.UrlDecode(Request["classID"]),Request["termtag"]).courseName; } else { DalOperationAboutBbsManage dal3 = new DalOperationAboutBbsManage(); BbsForum f = dal3.GetForumById(courseNo); tagName = f.forumTitle; } } hascontrol = this.hasControl(courseNo); if (Request["del"] == "true") { int postId = 0; if (hascontrol && CommonUtility.SafeCheckByParams<string>(Request["postId"], ref postId)) { delpost(postId); Javascript.AlertAndRedirect("删除成功!", "BBSViewTopic.aspx?tag=" + tag + "&topicId=" + Request["topicId"], Page); return; } int topicd = 0; if (hascontrol && CommonUtility.SafeCheckByParams<string>(Request["topicId"], ref topicd) && Request["postId"] == null) { //deltopic(topicd); //Javascript.AlertAndRedirect("删除成功!", "BBSTopicList.aspx?forumId=" + courseNo +"&classID="+Server.UrlDecode(Request["classID"])+"termtag="+Request["termtag"]+ "&tag=" + tag, Page); // Javascript.JavaScriptLocationHref("BBSTopicList.aspx?del=true&forumId=" + courseNo + "&classID=" + Server.UrlDecode(Request["classID"]) + "&termtag="+Request["termtag"]+"&topicId=166&tag=1", Page); return; } else { Javascript.Alert("不能删除!", Page); return; } } dlsttopic.DataSource = ds.Tables["1"]; dlsttopic.DataBind(); dlstposts.DataSource = ds.Tables["0"]; dlstposts.DataBind(); } }