private void showsurvey() { if (Request.QueryString["Vid"] != null) { string vid = Request.QueryString["Vid"].ToString(); LearnSite.Model.Survey vmodel = new LearnSite.Model.Survey(); LearnSite.BLL.Survey vbll = new LearnSite.BLL.Survey(); vmodel = vbll.GetModel(Int32.Parse(vid)); Lbave.Text = vmodel.Vaverage.ToString(); bool isClose = vmodel.Vclose; if (isClose) { Btnclock.ImageUrl = "~/Images/clockred.gif" + "?temp=" + DateTime.Now.Millisecond.ToString(); Btnclock.ToolTip = "调查暂停!"; } else { Btnclock.ImageUrl = "~/Images/clock.gif" + "?temp=" + DateTime.Now.Millisecond.ToString(); Btnclock.ToolTip = "调查开启!"; } Lbdate.Text = vmodel.Vdate.ToString(); Lbscore.Text = vmodel.Vscore.ToString(); Lbtitle.Text = vmodel.Vtitle; if (vmodel.Vtype.Value == 0) { Lbtype.Text = "调查"; } else { Lbtype.Text = "测验"; } vcontent.InnerHtml = HttpUtility.HtmlDecode(vmodel.Vcontent); } }
private void showSurvey() { if (Request.QueryString["Vid"] != null && Request.QueryString["Cid"] != null) { string vid = Request.QueryString["Vid"].ToString(); LearnSite.Model.Survey vmodel = new LearnSite.Model.Survey(); LearnSite.BLL.Survey vbll = new LearnSite.BLL.Survey(); vmodel = vbll.GetModel(Int32.Parse(vid)); Lbtitle.Text = vmodel.Vtitle; vcontent.InnerHtml = HttpUtility.HtmlDecode(vmodel.Vcontent); int vtype = vmodel.Vtype.Value; Lbtype.Text = vtype.ToString(); if (vtype > 0) { Lbtypecn.Text = "测验"; } else { Lbtypecn.Text = "调查"; } showQuestion(); bool isClose = vmodel.Vclose; if (isClose) { Btnclock.ImageUrl = "~/Images/clockred.gif" + "?temp=" + DateTime.Now.Millisecond.ToString(); Btnclock.ToolTip = "调查已经关闭,请咨询老师!"; } else { Btnclock.ImageUrl = "~/Images/clock.gif" + "?temp=" + DateTime.Now.Millisecond.ToString(); Btnclock.ToolTip = "调查开启,请开始回答!"; } } }
private void showsurvey() { if (Request.QueryString["Vid"] != null) { Btnadd.Text = "修改调查"; string vid = Request.QueryString["Vid"].ToString(); LearnSite.Model.Survey vmodel = new LearnSite.Model.Survey(); LearnSite.BLL.Survey vbll = new LearnSite.BLL.Survey(); vmodel = vbll.GetModel(Int32.Parse(vid)); Texttitle.Text = vmodel.Vtitle; DDLvtype.SelectedValue = vmodel.Vtype.ToString(); CheckClose.Checked = vmodel.Vclose; mcontent.InnerText = HttpUtility.HtmlDecode(vmodel.Vcontent); } }
private void showSurvey() { if (Request.QueryString["Vid"] != null && Request.QueryString["Cid"] != null) { int vid = Int32.Parse(Request.QueryString["Vid"].ToString()); int syear = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Syear"].ToString()); 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()); int sterm = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["ThisTerm"].ToString()); int cid = Int32.Parse(Request.QueryString["Cid"].ToString()); LearnSite.Model.Survey vmodel = new LearnSite.Model.Survey(); LearnSite.BLL.Survey vbll = new LearnSite.BLL.Survey(); vmodel = vbll.GetModel(vid); int vtype = vmodel.Vtype.Value; Lbtitle.Text = "《" + vmodel.Vtitle + "》班级统计分析"; vcontent.InnerHtml = HttpUtility.HtmlDecode(vmodel.Vcontent); Lbdate.Text = vmodel.Vdate.ToString(); Lbsgrade.Text = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgrade"].ToString(); string fnum = Server.UrlDecode(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString()); Lbsclass.Text = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString(); bool isClose = vmodel.Vclose; if (!isClose) { surveyClass();//更新统计 } else { itemandcount = surveyClassView(syear, sgrade, sclass, sterm, cid, vid);//历史统计显示 } if (fnum.IndexOf('s') > -1) { Btnrefresh.Visible = true;//限制为模拟学生可以进行统计(方便老师,减少数据库查询) } else { Btnrefresh.Visible = false; } showQuestion();//显示问题 LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback(); Lbstus.Text = fbll.GetSurveyStu(sgrade, sclass, cid, vid).ToString() + "人"; stuList.InnerHtml = "未参与同学列表:<br />" + fbll.GetNoSurveyStu(sgrade, sclass, cid, vid); HLclassrank.NavigateUrl = "mysurveyrank.aspx?Vid=" + vid; HLclassrank.Visible = true; } }
private void showFscore() { if (Request.QueryString["Vid"] != null) { 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()); int vid = Int32.Parse(Request.QueryString["Vid"].ToString()); LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback(); GridViewclass.DataSource = fbll.GetClassFscore(sgrade, sclass, vid); GridViewclass.DataBind(); LearnSite.BLL.Survey vbll = new LearnSite.BLL.Survey(); LearnSite.Model.Survey model = new LearnSite.Model.Survey(); model = vbll.GetModel(vid); Labeltitle.Text = HttpUtility.HtmlDecode(model.Vtitle); if (GridViewclass.Rows.Count < 1) { Labelmsg.Text = "暂无排行!"; } } }
protected void Btnadd_Click(object sender, EventArgs e) { string fckstr = mcontent.InnerText; if (Texttitle.Text != "" && fckstr != "") { if (Request.QueryString["Cid"] != null) { LearnSite.Model.TeaCook tcook = new LearnSite.Model.TeaCook(); string hidstr = tcook.Hid.ToString(); int Vcid = Int32.Parse(Request.QueryString["Cid"].ToString()); LearnSite.BLL.Survey vbll = new LearnSite.BLL.Survey(); LearnSite.Model.Survey vmodel = new LearnSite.Model.Survey(); vmodel.Vcid = Vcid; vmodel.Vclose = CheckClose.Checked; vmodel.Vcontent = HttpUtility.HtmlEncode(fckstr); vmodel.Vdate = DateTime.Now; vmodel.Vhid = Int32.Parse(hidstr); bool vp = false; vmodel.Vpoint = vp; vmodel.Vtitle = Texttitle.Text.Trim(); int Vtype = Int32.Parse(DDLvtype.SelectedValue); vmodel.Vtype = Vtype; //Vcid,Vhid,Vtitle,Vcontent,Vtype,Vclose,Vpoint,Vdate string url = ""; LearnSite.Model.ListMenu lmodel = new LearnSite.Model.ListMenu(); LearnSite.BLL.ListMenu lbll = new LearnSite.BLL.ListMenu(); lmodel.Lcid = Vcid; lmodel.Lshow = true; lmodel.Lsort = lbll.GetMaxLsort(Vcid) + 1; lmodel.Ltitle = Texttitle.Text.Trim(); lmodel.Ltype = 2; if (Request.QueryString["Vid"] != null) { int vid = Int32.Parse(Request.QueryString["Vid"].ToString()); vmodel.Vid = vid; vbll.UpdateSurvey(vmodel); //更新到调查表中 lmodel.Lxid = vid; lbll.UpdateLtitle(lmodel); //更新到导航中 LearnSite.BLL.SurveyFeedback fkbll = new LearnSite.BLL.SurveyFeedback(); fkbll.UpdateFvtype(vid, Vtype); //2014-3-15修订,如果调查类型改变的话,同时也改变调查结果记录中的类型 url = "~/Survey/survey.aspx?Cid=" + Vcid + "&Vid=" + vid; System.Threading.Thread.Sleep(500); } else { int newvid = vbll.Addsurvey(vmodel); //增加到调查表中 lmodel.Lxid = newvid; lbll.Add(lmodel); //增加到导航中 System.Threading.Thread.Sleep(500); url = "~/Survey/survey.aspx?Cid=" + Vcid + "&Vid=" + newvid; } Response.Redirect(url, false); } } else { Labelmsg.Text = "内容及标题不能为空!"; } }
/// <summary> /// 更新一条数据 /// </summary> public bool UpdateSurvey(LearnSite.Model.Survey model) { return(dal.UpdateSurvey(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LearnSite.Model.Survey model) { return(dal.Add(model)); }
/// <summary> /// 获得数据列表 /// </summary> public List <LearnSite.Model.Survey> DataTableToList(DataTable dt) { List <LearnSite.Model.Survey> modelList = new List <LearnSite.Model.Survey>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LearnSite.Model.Survey model; for (int n = 0; n < rowsCount; n++) { model = new LearnSite.Model.Survey(); if (dt.Rows[n]["Vid"] != null && dt.Rows[n]["Vid"].ToString() != "") { model.Vid = int.Parse(dt.Rows[n]["Vid"].ToString()); } if (dt.Rows[n]["Vcid"] != null && dt.Rows[n]["Vcid"].ToString() != "") { model.Vcid = int.Parse(dt.Rows[n]["Vcid"].ToString()); } if (dt.Rows[n]["Vhid"] != null && dt.Rows[n]["Vhid"].ToString() != "") { model.Vhid = int.Parse(dt.Rows[n]["Vhid"].ToString()); } if (dt.Rows[n]["Vtitle"] != null && dt.Rows[n]["Vtitle"].ToString() != "") { model.Vtitle = dt.Rows[n]["Vtitle"].ToString(); } if (dt.Rows[n]["Vcontent"] != null && dt.Rows[n]["Vcontent"].ToString() != "") { model.Vcontent = dt.Rows[n]["Vcontent"].ToString(); } if (dt.Rows[n]["Vtype"] != null && dt.Rows[n]["Vtype"].ToString() != "") { model.Vtype = int.Parse(dt.Rows[n]["Vtype"].ToString()); } if (dt.Rows[n]["Vtotal"] != null && dt.Rows[n]["Vtotal"].ToString() != "") { model.Vtotal = int.Parse(dt.Rows[n]["Vtotal"].ToString()); } if (dt.Rows[n]["Vscore"] != null && dt.Rows[n]["Vscore"].ToString() != "") { model.Vscore = int.Parse(dt.Rows[n]["Vscore"].ToString()); } if (dt.Rows[n]["Vaverage"] != null && dt.Rows[n]["Vaverage"].ToString() != "") { model.Vaverage = int.Parse(dt.Rows[n]["Vaverage"].ToString()); } if (dt.Rows[n]["Vclose"] != null && dt.Rows[n]["Vclose"].ToString() != "") { if ((dt.Rows[n]["Vclose"].ToString() == "1") || (dt.Rows[n]["Vclose"].ToString().ToLower() == "true")) { model.Vclose = true; } else { model.Vclose = false; } } if (dt.Rows[n]["Vpoint"] != null && dt.Rows[n]["Vpoint"].ToString() != "") { if ((dt.Rows[n]["Vpoint"].ToString() == "1") || (dt.Rows[n]["Vpoint"].ToString().ToLower() == "true")) { model.Vpoint = true; } else { model.Vpoint = false; } } if (dt.Rows[n]["Vdate"] != null && dt.Rows[n]["Vdate"].ToString() != "") { model.Vdate = DateTime.Parse(dt.Rows[n]["Vdate"].ToString()); } modelList.Add(model); } } return(modelList); }
private void showSurvey() { if (Request.QueryString["Vid"] != null && Request.QueryString["Cid"] != null) { int vid = Int32.Parse(Request.QueryString["Vid"].ToString()); int cid = Int32.Parse(Request.QueryString["Cid"].ToString()); string fnum = cook.Snum; LearnSite.Model.Survey vmodel = new LearnSite.Model.Survey(); LearnSite.BLL.Survey vbll = new LearnSite.BLL.Survey(); vmodel = vbll.GetModel(vid); Lbtitle.Text = vmodel.Vtitle; vcontent.InnerHtml = HttpUtility.HtmlDecode(vmodel.Vcontent); int vtype = vmodel.Vtype.Value; Lbtype.Text = vtype.ToString(); if (vtype > 0) { Lbtypecn.Text = "测验"; } else { Lbtypecn.Text = "调查"; } Lbsname.Text = Server.UrlDecode(cook.Sname); Lbsnum.Text = fnum; bool isClose = vmodel.Vclose; if (isClose) { Btnclock.ImageUrl = "~/Images/clockred.gif" + "?temp=" + DateTime.Now.Millisecond.ToString(); Btnclock.ToolTip = "暂停,请咨询老师!"; } else { Btnclock.ImageUrl = "~/Images/clock.gif" + "?temp=" + DateTime.Now.Millisecond.ToString(); Btnclock.ToolTip = "开启,请开始回答!"; showQuestion(); } int myscore = GetMyScore(vid, fnum); if (myscore != -1024) { //如果已经回答过调查 Btnok.Visible = false; Lbcheck.Text = "已完成!"; Lbcheck.BackColor = System.Drawing.Color.Green; Lbfscore.Text = myscore.ToString(); int syear = cook.Syear; int sgrade = cook.Sgrade; int sclass = cook.Sclass; LearnSite.BLL.Students sbll = new LearnSite.BLL.Students(); int cns = sbll.CountClassMate(sgrade, sclass); LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback(); int dcn = fbll.GetSurveyStu(sgrade, sclass, cid, vid); if (dcn == cns) { Btnshow.Visible = true; } } else { Lbfscore.Text = "0"; if (isClose) { Btnok.Visible = false;//如果关闭调查,则提交按钮无效 } else { Btnok.Visible = true; if (Session[fnum + "survey" + vid] != null) { DateTime oldtime = DateTime.Parse(Session[fnum + "survey" + vid].ToString()); DateTime nowtime = DateTime.Now; Lbtime.Text = LearnSite.Common.Computer.DatagoneMinute(oldtime, nowtime); } else { Session[fnum + "survey" + vid] = DateTime.Now.ToString(); } } Lbcheck.Text = "未完成!"; Lbcheck.BackColor = System.Drawing.Color.Red; Btnshow.Visible = false; } if (fnum.IndexOf('s') > -1) { Btnshow.Visible = true; Btnok.Visible = false; Btnclock.Enabled = true; } else { Btnclock.Enabled = false; } } }