protected void DataListonly_ItemDataBound(object sender, DataListItemEventArgs e) { string qid = DataListonly.DataKeys[e.Item.ItemIndex].ToString(); if (!string.IsNullOrEmpty(qid)) { LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem(); GridView gv = (GridView)e.Item.FindControl("GridView1"); DataTable ddt = mbll.GetListByMqid(Int32.Parse(qid)).Tables[0]; gv.DataSource = DeelTable(ddt); gv.DataBind(); } }
protected void DataListonly_ItemDataBound(object sender, DataListItemEventArgs e) { string qid = DataListonly.DataKeys[e.Item.ItemIndex].ToString(); if (!string.IsNullOrEmpty(qid)) { RadioButtonList rbl = (RadioButtonList)e.Item.FindControl("RBLselect"); LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem(); rbl.DataSource = mbll.GetListItemHashtable(Int32.Parse(qid)); rbl.DataTextField = "Key"; rbl.DataValueField = "Value"; rbl.DataBind(); } }
protected void GVQuestion_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex > -1) { e.Row.Cells[0].Text = Convert.ToString(e.Row.RowIndex + 1); string strjs = "if(confirm('您确定要删除该调查试题吗?删除试题的同时将同时删除该试题所有选项!'))return true;else return false; "; ((LinkButton)e.Row.FindControl("BtnDel")).OnClientClick = strjs; int Qid = Int32.Parse(GVQuestion.DataKeys[e.Row.RowIndex].Value.ToString()); LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem(); Label lb = (Label)(e.Row.FindControl("Labelcount")); lb.Text = "(" + mbll.GetItemCount(Qid).ToString() + ")"; } }
protected void GVQuestion_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Del") { string Qid = e.CommandArgument.ToString(); LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem(); mbll.DelAllMqid(Int32.Parse(Qid)); LearnSite.BLL.SurveyQuestion qbll = new LearnSite.BLL.SurveyQuestion(); qbll.Delete(Int32.Parse(Qid)); System.Threading.Thread.Sleep(200); showquestion(); showCalculate(); showsurvey(); } }
private void surveyClass() { if (Request.QueryString["Vid"] != null && Request.QueryString["Cid"] != null) { 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 vid = Int32.Parse(Request.QueryString["Vid"].ToString()); int cid = Int32.Parse(Request.QueryString["Cid"].ToString()); LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback(); string allselect = fbll.GetClassFselect(sgrade, sclass, vid); if (!string.IsNullOrEmpty(allselect)) { LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem(); itemandcount = mbll.GetListItemAndCount(vid, allselect); // LearnSite.Common.WordProcess.Alert(itemandcount, this.Page);//调试信息 string[] itemcountStr = itemandcount.Split('|'); LearnSite.Model.SurveyClass ymodel = new LearnSite.Model.SurveyClass(); ymodel.Ycid = cid; ymodel.Yclass = sclass; ymodel.Ycount = itemcountStr[1].ToString(); ymodel.Ydate = DateTime.Now; ymodel.Ygrade = sgrade; int yscore = fbll.GetClassYscore(syear, sgrade, sclass, sterm, vid); ymodel.Yscore = yscore; Lbscore.Text = yscore.ToString(); ymodel.Yselect = itemcountStr[0].ToString(); ymodel.Yterm = sterm; ymodel.Yvid = vid; ymodel.Yyear = syear; LearnSite.BLL.SurveyClass ybll = new LearnSite.BLL.SurveyClass(); int yid = ybll.ExistsClass(syear, sgrade, sclass, sterm, vid); if (yid > 0) { //更新 ymodel.Yid = yid; ybll.UpdateClass(ymodel); } else { ybll.Add(ymodel); } } } }
private void showclassmate() { if (Request.QueryString["Vid"] != null && Request.QueryString["Mid"] != null) { int vid = Int32.Parse(Request.QueryString["Vid"].ToString()); int mid = Int32.Parse(Request.QueryString["Mid"].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()); LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem(); Mitem.InnerHtml = "<br />" + HttpUtility.HtmlDecode(mbll.GetMitem(mid)); LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback(); Repeater1.DataSource = fbll.ShowItemClassMate(syear, sgrade, sclass, vid, mid); Repeater1.DataBind(); } }
private void showclassmate() { if (Request.QueryString["Vid"] != null && Request.QueryString["Mid"] != null) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); int vid = Int32.Parse(Request.QueryString["Vid"].ToString()); int mid = Int32.Parse(Request.QueryString["Mid"].ToString()); int syear = cook.Syear; int sgrade = cook.Sgrade; int sclass = cook.Sclass; LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem(); Mitem.InnerHtml = "<br />" + HttpUtility.HtmlDecode(mbll.GetMitem(mid)); LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback(); Repeater1.DataSource = fbll.ShowItemClassMate(syear, sgrade, sclass, vid, mid); Repeater1.DataBind(); } }
protected void GVSurveyItem_RowCommand(object sender, GridViewCommandEventArgs e) { string Mid = e.CommandArgument.ToString(); LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem(); if (e.CommandName == "Del") { mbll.Delete(Int32.Parse(Mid)); } if (e.CommandName == "Edt") { LabelMid.Text = Mid; LearnSite.Model.SurveyItem model = new LearnSite.Model.SurveyItem(); model = mbll.GetModel(Int32.Parse(Mid)); mcontent.InnerText = HttpUtility.HtmlDecode(model.Mitem);//暂时从数据库获取选项内容,不会直接从表格中获取 DDLscore.SelectedValue = model.Mscore.Value.ToString(); Btnadd.Text = "修改"; } System.Threading.Thread.Sleep(200); showitem(); }
protected void Btnok_Click(object sender, EventArgs e) { if (Request.QueryString["Vid"] != null && Request.QueryString["Cid"] != null) { string fnum = cook.Snum; int vid = Int32.Parse(Request.QueryString["Vid"].ToString()); int limitTime = Int32.Parse(LbLimitTime.Text); if (GetMyScore(vid, fnum) == -1024) { int qcount = DataListonly.Items.Count;//考题数 if (qcount > 0) { //如果有题目则分析 int scount = 0;//做题数 string midselect = ""; foreach (DataListItem item in this.DataListonly.Items) { RadioButtonList rblm = (RadioButtonList)item.FindControl("RBLselect"); if (rblm.SelectedIndex > -1) { scount++; midselect = midselect + rblm.SelectedValue + ","; } } if (qcount == scount) { if (midselect.EndsWith(",")) { midselect = midselect.Substring(0, midselect.Length - 1); } int syear = cook.Syear; int sgrade = cook.Sgrade; int sclass = cook.Sclass; int cid = Int32.Parse(Request.QueryString["Cid"].ToString()); int sid = cook.Sid; LearnSite.Model.SurveyFeedback fmodel = new LearnSite.Model.SurveyFeedback(); fmodel.Fnum = fnum; fmodel.Fyear = syear; fmodel.Fgrade = sgrade; fmodel.Fclass = sclass; fmodel.Fterm = cook.ThisTerm; fmodel.Fcid = cid; fmodel.Fvid = vid; fmodel.Fvtype = Int32.Parse(Lbtype.Text); fmodel.Fselect = midselect; LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem(); int tt = Int32.Parse(Lbtime.Text) / 60; int myscore = mbll.GetItemScore(midselect); if (tt > limitTime) { if (tt - limitTime > scount) { fmodel.Fscore = 0;//限制一下扣分,最低分为0 } else { fmodel.Fscore = myscore + limitTime - tt; } } else { fmodel.Fscore = myscore; } fmodel.Fdate = DateTime.Now; fmodel.Fsid = sid; LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback(); if (fbll.Add(fmodel) > 0) { showSurvey(); } } else { string msg = "您还有题目未做好,请仔细查看!"; LearnSite.Common.WordProcess.Alert(msg, this.Page); } } } else { Btnok.Enabled = false; } } }