public int Add2(DbConn PubConn, tb_error_model model)
        {
            return SqlHelper.Visit(ps =>
            {
                ps.Add("@msg", model.msg);
                ps.Add("@errortype", model.errortype);
                ps.Add("@errorcreatetime", model.errorcreatetime);
                ps.Add("@taskid", model.taskid);
                ps.Add("@nodeid", model.nodeid);
                return PubConn.ExecuteSql(@"insert into tb_error(msg,errortype,errorcreatetime,taskid,nodeid)
										   values(@msg,@errortype,@errorcreatetime,@taskid,@nodeid)", ps.ToParameters());
            });
        }
 /// <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);
     }
 }
        public virtual bool Edit(DbConn PubConn, tb_error_model model)
        {
            List<ProcedureParameter> Par = new List<ProcedureParameter>()
            {
                    
					//
					new ProcedureParameter("@msg",    model.msg),
					//
					new ProcedureParameter("@errortype",    model.errortype),
					//
					new ProcedureParameter("@errorcreatetime",    model.errorcreatetime),
					//
					new ProcedureParameter("@taskid",    model.taskid),
					//
					new ProcedureParameter("@nodeid",    model.nodeid)
            };
			Par.Add(new ProcedureParameter("@id",  model.id));

            int rev = PubConn.ExecuteSql("update tb_error set msg=@msg,errortype=@errortype,errorcreatetime=@errorcreatetime,taskid=@taskid,nodeid=@nodeid where id=@id", Par);
            return rev == 1;

        }
        public virtual bool Add(DbConn PubConn, tb_error_model model)
        {

            List<ProcedureParameter> Par = new List<ProcedureParameter>()
                {
					
					//
					new ProcedureParameter("@msg",    model.msg),
					//
					new ProcedureParameter("@errortype",    model.errortype),
					//
					new ProcedureParameter("@errorcreatetime",    model.errorcreatetime),
					//
					new ProcedureParameter("@taskid",    model.taskid),
					//
					new ProcedureParameter("@nodeid",    model.nodeid)   
                };
            int rev = PubConn.ExecuteSql(@"insert into tb_error(msg,errortype,errorcreatetime,taskid,nodeid)
										   values(@msg,@errortype,@errorcreatetime,@taskid,@nodeid)", Par);
            return rev == 1;

        }
		public virtual tb_error_model CreateModel(DataRow dr)
        {
            var o = new tb_error_model();
			
			//
			if(dr.Table.Columns.Contains("id"))
			{
				o.id = dr["id"].Toint();
			}
			//
			if(dr.Table.Columns.Contains("msg"))
			{
				o.msg = dr["msg"].Tostring();
			}
			//
			if(dr.Table.Columns.Contains("errortype"))
			{
				o.errortype = dr["errortype"].ToByte();
			}
			//
			if(dr.Table.Columns.Contains("errorcreatetime"))
			{
				o.errorcreatetime = dr["errorcreatetime"].ToDateTime();
			}
			//
			if(dr.Table.Columns.Contains("taskid"))
			{
				o.taskid = dr["taskid"].Toint();
			}
			//
			if(dr.Table.Columns.Contains("nodeid"))
			{
				o.nodeid = dr["nodeid"].Toint();
			}
			return o;
        }
 /// <summary>
 /// 添加节点错误日志
 /// </summary>
 /// <param name="msg"></param>
 public static void AddNodeError(string msg, Exception exp)
 {
     if (exp == null)
         exp = new Exception();
     ErrorLog.Write(msg, exp);
     tb_error_model model = new tb_error_model()
     {
         errorcreatetime = DateTime.Now,
         errortype = (byte)XXF.BaseService.TaskManager.SystemRuntime.EnumTaskLogType.SystemError,
         msg = msg+" 错误信息:"+exp.Message + " 堆栈:"+exp.StackTrace,
         taskid = 0,
         nodeid = GlobalConfig.NodeID
     };
     AddError(model);
 }