예제 #1
0
        /// <summary>
        /// 遍历单个学生网站根目录文件,获取当前更新情况到数据库中。
        /// </summary>
        /// <param name="Syear"></param>
        /// <param name="Sclass"></param>
        /// <param name="Snum"></param>
        public static int SiteUpdateCheck(string Snum, string sitepath)
        {
            int      spoint   = 0;
            DateTime dt       = DateTime.Now;
            string   today    = dt.Year.ToString() + "-" + dt.Month.ToString() + "-" + dt.Day;
            DateTime nowdayDt = Convert.ToDateTime(today);
            string   realpath = HttpContext.Current.Server.MapPath(sitepath);

            if (Directory.Exists(realpath))
            {
                DirectoryInfo dirInfo = new DirectoryInfo(realpath);
                FileInfo[]    files   = dirInfo.GetFiles();
                if (files.Length > 0)
                {
                    bool isok = false;
                    foreach (FileInfo thisfile in files)
                    {
                        if (thisfile.LastWriteTime > nowdayDt)
                        {
                            isok = true;
                            break;
                        }
                    }
                    if (isok)
                    {
                        spoint = Convert.ToInt32(countDirSize(dirInfo));
                        LearnSite.BLL.Webstudy wsbll = new LearnSite.BLL.Webstudy();
                        wsbll.UpdateWebTimeSize(Snum, dt, spoint);//更新Webstudy表中网站的更新日期
                    }
                }
            }
            return(spoint);
        }
예제 #2
0
 public static string FtpUserCreate(int QuotaMax)
 {
     string msg= LearnSite.Ftp.Reg.RegAllFtpTwo(QuotaMax);
     System.Threading.Thread.Sleep(1000);
     LearnSite.BLL.Webstudy wb = new LearnSite.BLL.Webstudy();
     wb.AddAll();//从学生表读取Webstudy表中不存在的数据,插入Webstudy表中
     return msg;
 }
예제 #3
0
        public static string FtpUserCreate(int QuotaMax)
        {
            LearnSite.BLL.Webstudy wb = new LearnSite.BLL.Webstudy();
            wb.AddAll();//从学生表读取Webstudy表中不存在的数据,插入Webstudy表中
            string msg = LearnSite.Ftp.Reg.RegAllFtpTwo(QuotaMax);

            return(msg);
        }
