public void WebSiteUpdateCheck(string htmlname) { if (HttpContext.Current.Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname] != null) { int Rhid = Int32.Parse(HttpContext.Current.Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname].Values["Hid"].ToString());//教师编号 string mysql = "select Syear,Sclass,Sid,Snum from Students,Room where Sgrade=Rgrade and Sclass=Rclass and Rset=1 and Rhid=" + Rhid; DataSet ds = DbHelperSQL.Query(mysql); int dscount = ds.Tables[0].Rows.Count; if (dscount > 0) { for (int i = 0; i < dscount; i++) { int Syear = int.Parse(ds.Tables[0].Rows[i]["Syear"].ToString()); int Sclass = int.Parse(ds.Tables[0].Rows[i]["Sclass"].ToString()); string Snum = ds.Tables[0].Rows[i]["Snum"].ToString(); int Sid = int.Parse(ds.Tables[0].Rows[i]["Sid"].ToString()); string updatetime = LearnSite.Common.Htmlcheck.HtmlUpdatetime(Syear, Sclass, Snum, htmlname); if (updatetime != "") { UpdateWebTime(Snum, updatetime); //更新Webstudy表该学号日期 LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin(); sn.UpdateQwork(Sid, 1); //签到表中增加作品数量为1 } } } ClearNoSiteVote(); } }
public void WebSiteUpdateCheck(string htmlname) { if (HttpContext.Current.Request.Cookies["TeacherCookies"] != null) { int Rhid = Int32.Parse(HttpContext.Current.Request.Cookies["TeacherCookies"].Values["Hid"].ToString());//��ʦ��� string mysql = "select Syear,Sgrade,Sclass,Snum from Students,Room where Sgrade=Rgrade and Sclass=Rclass and Rset=1 and Rhid=" + Rhid; DataSet ds = DbHelperSQL.Query(mysql); int dscount = ds.Tables[0].Rows.Count; if (dscount > 0) { for (int i = 0; i < dscount; i++) { int Syear = int.Parse(ds.Tables[0].Rows[i]["Syear"].ToString()); int Sclass = int.Parse(ds.Tables[0].Rows[i]["Sclass"].ToString()); string Snum = ds.Tables[0].Rows[i]["Snum"].ToString(); string updatetime = LearnSite.Common.Htmlcheck.HtmlUpdatetime(Syear, Sclass, Snum, htmlname); if (updatetime != "") { UpdateWebTime(Snum, updatetime);//����Webstudy���ѧ������ LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin(); sn.UpdateQwork(Snum, 1);//ǩ������������Ʒ����Ϊ1 } } } ClearNoSiteVote(); } }
/// <summary> /// 遍历单个学生网站根目录文件,获取当前更新情况到数据库中。 /// </summary> /// <param name="Syear"></param> /// <param name="Sclass"></param> /// <param name="Snum"></param> public static void SiteUpdateCheck(string Syear, string Sclass, string Snum) { string nowday = DateTime.Now.ToShortDateString(); DateTime nowdayDt = Convert.ToDateTime(nowday); string sitepath = "~/FtpSpace/" + Syear + "/" + Sclass + "/" + Snum+"/"; string realpath = HttpContext.Current.Server.MapPath(sitepath); if (Directory.Exists(realpath)) { DirectoryInfo dirInfo=new DirectoryInfo(realpath); FileInfo[] files = dirInfo.GetFiles(); if (files.Length > 0) { string updatetime = ""; LearnSite.BLL.Webstudy wsbll = new LearnSite.BLL.Webstudy(); foreach (FileInfo thisfile in files) { //HttpContext.Current.Response.Write(thisfile + "<br/>");测试 updatetime =thisfile.LastWriteTime.ToString(); DateTime updateDt = Convert.ToDateTime(updatetime); if (updateDt > nowdayDt) { wsbll.UpdateWebTime(Snum, updatetime);//更新Webstudy表中网站的更新日期 int dirSize = Convert.ToInt32(countDirSize(dirInfo)); wsbll.UpdateWebSize(Snum, dirSize);//更新网站空间占用大小 LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin(); sn.UpdateQwork(Snum, 1);//签到表中增加作品数量为1 break; } } } } }