/// <summary> /// 先删除学生表中的毕业学生,再删除Ftp用户中的记录,再删除Signin表中的记录, 最后删除Web用户 /// 学年升级(只是年级改变)不影响Ftp账号使用(因为Ftp账号是根据Syear,Sclass,Snum入学年份、班级、学号创建 /// Ftp目录也是根据Syear,Sclass,Snum入学年份、班级、学号创建) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Btnupgrade_Click(object sender, EventArgs e) { LearnSite.BLL.Room rm = new LearnSite.BLL.Room(); if (rm.GradeCount() > 0) { DateTime nowtime1 = DateTime.Now; LearnSite.BLL.Students st = new LearnSite.BLL.Students(); if (st.GetCounts() > 0) { st.Upgrade();//所有年级升一级,并删除班级表中不存在班级的学生 System.Threading.Thread.Sleep(1000); LearnSite.Ftp.Reg.Upgrade();//删除学生表中不存在学号的账号(根据已经清除过的学生表与网页表对比) System.Threading.Thread.Sleep(1000); LearnSite.BLL.Signin sg = new LearnSite.BLL.Signin(); sg.Upgrade();// 在签到表中删除学生表中不存在班级的学生 System.Threading.Thread.Sleep(1000); LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy(); ws.Upgrade();//学年升级,删除Webstudy中学号不在Students的记录 DateTime nowtime2 = DateTime.Now; Labelmsg.Text = "学年升级成功! 用时" + LearnSite.Common.Computer.Datagone(nowtime1, nowtime2) + "秒"; Btnupgrade.Enabled = false; Session["Upgraded"] = "Done"; } else { Labelmsg.Text = "没有学生"; } } else { Labelmsg.Text = "班级未设置!"; } }
protected void ButtonCheck_Click(object sender, EventArgs e) { DateTime nowtime1 = DateTime.Now; LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy(); ws.WebSiteUpdateCheck(DDLhtmlname.SelectedValue); DateTime nowtime2 = DateTime.Now; Labelmsg.Text = "检测学生网站更新 用时:" + LearnSite.Common.Computer.Datagone(nowtime1, nowtime2) + "秒"; }
private void ShowTop() { if (DDLgrade.SelectedValue != "") { LearnSite.BLL.Webstudy wbll = new LearnSite.BLL.Webstudy(); GVSite.DataSource = wbll.WebTopShow(60); GVSite.DataBind(); } }
protected void ButtonSetP_Click(object sender, EventArgs e) { int Sgrade =Int32.Parse( DDLgrade.SelectedValue.ToString()); int Sclass =Int32.Parse( DDLclass.SelectedValue.ToString()); LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy(); ws.UpdateOneClass(Sgrade, Sclass); System.Threading.Thread.Sleep(1000); ShowWeb(); GVuser.DataBind(); }
protected void ButtonVote_Click(object sender, EventArgs e) { int eggs = 2; if (DDLWvote.SelectedValue != "") { eggs = Int32.Parse(DDLWvote.SelectedValue); } Labelmsg.Text = ""; DateTime nowtime1 = DateTime.Now; LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy(); ws.ResetWegg(eggs); ws.ClearNoSiteVote(); DateTime nowtime2 = DateTime.Now; Labelmsg.Text = "重新设置学生投票次数为"+eggs.ToString()+" 用时:" + LearnSite.Common.Computer.Datagone(nowtime1, nowtime2) + "秒"; }
private void ShowSite() { if (LearnSite.Common.CookieHelp.IsStudentLogin()) { string Wnum = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString(); string MySgrade = DDLgrade.SelectedValue; string MySclass = DDLclass.SelectedValue; if (MySgrade != "" && MySclass != "") { LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy(); DataListvote.DataSource = ws.GetAllSite(Int32.Parse(MySgrade), Int32.Parse(MySclass), Wnum);//绑定全班数据 DataListvote.DataBind(); } } }
protected void ButtonClearStudent_Click(object sender, EventArgs e) { if (CheckBoxDel.Checked) { string cip = Page.Request.UserHostAddress; //客户端IP string sip = LearnSite.Common.Computer.GetServerIp(); //服务器IP if (cip == sip) { string countstu = TextBoxcount.Text; if (countstu != "" && countstu != "0") { int sgrade = Int32.Parse(DDLgrade.SelectedValue); int sclass = Int32.Parse(DDLclass.SelectedValue); LearnSite.BLL.Webstudy wbll = new LearnSite.BLL.Webstudy(); wbll.DelWebClass(sgrade, sclass); LearnSite.BLL.Students sbll = new LearnSite.BLL.Students(); int delcount = sbll.DeleteClassMate(sgrade, sclass);//清空该班级学生 Labelmsg.Text = "您请空了" + DDLgrade.SelectedValue + "年级" + DDLclass.SelectedValue + "班所有学生共" + delcount.ToString() + "位!"; int syear = sbll.GetYear(sgrade, sclass); LearnSite.BLL.Signin gbll = new LearnSite.BLL.Signin(); gbll.DelSignClass(sgrade, sclass, syear); //清空签到 LearnSite.BLL.Works kbll = new LearnSite.BLL.Works(); kbll.DelClass(sgrade, sclass, syear); //清空作品 LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback(); fbll.DelClass(sgrade, sclass, syear); //清空调查 LearnSite.BLL.TopicReply rbll = new LearnSite.BLL.TopicReply(); rbll.DelClass(sgrade, sclass, syear); //清空讨论 } else { Labelmsg.Text = "无学生记录可清空!"; } } else { Labelmsg.Text = "此操作只能在服务器上浏览该页面才能执行,谢谢!"; } } else { Labelmsg.Text = "请在确认操作选项上打勾!"; } }
/// <summary> /// 先删除学生表中的毕业学生,再删除Ftp用户中的记录,再删除Signin表中的记录, 最后删除Web用户 /// 学年升级(只是年级改变)不影响Ftp账号使用(因为Ftp账号是根据Syear,Sclass,Snum入学年份、班级、学号创建 /// Ftp目录也是根据Syear,Sclass,Snum入学年份、班级、学号创建) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Btnupgrade_Click(object sender, EventArgs e) { LearnSite.BLL.Room rm = new LearnSite.BLL.Room(); if (rm.GradeCount() > 0) { DateTime nowtime1 = DateTime.Now; LearnSite.BLL.Students st = new LearnSite.BLL.Students(); if (st.GetCounts() > 0) { st.Upgrade(); //所有年级升一级,并删除班级表中不存在班级的学生 System.Threading.Thread.Sleep(1000); LearnSite.BLL.Signin sg = new LearnSite.BLL.Signin(); sg.Upgrade(); // 在签到表中删除学生表中不存在班级的学生 if (LearnSite.Ftp.FtpHelper.DatabaseExist()) //如果ftp数据库存在的话 { System.Threading.Thread.Sleep(1000); LearnSite.Ftp.Reg.Upgrade(); //ftp数据库中删除学生表中不存在学号的账号(根据已经清除过的学生表与网页表对比) } LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy(); ws.Upgrade(); //学年升级,删除Webstudy中学号不在Students的记录 DateTime nowtime2 = DateTime.Now; Labelmsg.Text = "学年升级成功! 用时" + LearnSite.Common.Computer.Datagone(nowtime1, nowtime2) + "秒"; Btnupgrade.Enabled = false; LearnSite.BLL.Room rbll = new LearnSite.BLL.Room(); rbll.UpdateRhidNone(); //清除班级选择 LearnSite.BLL.Courses bll = new LearnSite.BLL.Courses(); bll.HideCourse(); //将所有发布的学案收回,处于未发布状态 LearnSite.Common.WordProcess.Alert("请给任课老师重新选择新学期任教班级!", this.Page); Session["Upgraded"] = "Done"; } else { Labelmsg.Text = "没有学生"; } } else { Labelmsg.Text = "班级未设置!"; } }
/// <summary> /// Snum,Syear,Sgrade,Sclass,Sname,Spwd,Sex,Saddress,Sphone,Sparents,Sheadtheacher,Sscore,Sattitude /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Btnadd_Click(object sender, EventArgs e) { if (Tsname.Text != "") { LearnSite.Model.Students student = new LearnSite.Model.Students(); student.Snum = Tsnum.Text; student.Syear = Int32.Parse(DDLyear.SelectedValue); student.Sgrade = Int32.Parse(DDLgrade.SelectedValue); student.Sclass = Int32.Parse(DDLclass.SelectedValue); student.Sname = Tsname.Text.Trim(); student.Sex = DDLsex.SelectedValue; student.Spwd = Tspwd.Text; student.Saddress = Tsaddress.Text.Trim(); student.Sphone = Tsphone.Text.Trim(); student.Sparents = Tsparents.Text.Trim(); student.Sheadtheacher = Tsheadtheacher.Text.Trim(); student.Sscore = 0; student.Sattitude = 0; LearnSite.BLL.Students stubll = new LearnSite.BLL.Students(); int NewSid = stubll.AddStudent(student); Labelmsg.Text = "添加成功"; //创建ftp目录,添加到Webstudy,添加ftp账号 int Snum = Int32.Parse(Tsnum.Text); LearnSite.Ftp.Disk.CreateOneDir(Int32.Parse(DDLyear.SelectedValue), Int32.Parse(DDLclass.SelectedValue), Snum); LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy(); ws.AddOne(Tsnum.Text, Tspwd.Text); LearnSite.Ftp.Reg.RegsaveFtp(Tsnum.Text, Tspwd.Text, DDLyear.SelectedValue, DDLclass.SelectedValue); System.Threading.Thread.Sleep(1000); string url = "~/Teacher/studentshow.aspx?Sid=" + NewSid.ToString(); Response.Redirect(url, false); } else { Labelmsg.Text = "姓名、入学年份不能为空!"; } }
protected void DataListvote_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "vote") { string Wnum = Request.Cookies["StudentCookies"].Values["Snum"].ToString(); LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy(); int iv = ws.GetMyWegg(Wnum); if (iv > 0) { string Wid = DataListvote.DataKeys[e.Item.ItemIndex].ToString(); ws.UpdateWvote(Int32.Parse(Wid)); iv = iv - 1; ws.UpdateMyWegg(Wnum); System.Threading.Thread.Sleep(1000); string Wname = ((HyperLink)e.Item.FindControl("Hypername")).Text; Labelmsg.Text = "给" + Wname + "同学的网站投票成功!"; ShowInfo(); } else { Labelmsg.Text = "你的投票次数已经用完!"; } } }
/// <summary> /// 显示信息 /// </summary> private void ShowInfo() { string Wnum = 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()); int MySyear = Int32.Parse(Request.Cookies["StudentCookies"].Values["Syear"].ToString()); LearnSite.Model.Webstudy wmodel = new LearnSite.Model.Webstudy(); LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy(); wmodel = ws.GetModelByWnum(Wnum); if (wmodel != null) { HyperLinksite.NavigateUrl = "~/FtpSpace/" + MySyear.ToString() + "/" + MySclass.ToString() + "/" +Wnum; LabelWegg.Text = wmodel.Wegg.ToString(); LabelWvote.Text = wmodel.Wvote.ToString(); int Wused = wmodel.WquotaCurrent.Value / 1024 ; LabelWquota.Text = Wused.ToString() + "KB"; LabelWquota.ToolTip = "详细描述:我的主页空间已占用"+wmodel.WquotaCurrent.Value+"字节"; DataListvote.DataSource = ws.GetAllSite(MySgrade, MySclass,Wnum);//绑定全班数据 DataListvote.DataBind(); } }
protected void BtnReBuild_Click(object sender, EventArgs e) { LearnSite.BLL.Webstudy wbll = new LearnSite.BLL.Webstudy(); wbll.WebUpdateWurl(); }
private void ShowSite() { if (Request.Cookies["StudentCookies"] != null) { string Wnum = Request.Cookies["StudentCookies"].Values["Snum"].ToString(); string MySgrade = DDLgrade.SelectedValue; string MySclass = DDLclass.SelectedValue; if (MySgrade != "" && MySclass != "") { LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy(); DataListvote.DataSource = ws.GetAllSite(Int32.Parse(MySgrade), Int32.Parse(MySclass), Wnum);//绑定全班数据 DataListvote.DataBind(); } } }
private void updatescore(string Wid, int Wscore) { LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy(); ws.UpdateOne(Int32.Parse(Wid), Wscore); System.Threading.Thread.Sleep(500); ShowWeb(); GVuser.DataBind(); }
private void ShowWeb() { string Sgrade = DDLgrade.SelectedValue.ToString(); string Sclass= DDLclass.SelectedValue.ToString(); if (Sgrade != "" && Sclass != "") { LearnSite.BLL.Webstudy ws = new LearnSite.BLL.Webstudy(); GVuser.DataSource= ws.GetListWeb(Int32.Parse( Sgrade),Int32.Parse( Sclass)); GVuser.AllowPaging = true; GVuser.DataBind(); } }