Пример #1
0
 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个汉字!";
         }
     }
 }