예제 #4
0
        /// <summary>
        /// 设置学生的cookies值
        /// </summary>
        /// <param name="stmodel"></param>
        ///Snum,Syear,Sgrade,Sclass,Sname,Spwd,Sex,Saddress,Sphone,Sparents,Sheadtheacher,Sscore,Sattitude,Sape
        public static bool SetStuCookie(LearnSite.Model.Students stmodel, string LoginIp)
        {
            if (stmodel != null)
            {
                LearnSite.BLL.Room rm = new LearnSite.BLL.Room();

                string   Rhid               = rm.GetRoomRhid(stmodel.Sgrade.Value, stmodel.Sclass.Value);
                DateTime LoginTime          = DateTime.Now;
                LearnSite.BLL.Webstudy wbll = new LearnSite.BLL.Webstudy();
                string FtpPwd               = wbll.FindWebFtpPwd(stmodel.Snum);

                string ThisTerm = LearnSite.Common.XmlHelp.GetTerm();

                HttpCookie StuCookie = new HttpCookie(stuCookieNname);
                if (stmodel.Sex == null)
                {
                    stmodel.Sex = "无";
                }
                if (stmodel.Sscore == null)
                {
                    stmodel.Sscore = 0;
                }
                if (stmodel.Squiz == null)
                {
                    stmodel.Squiz = 0;
                }
                if (stmodel.Sattitude == null)
                {
                    stmodel.Sattitude = 0;
                }
                if (stmodel.Sape == null)
                {
                    stmodel.Sape = "无";
                }
                if (stmodel.Sgroup == null)
                {
                    stmodel.Sgroup = 0;
                }

                StuCookie.Values.Add("Sid", stmodel.Sid.ToString());
                StuCookie.Values.Add("Snum", UrlEncode(stmodel.Snum));
                StuCookie.Values.Add("Syear", stmodel.Syear.ToString());
                StuCookie.Values.Add("Sgrade", stmodel.Sgrade.ToString());
                StuCookie.Values.Add("Sclass", stmodel.Sclass.ToString());
                StuCookie.Values.Add("Sname", UrlEncode(stmodel.Sname.Trim()));
                StuCookie.Values.Add("Spwd", Common.WordProcess.GetMD5_8bit(stmodel.Spwd));
                StuCookie.Values.Add("Sex", UrlEncode(stmodel.Sex));
                StuCookie.Values.Add("Sscore", stmodel.Sscore.ToString());
                StuCookie.Values.Add("Squiz", stmodel.Squiz.ToString());
                StuCookie.Values.Add("Sattitude", stmodel.Sattitude.ToString());
                StuCookie.Values.Add("Sape", UrlEncode(stmodel.Sape));
                StuCookie.Values.Add("Sgroup", stmodel.Sgroup.ToString());
                StuCookie.Values.Add("LoginTime", LoginTime.ToString());
                StuCookie.Values.Add("LoginIp", LoginIp);
                StuCookie.Values.Add("Ftppwd", FtpPwd);
                StuCookie.Values.Add("ThisTerm", ThisTerm);
                StuCookie.Values.Add("Rhid", Rhid);
                StuCookie.Values.Add("RankImage", UrlEncode(LearnSite.Common.Rank.RankImage(stmodel.Sscore.Value + stmodel.Sattitude.Value, true)));
                StuCookie.Values.Add("Ss", Common.WordProcess.GetMD5_8bit(stmodel.Snum));

                string str = LearnSite.Common.XmlHelp.GetStudentCookiesPeriod();
                StuCookie.Expires  = StudentCookiesPeriod(str);
                StuCookie.Path     = "/";
                StuCookie.HttpOnly = true;
                HttpContext.Current.Response.AppendCookie(StuCookie);
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
        /// <summary>
        /// 设置学生的cookies值
        /// </summary>
        /// <param name="Model"></param>
        ///Snum,Syear,Sgrade,Sclass,Sname,Spwd,Sex,Saddress,Sphone,Sparents,Sheadtheacher,Sscore,Sattitude,Sape
        public static bool SetStudentCookies(LearnSite.Model.Students Model)
        {
            if (Model != null)
            {
                try
                {
                    DateTime LoginTime = DateTime.Now;
                    string LoginIp = LearnSite.Common.Computer.GetGuestIP();
                    LearnSite.BLL.Webstudy wbll = new LearnSite.BLL.Webstudy();
                    string FtpPwd = wbll.FindWebFtpPwd(Model.Snum);
                    LearnSite.BLL.Room rm = new LearnSite.BLL.Room();
                    string Rhid = rm.GetRoomRhid(Model.Sgrade.Value, Model.Sclass.Value);
                    string ThisTerm = LearnSite.Common.XmlHelp.GetTerm();
                    HttpCookie StuCookie = new HttpCookie("StudentCookies");
                    if (Model.Sex == null)
                        Model.Sex = "无";
                    if (Model.Saddress == null)
                        Model.Saddress = "无";
                    if (Model.Sphone == null)
                        Model.Sphone = "无";
                    if (Model.Sparents == null)
                        Model.Sparents = "无";
                    if (Model.Sheadtheacher == null)
                        Model.Sheadtheacher = "无";
                    if (Model.Sscore == null)
                        Model.Sscore = 0;
                    if (Model.Squiz == null)
                        Model.Squiz = 0;
                    if (Model.Sattitude == null)
                        Model.Sattitude = 0;
                    if (Model.Sape == null)
                        Model.Sape = "无";

                    StuCookie.Values.Add("Sid", Model.Sid.ToString());
                    StuCookie.Values.Add("Snum", UrlEncode(Model.Snum));
                    StuCookie.Values.Add("Syear", Model.Syear.ToString());
                    StuCookie.Values.Add("Sgrade", Model.Sgrade.ToString());
                    StuCookie.Values.Add("Sclass", Model.Sclass.ToString());
                    StuCookie.Values.Add("Sname", UrlEncode(Model.Sname));
                    StuCookie.Values.Add("Spwd", Model.Spwd.ToString());
                    StuCookie.Values.Add("Sex", UrlEncode(Model.Sex));
                    StuCookie.Values.Add("Saddress", UrlEncode(Model.Saddress));
                    StuCookie.Values.Add("Sphone", Model.Sphone.ToString());
                    StuCookie.Values.Add("Sparents", UrlEncode(Model.Sparents));
                    StuCookie.Values.Add("Sheadtheacher", UrlEncode(Model.Sheadtheacher));
                    StuCookie.Values.Add("Sscore", Model.Sscore.ToString());
                    StuCookie.Values.Add("Squiz", Model.Squiz.ToString());
                    StuCookie.Values.Add("Sattitude", Model.Sattitude.ToString());
                    StuCookie.Values.Add("Sape", Model.Sape.ToString());
                    StuCookie.Values.Add("LoginTime", LoginTime.ToString());
                    StuCookie.Values.Add("LoginIp", LoginIp);
                    StuCookie.Values.Add("Ftppwd", FtpPwd);
                    StuCookie.Values.Add("ThisTerm", ThisTerm);
                    StuCookie.Values.Add("Rhid", Rhid);

                    string str = LearnSite.Common.XmlHelp.GetStudentCookiesPeriod();
                    if (str != "0")
                    {
                        StuCookie.Expires = StudentCookiesPeriod(str);
                        StuCookie.Path = "/";
                    }
                    HttpContext.Current.Response.AppendCookie(StuCookie);
                    return true;
                }
                catch
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
예제 #6
0
 /// <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;
                 }
             }
         }
     }
 }