protected void BtnVote_Click(object sender, EventArgs e) { string indexstr = BtnVote.CommandArgument; if (!string.IsNullOrEmpty(indexstr)) { if (Request.QueryString["Mid"] != null) { if (DataListGauge.Items.Count > 0) { SelectItems myselect = new SelectItems(); myselect.FindCheck(DataListGauge); if (myselect.CheckCount > 0) { string myWmid = Request.QueryString["Mid"].ToString(); string myCid = Request.QueryString["Cid"].ToString(); string Wid = ((Label)DataListvote.Items[Int32.Parse(indexstr)].FindControl("LabelWid")).Text; int Widn = Int32.Parse(Wid); string Wflash = ((Label)DataListvote.Items[Int32.Parse(indexstr)].FindControl("LabelWflash")).Text; LearnSite.BLL.Works wbll = new LearnSite.BLL.Works(); LearnSite.BLL.GaugeFeedback kbll = new LearnSite.BLL.GaugeFeedback(); string Wname = ((LinkButton)DataListvote.Items[Int32.Parse(indexstr)].FindControl("lBtnSname")).Text; int MySid = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sid"].ToString()); string MySnum = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString(); string Mygrade = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgrade"].ToString(); string Myclass = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString(); if (!kbll.ExistsFnum(Widn, MySid)) //检测是否给该同学投过票,如果未投过则。。。 { int iv = wbll.GetWegg(Int32.Parse(myWmid), MySid); //从数据库中获取可投次数 if (iv > 0) { LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); ws.UpdateWvote(Widn); //别人的得票数加1 iv = iv - 1; //我的投票次数减1 ws.UpdateWegg(Int32.Parse(myWmid), MySnum); LearnSite.Model.GaugeFeedback kmodel = new LearnSite.Model.GaugeFeedback(); kmodel.Fcid = Int32.Parse(myCid); kmodel.Fclass = Int32.Parse(Myclass); kmodel.Fdate = DateTime.Now; kmodel.Fgid = Int32.Parse(LabelMgid.Text); kmodel.Fgood = CheckBoxGood.Checked; kmodel.Fgrade = Int32.Parse(Mygrade); kmodel.Fmid = 0;//任务编号暂时为0,无用参数 kmodel.Fnum = MySnum; kmodel.Fscore = myselect.CheckScore; kmodel.Fselect = myselect.CheckSelect; kmodel.Fwid = Widn; kmodel.Fsid = MySid; kbll.Add(kmodel);//添加互评记录 Labelmsg.Text = "给" + Wname + "同学投票互评成功!"; System.Threading.Thread.Sleep(200); int Wfscore = kbll.AvgFwid(Widn); ws.UpdateWfscore(Widn, Wfscore); System.Threading.Thread.Sleep(200); Labelegg.Text = iv.ToString(); Labelwfscore.Text = ws.GetWfscore(Int32.Parse(Wid)).ToString(); } else { Labelmsg.Text = "您的投票次数已经用完!"; } } else { Labelmsg.Text = "你已经给" + Wname + "同学投过票了!"; } } else { Labelmsg.Text = "未选中互评选项,无法给与投票!"; } } else { Labelmsg.Text = "没有互评选项,请咨询老师给该活动添加量规!"; } } } else { Labelmsg.Text = "请点击作品,预览后再进行投票!"; } }