public override void Run()
 {
     var tempinfo = this.OpenOperator.GetDataBaseTempData<TaskManageErrorSendTaskTempInfo>();
     if (tempinfo == null)
     {
         tempinfo = new TaskManageErrorSendTaskTempInfo();
         tempinfo.LastLogID = 0;
     }
     //扫描
     List<tb_senderror_model> senderrormodels = new List<tb_senderror_model>();
     List<tb_user_model> usermodels = new List<tb_user_model>();
     SqlHelper.ExcuteSql(this.SystemRuntimeInfo.TaskConnectString, (c) =>
     {
         tb_error_dal errordal = new tb_error_dal();
         senderrormodels = errordal.GetErrors(c, tempinfo.LastLogID);
         tb_user_dal userdal = new tb_user_dal();
         usermodels = userdal.GetAllUsers(c);
     });
     foreach (var u in usermodels)
     {
         if (string.IsNullOrEmpty(u.useremail))
             continue;
         if (u.userrole == (int)EnumUserRole.Admin)
             SendEmail(senderrormodels, u.useremail);
         else
             SendEmail(senderrormodels.Where(c => c.taskcreateuserid == u.id).ToList(), u.useremail);
     }
     if (senderrormodels.Count > 0)
     {
         int maxid = senderrormodels.Max(c => c.error_model.id);
         tempinfo.LastLogID = maxid;
         this.OpenOperator.Log(string.Format("本次处理错误日志{0}条", senderrormodels.Count));
     }
     this.OpenOperator.SaveDataBaseTempData(tempinfo);
 }
 /// <summary>
 /// 添加错误日志
 /// </summary>
 /// <param name="model"></param>
 public static void AddError(tb_error_model model)
 {
     try
     {
         AddLog(new tb_log_model { logcreatetime = model.errorcreatetime, logtype = model.errortype, msg = model.msg, taskid = model.taskid });
         SqlHelper.ExcuteSql(Config.TaskConnectString, (c) =>
         {
             tb_error_dal errordal = new tb_error_dal();
             model.msg = model.msg.SubString2(1000);
             errordal.Add2(c, model);
         });
     }
     catch (Exception exp)
     {
         XXF.Log.ErrorLog.Write("添加错误日志至数据库出错", exp);
     }
 }
 //
 // GET: /Log/
 public ActionResult ErrorLog(string keyword, string CStime, string CEtime, int id = -1, int errortype = -1, int taskid = -1, int nodeid = -1, int pagesize = 10, int pageindex = 1)
 {
     return this.Visit(Core.EnumUserRole.None, () =>
     {
         int count = 0;
         using (DbConn PubConn = DbConfig.CreateConn(Config.TaskConnectString))
         {
             ViewBag.keyword = keyword; ViewBag.CStime = CStime; ViewBag.CEtime = CEtime; ViewBag.id = id; ViewBag.errortype = errortype; ViewBag.taskid = taskid;
             ViewBag.nodeid = nodeid; ViewBag.pagesize = pagesize; ViewBag.pageindex = pageindex;
             PubConn.Open();
             tb_error_dal dal = new tb_error_dal();
             List<tb_errorinfo_model> model = dal.GetList(PubConn, keyword, id, CStime, CEtime, errortype, taskid, nodeid, pagesize, pageindex, out count);
             PagedList<tb_errorinfo_model> pageList = new PagedList<tb_errorinfo_model>(model, pageindex, pagesize, count);
             List<tb_task_model> Task = new tb_task_dal().GetListAll(PubConn);
             List<tb_node_model> Node = new tb_node_dal().GetListAll(PubConn);
             ViewBag.Node = Node;
             ViewBag.Task = Task;
             return View(pageList);
         }
     });
 }