/// <summary> /// 更新一条数据 /// </summary> public bool Update(LearnSite.Model.GaugeFeedback model) { return(dal.Update(model)); }
/// <summary> /// 获得数据列表 /// </summary> public List <LearnSite.Model.GaugeFeedback> DataTableToList(DataTable dt) { List <LearnSite.Model.GaugeFeedback> modelList = new List <LearnSite.Model.GaugeFeedback>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LearnSite.Model.GaugeFeedback model; for (int n = 0; n < rowsCount; n++) { model = new LearnSite.Model.GaugeFeedback(); if (dt.Rows[n]["Fid"] != null && dt.Rows[n]["Fid"].ToString() != "") { model.Fid = int.Parse(dt.Rows[n]["Fid"].ToString()); } if (dt.Rows[n]["Fnum"] != null && dt.Rows[n]["Fnum"].ToString() != "") { model.Fnum = dt.Rows[n]["Fnum"].ToString(); } if (dt.Rows[n]["Fgrade"] != null && dt.Rows[n]["Fgrade"].ToString() != "") { model.Fgrade = int.Parse(dt.Rows[n]["Fgrade"].ToString()); } if (dt.Rows[n]["Fclass"] != null && dt.Rows[n]["Fclass"].ToString() != "") { model.Fclass = int.Parse(dt.Rows[n]["Fclass"].ToString()); } if (dt.Rows[n]["Fcid"] != null && dt.Rows[n]["Fcid"].ToString() != "") { model.Fcid = int.Parse(dt.Rows[n]["Fcid"].ToString()); } if (dt.Rows[n]["Fmid"] != null && dt.Rows[n]["Fmid"].ToString() != "") { model.Fmid = int.Parse(dt.Rows[n]["Fmid"].ToString()); } if (dt.Rows[n]["Fwid"] != null && dt.Rows[n]["Fwid"].ToString() != "") { model.Fwid = int.Parse(dt.Rows[n]["Fwid"].ToString()); } if (dt.Rows[n]["Fgid"] != null && dt.Rows[n]["Fgid"].ToString() != "") { model.Fgid = int.Parse(dt.Rows[n]["Fgid"].ToString()); } if (dt.Rows[n]["Fselect"] != null && dt.Rows[n]["Fselect"].ToString() != "") { model.Fselect = dt.Rows[n]["Fselect"].ToString(); } if (dt.Rows[n]["Fscore"] != null && dt.Rows[n]["Fscore"].ToString() != "") { model.Fscore = int.Parse(dt.Rows[n]["Fscore"].ToString()); } if (dt.Rows[n]["Fgood"] != null && dt.Rows[n]["Fgood"].ToString() != "") { if ((dt.Rows[n]["Fgood"].ToString() == "1") || (dt.Rows[n]["Fgood"].ToString().ToLower() == "true")) { model.Fgood = true; } else { model.Fgood = false; } } if (dt.Rows[n]["Fdate"] != null && dt.Rows[n]["Fdate"].ToString() != "") { model.Fdate = DateTime.Parse(dt.Rows[n]["Fdate"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LearnSite.Model.GaugeFeedback model) { return(dal.Add(model)); }
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 = "请点击作品,预览后再进行投票!"; } }