Example #1
0
        public override void Run()
        {
            TaskBLL       td = new TaskBLL();
            IList <Tasks> t  = td.GetTimeOutList(MaxSeconds);

            if (t.Count > 0)
            {
                log.Debug(string.Format("发现超时任务{0}", t.Count));

                DataTable dt   = QMExtend.ToDataTable <Tasks>(t);
                QMText    txt  = new QMText();
                string    body = txt.Export(dt, "任务超时清单");

                IMail mail = new QMMail();
                mail.Subject = "任务超时清单";
                mail.AddBody(body, "MONITOR");
                mail.AddRecipient("*****@*****.**");


                if (mail.Send())
                {
                    log.Debug("[MAIL] 发送成功");
                }
                else
                {
                    log.Fatal("[MAIL] 发送失败");
                    throw new QMException("[MAIL] 发送失败");
                }
            }
            else
            {
                log.Debug("未发现超时任务");
            }
        }
Example #2
0
        /// <summary>
        /// 上传文件
        /// </summary>
        /// <returns></returns>
        public static string UploadFile()
        {
            string result    = String.Empty;
            string flocation = QMExtend.GetCurYear() + "/" + QMExtend.GetCurMonth() + "/";

            try
            {
                string url = GetMapPath("~/Files/" + flocation);
                //create folder
                CreateDir(url);
                //upload file
                foreach (string file in HttpContext.Current.Request.Files)
                {
                    var filebase = HttpContext.Current.Request.Files[file];

                    if (filebase.ContentLength > 0)
                    {
                        if (result != string.Empty)
                        {
                            result += ";";
                        }
                        result += Path.Combine(url, filebase.FileName);
                        filebase.SaveAs(Path.Combine(url, filebase.FileName));
                    }
                }
            }
            catch (QMException ex)
            {
                throw ex;
            }

            return(result);
        }