private void showreply() { int sgrade = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgrade"].ToString()); int sclass = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString()); string rsnum = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString(); int rsid = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sid"].ToString()); int rtid = Int32.Parse(Request.QueryString["Tid"].ToString()); LearnSite.BLL.TopicReply rbll = new LearnSite.BLL.TopicReply(); if (Btnword.Text == "老师总结") { GVtopicDiscuss.DataSource = rbll.GetClassList(sgrade, sclass, rtid); GVtopicDiscuss.DataBind(); Labelreplycount.Text = "共" + GVtopicDiscuss.Rows.Count.ToString() + "贴"; Labelreplycountbtm.Text = Labelreplycount.Text; } else { if (rbll.ReplyCount(rtid, rsid) > 0) { GVtopicDiscuss.DataSource = rbll.GetClassList(sgrade, sclass, rtid); GVtopicDiscuss.DataBind(); Labelreplycount.Text = "共" + GVtopicDiscuss.Rows.Count.ToString() + "贴"; Labelreplycountbtm.Text = Labelreplycount.Text; } } Labelnostu.Text = rbll.GetNoReplay(sgrade, sclass, rtid); }
protected void Btnword_Click(object sender, EventArgs e) { int rsid = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sid"].ToString()); string rsnum = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString(); string rip = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["LoginIp"].ToString(); string rgrade = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgrade"].ToString(); string rclass = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString(); string ryear = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Syear"].ToString(); string rterm = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["ThisTerm"].ToString(); int rtid = Int32.Parse(Request.QueryString["Tid"].ToString()); int rcid = Int32.Parse(Request.QueryString["Cid"].ToString()); string rwords = Request.Form["textareaWord"].Trim(); string tempcut = LearnSite.Common.WordProcess.DropHTML(rwords); int counts = tempcut.Length; int rscore = 0; bool rban = false; if (counts > 5 && counts < 500) { rwords = rwords.Replace("<br />", ""); rwords = rwords.Replace(",", ","); LearnSite.BLL.TopicReply rbll = new LearnSite.BLL.TopicReply(); LearnSite.Model.TopicReply rmodel = new LearnSite.Model.TopicReply(); rmodel.Rban = rban; rmodel.Rip = rip; rmodel.Rscore = rscore; rmodel.Rsnum = rsnum; rmodel.Rtid = rtid; rmodel.Rtime = DateTime.Now; rmodel.Rwords = HttpUtility.HtmlEncode(rwords); rmodel.Rgrade = Int32.Parse(rgrade); rmodel.Rterm = Int32.Parse(rterm); rmodel.Rcid = rcid; rmodel.Rclass = Int32.Parse(rclass); rmodel.Rsid = rsid; rmodel.Ryear = Int32.Parse(ryear); rmodel.Redit = false; rmodel.Ragree = 0; int myreply = rbll.ReplyCount(rtid, rsid);//获取该学号回复数 if (Btnword.Text == "老师总结") { if (myreply > 0) { rbll.UpdateTeacher(rtid, rsid, rwords);//更新老师总结 } else { rbll.Add(rmodel);//增加老师总结 } Labeldiscuss.Text = "总结成功!"; } else { bool historyban = rbll.Isban(rtid, rsid); if (!historyban) { if (myreply < 1) { rbll.Add(rmodel);//增加一条回复 Labeldiscuss.Text = "回复成功!"; } else { if (rbll.Isedit(rtid, rsid)) { rbll.UpdateOne(rmodel);//修改一条回复 Labeldiscuss.Text = "修改成功!"; } else { Labeldiscuss.Text = "默认回复最多为1次!"; } } } else { Labeldiscuss.Text = "你在回复中存在违纪言论已被老师禁言!"; } } System.Threading.Thread.Sleep(500); showtopic(); showreply(); } else { Labeldiscuss.Text = "回复不能少于6个汉字或超过300个汉字,谢谢!"; } }