protected void DataListworks_ItemCommand(object source, DataListCommandEventArgs e) { int Wscore = 0; int Wid = Int32.Parse(DataListworks.DataKeys[e.Item.ItemIndex].ToString()); LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); if (e.CommandName == "G") { Wscore = 12; ws.WgoodBest(Wid); } else { if (e.CommandName == "A") { Wscore = 10; } if (e.CommandName == "P") { Wscore = 6; } if (e.CommandName == "E") { Wscore = 2; } ws.WgoodNormal(Wid); } ws.ScoreWork(Wid, Wscore); System.Threading.Thread.Sleep(500); ShowWorks(); }
protected void BtnScore_Click(object sender, EventArgs e) { if (DDLmission.SelectedValue != "") { int i = 0; DateTime time1 = DateTime.Now; string msg = " "; foreach (GridViewRow row in GridViewScore.Rows) { RadioButtonList RScore = (RadioButtonList)row.FindControl("RadioScore"); Label LbWid = (Label)row.FindControl("LabelWid"); int Wscore = Convert.ToInt32(RScore.SelectedValue); int Wid = Int32.Parse(LbWid.Text); LearnSite.BLL.Works onework = new LearnSite.BLL.Works(); onework.ScoreWork(Wid, Wscore); if (Wscore == 12) { onework.WgoodBest(Wid); } else { onework.WgoodNormal(Wid); } System.Threading.Thread.Sleep(100); msg = msg + " " + RScore.SelectedValue; i++; } Labeltest.Text = "顺序输出本页评价结果:" + msg; DateTime time2 = DateTime.Now; System.Threading.Thread.Sleep(1000); Labelmsg.Text = "成功评价" + i.ToString() + "个作品,花费" + LearnSite.Common.Computer.Datagone(time1, time2).ToString() + "秒"; showscore(); } }
protected void BtnScoresNo_Click(object sender, EventArgs e) { LearnSite.BLL.Works works = new LearnSite.BLL.Works(); works.WorkNoScoreSetP(); Labelmsg.Text = "所有未评作品已经被评为P即6分!"; System.Threading.Thread.Sleep(500); showstudents(); }
protected void BtnSetP_Click(object sender, EventArgs e) { if (DDLmission.SelectedValue != "") { int Sgrade = Int32.Parse(DDLgrade.SelectedValue.ToString()); int Sclass = Int32.Parse(DDLclass.SelectedValue.ToString()); int Wcid = Int32.Parse(Request.QueryString["Cid"].ToString()); int Wmsort = Int32.Parse(DDLmission.SelectedValue); LearnSite.BLL.Works works = new LearnSite.BLL.Works(); works.WorkSetP(Wcid, Sgrade, Sclass, Wmsort); Labeltest.Text = ""; showscore(); } }
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个汉字!"; } } }
protected void DataListvote_ItemCommand(object source, DataListCommandEventArgs e) { string Studentnum = Request.Cookies["StudentCookies"].Values["Snum"].ToString(); if (e.CommandName == "down") { string Wurlstr=((HyperLink)e.Item.FindControl("Hyperurl")).NavigateUrl; LearnSite.Common.FileDown.DownLoad(Wurlstr); } if (e.CommandName == "vote") { if (Request.QueryString["Wid"] != null) { int myWid = Int32.Parse(Request.QueryString["Wid"].ToString()); LearnSite.BLL.Works wsbll = new LearnSite.BLL.Works(); int iv = wsbll.GetWegg(myWid);//从数据库中获取可投次数 if (iv > 0) { Labelmsg.Text = "你现在可以开始投票了!"; if (Session[Studentnum] != null) { int Wid = Int32.Parse(DataListvote.DataKeys[e.Item.ItemIndex].ToString()); LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); ws.UpdateWvote(Wid);//别人的得票数加1 iv = iv - 1;//我的投票次数减1 int MyWid = Int32.Parse(Request.QueryString["Wid"]); ws.UpdateWegg(MyWid); System.Threading.Thread.Sleep(1000); string Wname = ((LinkButton)e.Item.FindControl("Linkname")).Text;//8888888888888 Labelmsg.Text = "给" + Wname + "同学投票成功!"; ShowInfo(); } else { Labelmsg.Text = "投票页面超时!"; } } else { Labelmsg.Text = "你的投票次数已经用完!"; } } } }
protected void DLdonekc_ItemDataBound(object sender, DataListItemEventArgs e) { int Wcid = Int32.Parse(DLdonekc.DataKeys[e.Item.ItemIndex].ToString()); LearnSite.BLL.Works bll = new LearnSite.BLL.Works(); int Rgrade = Int32.Parse(DDLgrade.SelectedValue); int Rclass = Int32.Parse(DDLclass.SelectedValue); ((Label)e.Item.FindControl("wk")).Text = bll.HowCourseWorks(Wcid, Rgrade, Rclass); }
private void updatescore(string Wid, int Wscore) { LearnSite.Model.Works work = new LearnSite.Model.Works(); work.Wid =Int32.Parse( Wid); work.Wscore = Wscore; work.Wcheck = true; LearnSite.BLL.Works workbll = new LearnSite.BLL.Works(); if (Wscore == 12) { workbll.WgoodBest(Int32.Parse(Wid)); } else { workbll.WgoodNormal(Int32.Parse(Wid)); } workbll.ScoreOneWork(work); System.Threading.Thread.Sleep(500); Labelmsg.Text = "编号为" + Wid + "的作品评分为" + Wscore + "分"; showscore(); GridViewScore.DataBind(); }
private void showscore() { if (DDLmission.SelectedValue != "") { int Sgrade = Int32.Parse(DDLgrade.SelectedValue.ToString()); int Sclass = Int32.Parse(DDLclass.SelectedValue.ToString()); int Wcid = Int32.Parse(Request.QueryString["Cid"].ToString()); int Wmsort = Int32.Parse(DDLmission.SelectedValue); LearnSite.BLL.Works works = new LearnSite.BLL.Works(); GridViewScore.DataSource = works.GetListWork(Wcid, Sgrade, Sclass, Wmsort); GridViewScore.DataBind(); } }
private void ShowCid() { string Hid = Request.Cookies["TeacherCookies"].Values["Hid"].ToString(); if (Session[Hid+"Setgrade"] != null && Session[Hid+"Setclass"] != null) { Labelshow.Text = Session[Hid+"Setgrade"].ToString() + "年级" + Session[Hid+"Setclass"].ToString()+"班---作品展示"; int Sgrade = Int32.Parse(Session[Hid+"Setgrade"].ToString()); int Sclass = Int32.Parse(Session[Hid+"Setclass"].ToString()); LearnSite.BLL.Works wbll = new LearnSite.BLL.Works(); string myCid = wbll.GetTodayCid(Sgrade, Sclass);//获得今天本班课程Cid LabelCid.Text = myCid; if (myCid != "") { LearnSite.BLL.Courses cbll = new LearnSite.BLL.Courses(); LabelCtitle.Text = cbll.GetTitle(Int32.Parse(myCid));//获得课程标题 } } }
protected void GridViewScore_RowCommand(object sender, GridViewCommandEventArgs e) { string Wid = e.CommandArgument.ToString(); int Wscore=0; if (e.CommandName == "G") { Wscore = 12; updatescore(Wid, Wscore); } if (e.CommandName == "A") { Wscore = 10; updatescore(Wid, Wscore); } if (e.CommandName == "P") { Wscore = 6; updatescore(Wid, Wscore); } if (e.CommandName == "E") { Wscore = 2; updatescore(Wid, Wscore); } if (e.CommandName == "Del") { int index = Convert.ToInt32(Wid); int aWid = Convert.ToInt32(((GridView)sender).DataKeys[index].Values["Wid"].ToString()); LearnSite.BLL.Works bll = new LearnSite.BLL.Works(); bll.Delete(aWid);//删除一个作品记录 System.Threading.Thread.Sleep(500); showscore(); GridViewScore.DataBind(); } }
/// <summary> /// 分开是为了不让课程Cid重取 /// </summary> private void ShowWorks() { string Hid = Request.Cookies["TeacherCookies"].Values["Hid"].ToString(); if (Session[Hid+"Setgrade"] != null && Session[Hid+"Setclass"] != null) { int Sgrade = Int32.Parse(Session[Hid+"Setgrade"].ToString()); int Sclass = Int32.Parse(Session[Hid+"Setclass"].ToString()); string myCid = LabelCid.Text; if (myCid != "") { int Wmsort = Int32.Parse(DDLmsort.SelectedValue); LearnSite.BLL.Works wbll = new LearnSite.BLL.Works(); DataListworks.DataSource = wbll.ShowTodayWorks(Sgrade, Sclass, Int32.Parse(myCid), Wmsort);//获得今天本班该活动作品列表 DataListworks.DataBind();//Wid,Sname,Wurl,Wvote,Wscore,Qwork Labelcounts.Text = DataListworks.Items.Count.ToString(); LearnSite.BLL.Signin sbll = new LearnSite.BLL.Signin(); DataListNoworks.DataSource = sbll.GetNoWorkStudents(Sgrade, Sclass);//获取今天本班未提交作品的学生列表 DataListNoworks.DataBind(); } } }
private void ShowWorksTop() { int Qgrade = Int32.Parse(Request.Cookies["StudentCookies"].Values["Sgrade"].ToString()); LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); GridViewwork.DataSource = ws.ShowBestWork(Qgrade); GridViewwork.DataBind(); }
/// <summary> /// 显示信息 /// </summary> private void ShowInfo() { string Studentnum = Request.Cookies["StudentCookies"].Values["Snum"].ToString(); int MySgrade = Int32.Parse(Request.Cookies["StudentCookies"].Values["Sgrade"].ToString()); int MySclass = Int32.Parse(Request.Cookies["StudentCookies"].Values["Sclass"].ToString()); string Wid = Request.QueryString["Wid"].ToString(); string Wcid = Request.QueryString["Wcid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Wid) && LearnSite.Common.WordProcess.IsNum(Wcid)) { LearnSite.Model.Works wmodel = new LearnSite.Model.Works(); LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); wmodel = ws.GetModel(Int32.Parse(Wid)); Labelsort.Text = wmodel.Wmsort.ToString(); Labelegg.Text = wmodel.Wegg.ToString(); LabelCtitle.Text = "〖" + ws.GetCtitle(Int32.Parse(Wid)) + "〗"; Labelme.Text = wmodel.Wvote.ToString(); Labelegg.Text = wmodel.Wegg.ToString(); Labelhow.Text = ws.HowWorks(Int32.Parse(Wcid), MySgrade, MySclass, Int32.Parse(Labelsort.Text)); string workIp = wmodel.Wip; string worknum = wmodel.Wnum; string loginIp = Request.Cookies["StudentCookies"].Values["LoginIp"].ToString(); bool worklimit = LearnSite.Common.XmlHelp.GetWorkIpLimit(); if (workIp == loginIp && Studentnum == worknum) //如果作品提交IP和学号跟登录IP学号一致,则显示所有作品 { DataListvote.DataSource = ws.ShowMissionWorks(Int32.Parse(Wcid), MySgrade, MySclass, Int32.Parse(Labelsort.Text), Studentnum); DataListvote.DataBind(); Session[Studentnum] = workIp;//设置IP } else { Labelmsg.Text = "你提交作品的Ip与登录投票的Ip不同,不能投票!"; } } }
private void ShowWork() { string Studentnum = Request.Cookies["StudentCookies"].Values["Snum"].ToString(); string Wfilename, Wfiletype, Wurl, Wip; string Wid = Request.QueryString["Wid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Wid)) { LearnSite.Model.Works wmodel=new LearnSite.Model.Works(); LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); wmodel=ws.GetModel(Int32.Parse(Wid)); LabelWnum.Text = wmodel.Wnum; Wfilename = wmodel.Wfilename; Wurl = wmodel.Wurl; Wfiletype = LearnSite.Common.FileDown.FileNameExtension(Wurl); string typestr = Wfiletype.Substring(1, Wfiletype.Length - 1); ImageType.ImageUrl = "~/Images/FileType/" + typestr.ToLower() + ".gif"; Labelself.Text = HttpUtility.HtmlDecode(wmodel.Wself); Labelsdate.Text = wmodel.Wdate.ToString(); Labellength.Text = wmodel.Wlength.ToString() + "字节"; Labelfilename.Text = wmodel.Wfilename; LabelWscore.Text = wmodel.Wscore.ToString()+"分"; Wip = wmodel.Wip; TimeSpan ts = DateTime.Now - DateTime.Parse(Labelsdate.Text); Labelspan.Text = ts.Days.ToString() + " 天 "; Session[Studentnum+"Wurl"] = Wurl; string worknum = wmodel.Wnum; string LoginIp = Request.Cookies["StudentCookies"].Values["LoginIp"].ToString(); int days =Int32.Parse( LearnSite.Common.XmlHelp.GetWorkDowntime());//获取作品查看天数 HyperLinkreturn.NavigateUrl = "~/Student/myvote.aspx?Wid=" + Wid + "&Wcid=" + wmodel.Wcid.ToString() + "&Wmsort="+wmodel.Wmsort.ToString(); LearnSite.BLL.Mission mbll = new LearnSite.BLL.Mission(); Labelmission.Text = mbll.GetMissionTitle(wmodel.Wmid.Value); if (Wip == LoginIp && worknum==Studentnum) { LBtnfile.Visible = true; if (Labelself.Text != "") { Btnword.Text = "修改自评"; } else { Btnword.Text = "添加自评"; } } else { if (ts.Days > days) { Btnword.Text = "添加互评"; LBtnfile.Visible = true; } else { Labelmsg.Text = days.ToString()+"天后可查看"; LBtnfile.Visible = false; } } //Labelmsg.Text = Wurl; } }
private void ShowWorks() { string Wnum = Request.Cookies["StudentCookies"].Values["Snum"].ToString(); LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); GridViewworks.DataSource = ws.ShowMywork(Wnum); GridViewworks.DataBind(); }
private void ShowWorked() { if (Request.QueryString["Mid"] != null) { string Mid = Request.QueryString["Mid"].ToString(); string Snum =Request.Cookies["StudentCookies"].Values["Snum"].ToString(); LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); GVwork.DataSource = ws.MyMissonWorks(Int32.Parse( Mid), Snum);// ws.MyHowWorks(Int32.Parse(Cid), Snum); GVwork.DataBind(); } }
private void ShowIpWorkDone() { if (Request.Cookies["StudentCookies"] != null) { if (Request.QueryString["Mid"] != null) { string Sgrade = Request.Cookies["StudentCookies"].Values["Sgrade"].ToString(); string Sclass = Request.Cookies["StudentCookies"].Values["Sclass"].ToString(); string Snum = Request.Cookies["StudentCookies"].Values["Snum"].ToString(); string Wip = Request.Cookies["StudentCookies"].Values["LoginIp"].ToString(); if (Request.QueryString["Mcid"] != null) { string Wcid = Request.QueryString["Mcid"].ToString(); string Wmid = Request.QueryString["Mid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Wcid) && LearnSite.Common.WordProcess.IsNum(Wmid)) { LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); string SnumDone = ws.IpWorkDoneSnum(Int32.Parse(Sgrade), Int32.Parse(Sclass), Int32.Parse(Wcid), Int32.Parse(Wmid), Wip); if (SnumDone == "") { if (LabelMfiletype.Text != "html") { Labelmsg.Text = DateTime.Now.ToShortDateString(); } } else { if (Snum != SnumDone) { if (LearnSite.Common.XmlHelp.GetWorkIpLimit()) { AttachFile.Enabled = false; Btnupload.Enabled = false;//如果作品提交设定为IP限制的话,提交按钮灰色失效 Labelmsg.Text = SnumDone + "学号<br/>已经在该IP提交本任务作品!"; } Labelmsg.Text = SnumDone + "学号<br/>已经在该IP提交本任务作品!"; } else { if (Session[Snum] != null) { AttachFile.Enabled = false; Btnupload.Enabled = false; Labelmsg.Text = "你已经参加投票活动!<br/>你不可以重新提交了!"; } else { Labelmsg.Text = "你可以修改作品"; } } } string Wid = ws.WorkDone(Snum, Int32.Parse(Wcid), Int32.Parse(Wmid));//返回空字符表示不存在该记录 if (Wid != "") { //如果作品已经评分,提交按钮灰色失效 if (ws.IsChecked(Int32.Parse(Wid))) { Labelmsg.Text = "该作品已经评分!"; Btnupload.Enabled = false; AttachFile.Enabled = false; CheckBoxCan.Enabled = false; } } else { if (CheckBoxMupload.Checked) { Labelmsg.Text =Labelmsg.Text+ "<br/>你未提交该作品?"; } } } else { Panelworks.Visible = false; Labelmsg.Text = "网页超时过期!"; } } } } }
protected void Btnupload_Click(object sender, EventArgs e) { if (IsValid) { string Wmid = Request.QueryString["Mid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Wmid)) { string Sname = Request.Cookies["StudentCookies"].Values["Sname"].ToString(); string Syear = Request.Cookies["StudentCookies"].Values["Syear"].ToString(); string Sgrade = Request.Cookies["StudentCookies"].Values["Sgrade"].ToString(); string Sclass = Request.Cookies["StudentCookies"].Values["Sclass"].ToString(); string Wnum = Request.Cookies["StudentCookies"].Values["Snum"].ToString(); string Wip = Request.Cookies["StudentCookies"].Values["LoginIp"].ToString(); string LoginTime = Request.Cookies["StudentCookies"].Values["LoginTime"].ToString(); string Wcid = LabelMcid.Text; string Mfiletype = LabelMfiletype.Text; string Wmsort = LabelMsort.Text; DateTime Wdate = DateTime.Now; string iplast = Wip.Substring(Wip.LastIndexOf(".") + 1); if (CheckBoxMupload.Checked)//是否可上传 { string postfilename = this.AttachFile.FileName; int Wlength = Convert.ToInt32(this.AttachFile.ContentLength); if (postfilename != "" && postfilename != null) { if (LearnSite.Common.WorkUpload.CheckType(postfilename, Mfiletype)) //上传类型是否正确 { LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); string Wid = ws.WorkDone(Wnum, Int32.Parse(Wcid), Int32.Parse(Wmid));//返回空字符表示不存在该记录 if (Wid != "") { //重新提交修改作品 string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Syear, Sgrade, Sclass, Wcid, Wmid);//获得作品保存路径(如果不存在,自动创建) string RndTime = (DateTime.Parse(LoginTime)).Minute.ToString(); string NewFileName = Server.UrlDecode(Sname) + Wcid + "_" + Wmid + "_" + RndTime + iplast + "." + Mfiletype; string Wurl = MySavePath + "/" + NewFileName; string saveFilename = Server.MapPath(Wurl); try { this.AttachFile.MoveTo(saveFilename, Brettle.Web.NeatUpload.MoveToOptions.Overwrite);//保存提交作品 ws.UpdateWorkUp(Int32.Parse(Wid), Wurl, NewFileName, Wlength, Wdate,CheckBoxCan.Checked);//更新Wfilename, Wurl,Wlength, Wdate string ch = "课程活动" + Wmsort + "重新提交作品成功!"; Labelmsg.Text = ch; LearnSite.Common.WordProcess.Alert(ch, this.Page); } catch (Exception ex) { throw ex; } } else { //如果作品未提交,提交作品(Wnum, Wcid,Wmid,Wmsort, Wfilename, Wurl,Wlength, Wdate, Wip, Wtime) string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Syear, Sgrade, Sclass, Wcid, Wmid);//获得作品保存路径(如果不存在,自动创建) string RndTime = (DateTime.Parse(LoginTime)).Minute.ToString(); string NewFileName = Server.UrlDecode(Sname) + Wcid + "_" + Wmid + "_" + RndTime + iplast + "." + Mfiletype; string Wurl = MySavePath + "/" + NewFileName; string Wtime = LearnSite.Common.Computer.TimePassed().ToString(); LearnSite.Model.Works wmodel = new LearnSite.Model.Works(); wmodel.Wnum = Wnum; wmodel.Wcid = Int32.Parse(Wcid); wmodel.Wmid = Int32.Parse(Wmid); wmodel.Wmsort = Int32.Parse(Wmsort); wmodel.Wfilename = NewFileName; wmodel.Wurl = Wurl; wmodel.Wlength = Wlength; wmodel.Wdate = Wdate; wmodel.Wip = Wip; wmodel.Wtime = Wtime; wmodel.Wcan = CheckBoxCan.Checked; string saveFilename = Server.MapPath(Wurl); try { this.AttachFile.MoveTo(saveFilename, Brettle.Web.NeatUpload.MoveToOptions.Overwrite);//保存提交作品 ws.AddWorkUp(wmodel);//添加作品提交记录 string worknums = ws.HowCidWorks(Int32.Parse(Wcid), Wnum); if (worknums != "") { LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin(); sn.UpdateQwork(Wnum, Int32.Parse(worknums));//更新今天签到表中的作品数量 } string ch = "课程活动"+Wmsort+"提交作品成功!"; Labelmsg.Text = ch; LearnSite.Common.WordProcess.Alert(ch, this.Page); ShowWorked(); } catch (Exception ex) { throw ex; } } } else { Labelmsg.Text = "提交类型错误!"; string ch = "提交作品类型错误!"; LearnSite.Common.WordProcess.Alert(ch, this.Page); } } else { Labelmsg.Text = "你没有选择提交作品!"; string ch = "你没有浏览选择你的作品,请再选择一遍!"; LearnSite.Common.WordProcess.Alert(ch, this.Page); } } else { Labelmsg.Text = "本任务无作品!"; } } } }