public int AddOrUpdate(DbConn PubConn, tb_performance_model model)
        {
            return SqlHelper.Visit(ps =>
            {
                ps.Add("@cpu", model.cpu);
                ps.Add("@memory", model.memory);
                ps.Add("@installdirsize", model.installdirsize);
                ps.Add("@taskid", model.taskid);
                ps.Add("@nodeid", model.nodeid); 
                ps.Add("@lastupdatetime", model.lastupdatetime);
                ps.Add("@id", model.id);
                string updatecmd = "update tb_performance set cpu=@cpu,memory=@memory,installdirsize=@installdirsize,nodeid=@nodeid,lastupdatetime=@lastupdatetime where taskid=@taskid";
                string insertcmd = @"insert into tb_performance(cpu,memory,installdirsize,taskid,nodeid,lastupdatetime)
										   values(@cpu,@memory,@installdirsize,@taskid,@nodeid,@lastupdatetime)";
                if (PubConn.ExecuteSql(updatecmd, ps.ToParameters()) <= 0)
                {
                    PubConn.ExecuteSql(insertcmd, ps.ToParameters());
                }
                return 1;
            });
        }
        public virtual bool Edit(DbConn PubConn, tb_performance_model model)
        {
            List<ProcedureParameter> Par = new List<ProcedureParameter>()
            {
                    
					//
					new ProcedureParameter("@nodeid",    model.nodeid),
					//
					new ProcedureParameter("@taskid",    model.taskid),
					//
					new ProcedureParameter("@cpu",    model.cpu),
					//
					new ProcedureParameter("@memory",    model.memory),
					//
					new ProcedureParameter("@installdirsize",    model.installdirsize),
					//
					new ProcedureParameter("@lastupdatetime",    model.lastupdatetime)
            };
			Par.Add(new ProcedureParameter("@id",  model.id));

            int rev = PubConn.ExecuteSql("update tb_performance set nodeid=@nodeid,taskid=@taskid,cpu=@cpu,memory=@memory,installdirsize=@installdirsize,lastupdatetime=@lastupdatetime where id=@id", Par);
            return rev == 1;

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

            List<ProcedureParameter> Par = new List<ProcedureParameter>()
                {
					
					//
					new ProcedureParameter("@nodeid",    model.nodeid),
					//
					new ProcedureParameter("@taskid",    model.taskid),
					//
					new ProcedureParameter("@cpu",    model.cpu),
					//
					new ProcedureParameter("@memory",    model.memory),
					//
					new ProcedureParameter("@installdirsize",    model.installdirsize),
					//
					new ProcedureParameter("@lastupdatetime",    model.lastupdatetime)   
                };
            int rev = PubConn.ExecuteSql(@"insert into tb_performance(nodeid,taskid,cpu,memory,installdirsize,lastupdatetime)
										   values(@nodeid,@taskid,@cpu,@memory,@installdirsize,@lastupdatetime)", Par);
            return rev == 1;

        }
		public virtual tb_performance_model CreateModel(DataRow dr)
        {
            var o = new tb_performance_model();
			
			//
			if(dr.Table.Columns.Contains("id"))
			{
				o.id = dr["id"].Toint();
			}
			//
			if(dr.Table.Columns.Contains("nodeid"))
			{
				o.nodeid = dr["nodeid"].Toint();
			}
			//
			if(dr.Table.Columns.Contains("taskid"))
			{
				o.taskid = dr["taskid"].Toint();
			}
			//
			if(dr.Table.Columns.Contains("cpu"))
			{
				o.cpu = dr["cpu"].Todouble();
			}
			//
			if(dr.Table.Columns.Contains("memory"))
			{
				o.memory = dr["memory"].Todouble();
			}
			//
			if(dr.Table.Columns.Contains("installdirsize"))
			{
				o.installdirsize = dr["installdirsize"].Todouble();
			}
			//
			if(dr.Table.Columns.Contains("lastupdatetime"))
			{
				o.lastupdatetime = dr["lastupdatetime"].ToDateTime();
			}
			return o;
        }