protected void btnCommit_Click(object sender, EventArgs e) { if (Textarea1.Value.Length == 0) { Javascript.GoHistory(-1, "请填写回复内容!", Page); return; } int lastPostId = 0; DalOperationAboutBbs dalOperationAboutBbs = new DalOperationAboutBbs(); UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo(); BbsPosts post = new BbsPosts { topicId = topicId, postContent = CommonUtility.JavascriptStringFilterAll(Textarea1.Value), postUserName = (UserCookiesInfo.userType != 3) ? UserCookiesInfo.userName : UserCookiesInfo.userNo + " " + UserCookiesInfo.userName, updateTime = DateTime.Now, attachmentIds = hidAttachmentId.Value, postUserNo = UserCookiesInfo.userNo, postUserType = UserCookiesInfo.userType, courseNo = forumId }; lastPostId = dalOperationAboutBbs.AddPostByTopicId(post); PageDataBinds(); hidAttachmentId.Value = string.Empty; Textarea1.Value = string.Empty; Javascript.JavaScriptLocationHref("#post" + lastPostId.ToString(), Page); }
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 DataResultTopic() { DalOperationAboutBbs DalOperationAboutBbs = new DalOperationAboutBbs(); DataSet ds = DalOperationAboutBbs.SearchTopic(txtSearchString.Text, forumId+classID+termTag); dv = ds.Tables[0].DefaultView; dlsttopicresult.DataSource = dv; dlsttopicresult.DataBind(); }
protected void DataResultPost() { DalOperationAboutBbs DalOperationAboutBbs = new DalOperationAboutBbs(); DataSet ds = DalOperationAboutBbs.SearchPost(txtSearchString.Text, forumId); dv = ds.Tables[0].DefaultView; //dlstpostresult.DataSource = dv; //dlstpostresult.DataBind(); }
protected void btnsearch_Click(object sender, EventArgs e) { dlsttopicresult.DataSource = null; dlsttopicresult.DataBind(); //dlstpostresult.DataSource = null; //dlstpostresult.DataBind(); DalOperationAboutBbs DalOperationAboutBbs = new DalOperationAboutBbs(); DataSet ds = new DataSet(); //dlsttopicresult.Visible = true; //dlstpostresult.Visible = false; DataResultTopic(); }
protected void DataResultPost() { DalOperationAboutBbs DalOperationAboutBbs = new DalOperationAboutBbs(); DataSet ds = DalOperationAboutBbs.SearchPost(txtSearchString.Text); DataView dv = ds.Tables[0].DefaultView; this.AspNetPager3.RecordCount = dv.Count; PagedDataSource pds = new PagedDataSource(); //定义一个PagedDataSource类来执行分页功 pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager3.CurrentPageIndex - 1; pds.PageSize = AspNetPager3.PageSize; dlstpostresult.DataSource = pds; dlstpostresult.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Master.ShowLiControl(this.Page, "liFragment2"); DalOperationAboutBbs dalOperationAboutBbs = new DalOperationAboutBbs(); DataSet dsCourses = dalOperationAboutBbs.GetAllForumsList(); foreach (DataRow dr0 in dsCourses.Tables["3"].Rows) { ht0.Add(dr0["courseNo"].ToString().Trim(), dr0["topicsCount"].ToString()); } foreach (DataRow dr1 in dsCourses.Tables["4"].Rows) { ht1.Add(dr1["courseNo"].ToString().Trim(), dr1["postIdCount"].ToString()); } foreach (DataRow dr2 in dsCourses.Tables["5"].Rows) { ht2.Add(dr2["courseNo"].ToString().Trim(), dr2["postUserName"].ToString()); ht3.Add(dr2["courseNo"].ToString().Trim(), dr2["updateTime"].ToString()); } foreach (DataRow dr3 in dsCourses.Tables["6"].Rows) { ht4.Add(dr3["courseNo"].ToString().Trim(), dr3["todayTopicsCount"].ToString()); } foreach (DataRow dr4 in dsCourses.Tables["7"].Rows) { ht5.Add(dr4["courseNo"].ToString().Trim(), dr4["todayPostsCount"].ToString()); } foreach (DataRow dr6 in dsCourses.Tables["8"].Rows) { ht6.Add(dr6["courseNo"].ToString().Trim(), dr6["updateTime"].ToString().Trim()); } this.dlstpic.DataSource = dsCourses.Tables["2"]; this.dlstpic.DataBind(); }
protected void btnCommit_Click(object sender, EventArgs e) { if (txtTilte.Text.Length == 0) { Javascript.GoHistory(-1, "请填写标题!", Page); return; } if (Textarea1.Value.Length == 0) { Javascript.GoHistory(-1, "请填写内容!", Page); return; } DalOperationAboutBbs dalOperationAboutBbs = new DalOperationAboutBbs(); UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo(); BbsTopics topic = new BbsTopics { courseNo = Request["forumId"], topicTitle = CommonUtility.JavascriptStringFilterAll(txtTilte.Text), topicContent = CommonUtility.JavascriptStringFilterAll(Textarea1.Value), topicUserName = (UserCookiesInfo.userType != 3) ? UserCookiesInfo.userName : UserCookiesInfo.userNo + " " + UserCookiesInfo.userName, updateTime = DateTime.Now, topicUserNo = UserCookiesInfo.userNo, topicUserType = UserCookiesInfo.userType, isbigTop=1 }; if (hidAttachmentId.Value.CompareTo(string.Empty) != 0) { topic.attachmentIds = hidAttachmentId.Value; } if (hasControls(Request["forumId"])) { dalOperationAboutBbs.AddTopicByForumId(topic);//添加新话题 } else { Javascript.GoHistory(-1, "您没有权限!", Page); } Javascript.RefreshParentWindow("BBSTopicList.aspx?tagName=" + Request["tagName"] + "&tag=2&forumId=" + Request["forumId"], Page); }
// /// <summary> ///// 提交话题标签功能代码 // /// </summary> // /// <param name="sender"></param> // /// <param name="e"></param> protected void btnCommit_Click(object sender, EventArgs e) { if (txtTilte.Text.Length == 0) { Javascript.GoHistory(-1, "请填写标题!", Page); return; } if (Textarea1.Value.Length == 0) { Javascript.GoHistory(-1, "请填写回复内容!", Page); return; } string tag = Request["tag"]; if (tag == "1") { forumId = Request["forumId"].Trim() + Server.UrlDecode(Request["classID"].Trim()) + Request["termtag"].Trim(); } DalOperationAboutBbs dalOperationAboutBbs = new DalOperationAboutBbs(); UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo(); BbsTopics topic = new BbsTopics { courseNo = forumId, topicTitle = CommonUtility.JavascriptStringFilterAll(txtTilte.Text), topicContent = CommonUtility.JavascriptStringFilterAll(Textarea1.Value), topicUserName = (UserCookiesInfo.userType != 3) ? UserCookiesInfo.userName : UserCookiesInfo.userNo + " " + UserCookiesInfo.userName, updateTime = DateTime.Now, topicUserNo = UserCookiesInfo.userNo, topicUserType = UserCookiesInfo.userType }; if (hidAttachmentId.Value.CompareTo(string.Empty) != 0) { topic.attachmentIds = hidAttachmentId.Value; } dalOperationAboutBbs.AddTopicByForumId(topic);//添加新话题 Javascript.AlertAndRedirect("添加主题成功!", "BBSTopicList.aspx?forumId=" + Request["forumId"] + "&classID=" + Server.UrlDecode(Request["classID"]) + "&termTag=" + Request["termTag"] + "&tag=" + tag, Page); }
protected void DataListBind() { DalOperationAboutBbs dalOperationAboutBbs = new DalOperationAboutBbs(); DataSet ds = dalOperationAboutBbs.GetAllTopicsByForumId(forumId); DataSet ds1 = dalOperationAboutBbs.GetTopicsTopByForumId(forumId); dlstTopTopic.DataSource = ds1.Tables[0]; dlstTopTopic.DataBind(); //填充HASHTABLE DataSet ds2 = dalOperationAboutBbs.GetLastPost(); DataTable dt0 = ds2.Tables["0"]; DataTable dt1 = ds2.Tables["1"]; foreach (DataRow dr0 in dt0.Rows) { ht0.Add(dr0["topicId"].ToString(), dr0["postsCount"].ToString()); } foreach (DataRow dr1 in dt1.Rows) { ht1.Add(dr1["topicId"].ToString(), dr1["postUserName"].ToString()); ht2.Add(dr1["topicId"].ToString(), dr1["updateTime"].ToString()); } DalOperationPatch dal = new DalOperationPatch(); DataSet dsNew = dal.GetLatestTopic(); DataSet dsTopicList = dal.GetLatestTopicAndPostsUpdateTime(); foreach (DataRow dr2 in dsTopicList.Tables[0].Rows) { ht3.Add(dr2["topicId"].ToString().Trim(), dr2["updateTime"].ToString().Trim()); } dlsttopics.DataSource = ds.Tables[0]; dlsttopics.DataBind(); }
/// <summary> /// 设置置顶 /// </summary> /// <param name="topicId"></param> private void setTop(int topicId) { DalOperationAboutBbs dalOperationAboutBbs = new DalOperationAboutBbs(); dalOperationAboutBbs.SetTopicOnTop(topicId); }
/// <summary> /// 取消置顶 /// </summary> /// <param name="topicId"></param> private void cancelTop(int topicId) { DalOperationAboutBbs dalOperationAboutBbs = new DalOperationAboutBbs(); dalOperationAboutBbs.CancelTopicOnTop(topicId); }
protected void Page_Load(object sender, EventArgs e) { switch (Request["tag"]) { case "1": Master.ShowLiControl(this.Page, "liFragment1"); if (Request["forumId"] == null || Request["classID"] == null || Request["termtag"] == null) { Javascript.Alert("参数错误", Page); Javascript.GoHistory(-1, Page); return; } break; case "2": Master.ShowLiControl(this.Page, "liFragment2"); break; case "3": Master.ShowLiControl(this.Page, "liFragment3"); break; default: break; } //控制Tab的显示 hasControl = hasControls(forumId); if (!IsPostBack) { ///删除话题 int topicId = 0; if (hasControl && CommonUtility.SafeCheckByParams<string>(Request["topicId"], ref topicId) && Request["del"] == "true") { deltopic(topicId); Javascript.Alert("删除成功!", Page); // Javascript.AlertAndRedirect("删除成功!", "BBSTopicList.aspx?forumId=" + Request["forumId"] + "&tag=" + tag, Page); } /// 设置置顶 if (hasControl && CommonUtility.SafeCheckByParams<string>(Request["toTopId"], ref topicId)) { setTop(topicId); } /// 取消置顶 int canceltopId = 0; if (hasControl && CommonUtility.SafeCheckByParams<string>(Request["cancelTopId"], ref canceltopId)) { cancelTop(canceltopId); } } if (Request["tag"] != null && Request["forumId"] != null) { string tag = Request["tag"]; if (tag == "1") { DalOperationAboutCourses dal1 = new DalOperationAboutCourses(); forumId = Request["forumId"].Trim() + Server.UrlDecode(Request["classID"].Trim()) + Request["termtag"].Trim(); tagName = dal1.GetCoursesByNo(Request["forumId"].Trim(), Server.UrlDecode(Request["classID"].Trim()), Request["termtag"].Trim()).courseName; } else { DalOperationAboutBbsManage dal3 = new DalOperationAboutBbsManage(); DalOperationAboutBbs dal2 = new DalOperationAboutBbs(); tagName = dal3.GetForumById(Request["forumId"]).forumTitle; } } DataListBind(); }
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(); } }
protected void DatalistBind(string term) { DalOperationAboutBbs dalOperationAboutBbs = new DalOperationAboutBbs(); DataSet dsCourses = new DataSet(); if ("当前学期" == term) { tags = "当前学期"; dsCourses = dalOperationAboutBbs.GetAllForumsList(); } else { //Response.Write(term); // Response.End(); tags = CommonUtility.ChangeTermToString(term); dsCourses = dalOperationAboutBbs.GetAllForumsList(term); } //if (fragmentFlag.Equals("1")) //{ foreach (DataRow dr0 in dsCourses.Tables["3"].Rows) { ht0.Add(dr0["courseNo"].ToString().Trim(), dr0["topicsCount"].ToString()); } foreach (DataRow dr1 in dsCourses.Tables["4"].Rows) { ht1.Add(dr1["courseNo"].ToString().Trim(), dr1["postIdCount"].ToString()); } foreach (DataRow dr2 in dsCourses.Tables["5"].Rows) { ht2.Add(dr2["courseNo"].ToString().Trim(), dr2["postUserName"].ToString()); ht3.Add(dr2["courseNo"].ToString().Trim(), dr2["updateTime"].ToString()); } foreach (DataRow dr3 in dsCourses.Tables["6"].Rows) { ht4.Add(dr3["courseNo"].ToString().Trim(), dr3["todayTopicsCount"].ToString()); } foreach (DataRow dr4 in dsCourses.Tables["7"].Rows) { ht5.Add(dr4["courseNo"].ToString().Trim(), dr4["todayPostsCount"].ToString()); } foreach (DataRow dr6 in dsCourses.Tables["8"].Rows) { ht6.Add(dr6["courseNo"].ToString().Trim(), dr6["updateTime"].ToString().Trim()); } this.dlstAboutCourses.DataSource = dsCourses.Tables[0]; this.dlstAboutCourses.DataBind(); //} /** if (fragmentFlag.Equals("2")) { this.dlstpic.DataSource = dsCourses.Tables["2"]; this.dlstpic.DataBind(); } if (fragmentFlag.Equals("3")) { this.dlstAboutOther.DataSource = dsCourses.Tables[1]; this.dlstAboutOther.DataBind(); } if (fragmentFlag.Equals("4")) { DalOperationPatch dalpa = new DalOperationPatch(); UserCookiesInfo user = BllOperationAboutUser.GetUserCookiesInfo(); string src = dalpa.GetAvatar(user.userNo, user.userType); ltavatar.Text = "<img src=\"" + src + "\">"; }*/ }
protected void Page_Load(object sender, EventArgs e) { if (Request["tag"] != null && Request["forumId"] != null) { string tag = Request["tag"]; if (tag == "1") { DalOperationAboutCourses dal1 = new DalOperationAboutCourses(); tagName = dal1.GetCoursesByNo(Request["forumId"], Server.UrlDecode(Request["classID"]), Request["termtag"]).courseName; } else { DalOperationAboutBbsManage dal3 = new DalOperationAboutBbsManage(); DalOperationAboutBbs dal2 = new DalOperationAboutBbs(); tagName = dal3.GetForumById(Request["forumId"]).forumTitle; } } else { Javascript.GoHistory(-1, Page); } }