protected void Btnword_Click(object sender, EventArgs e) { string mynum = Request.Cookies["StudentCookies"].Values["Snum"].ToString(); string LoginIp = Request.Cookies["StudentCookies"].Values["LoginIp"].ToString(); string worknum = LabelWnum.Text; string workWords = Request.Form["textareaWord"].Trim(); string Wid = Request.QueryString["Wid"].ToString(); if (workWords != "") { if (workWords.Length > 10) { if (workWords.Length < 200) { string txtWords = HttpUtility.HtmlEncode(workWords); if (mynum == worknum) { LearnSite.BLL.Works bll = new LearnSite.BLL.Works(); bll.UpdateWself(Int32.Parse(Wid), txtWords); } else { LearnSite.Model.WorksDiscuss dmodel = new LearnSite.Model.WorksDiscuss(); LearnSite.BLL.WorksDiscuss dbll = new LearnSite.BLL.WorksDiscuss(); dmodel.Dip = LoginIp; dmodel.Dsnum = mynum; dmodel.Dtime = DateTime.Now; dmodel.Dwid = Int32.Parse(Wid); dmodel.Dwords = txtWords; dbll.Add(dmodel); } Btnword.Enabled = false; System.Threading.Thread.Sleep(500); Labeldiscuss.Text = "添加作品评价成功!"; ShowWork(); showGVworkDiscuss(); } else { Labeldiscuss.Text = "作品评价字数不能超过100个汉字!"; } } else { Labeldiscuss.Text = "作品评价字数不能少于6个汉字!"; } } }
protected void GVworkDiscuss_RowCommand(object sender, GridViewCommandEventArgs e) { string eid = e.CommandArgument.ToString(); if (e.CommandName == "Del") { int index = Convert.ToInt32(eid); LearnSite.BLL.WorksDiscuss wbll = new LearnSite.BLL.WorksDiscuss(); wbll.Delete(index);//删除一个作品评价 System.Threading.Thread.Sleep(500); showGVworkDiscuss(); } }
private void showGVworkDiscuss() { string Dwid = Request.QueryString["Wid"].ToString(); LearnSite.BLL.WorksDiscuss dbll = new LearnSite.BLL.WorksDiscuss(); GVworkDiscuss.DataSource = dbll.GetDiscussList(int.Parse(Dwid)); GVworkDiscuss.DataBind(); }