Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UserTableBLL bll = new UserTableBLL();

        if (!Page.IsPostBack)
        {
            string dirPath = Server.MapPath("~/Images/Users/");
            DataTable name_dt = FileHelper.GetFileName(dirPath);

            DataTable user_dt = bll.GetUserList();

            foreach (DataRow name_dr in name_dt.Rows)
            {
                bool hasFile = false;
                string fileName = name_dr["FileName"].ToString();

                foreach (DataRow user_dr in user_dt.Rows)
                {
                    string userImage = user_dr["UserImage"].ToString();
                    if (fileName == userImage)
                    {
                        hasFile = true;
                    }
                }

                if (!hasFile)
                {
                    string path = dirPath + fileName;
                    FileHelper.DeleteFile(path);
                }
            }
        }
    }
Beispiel #2
0
        public void Execute(IJobExecutionContext context)
        {
            log.Info("开始用户自动服务。");

            try
            {
                UserTableBLL bll = new UserTableBLL();
                DataTable dt = bll.GetUserList();

                log.Info("用户数:" + dt.Rows.Count);
            }
            catch (Exception ex)
            {
                log.Error(ex.Message + Environment.NewLine + ex.StackTrace);
                JobExecutionException jobException = new JobExecutionException(ex);
                throw jobException;
            }
        }