public virtual bool Add2(DbConn PubConn, tb_consumer_model model) { return SqlHelper.Visit((ps) => { List<ProcedureParameter> Par = new List<ProcedureParameter>() { //��������ʱid(�����������Ψһ,Guidתlong) new ProcedureParameter("@tempid", model.tempid), //������clinet��id new ProcedureParameter("@consumerclientid", model.consumerclientid), //֧�ֵķ���˳���(֧�ֶ��˳���) new ProcedureParameter("@partitionindexs", model.partitionindexs), //�ͻ������� new ProcedureParameter("@clientname", model.clientname), ////�������ʱ��(�Ե�ǰ��ʱ��Ϊ) //new ProcedureParameter("@lastheartbeat", model.lastheartbeat), ////��һ�θ���ʱ��(�Ե�ǰ��ʱ��Ϊ) //new ProcedureParameter("@lastupdatetime", model.lastupdatetime), ////�ͻ��˴���ʱ��(�Ե�ǰ��ʱ��Ϊ) //new ProcedureParameter("@createtime", model.createtime) }; int rev = PubConn.ExecuteSql(@"insert into tb_consumer(tempid,consumerclientid,partitionindexs,clientname,lastheartbeat,lastupdatetime,createtime) values(@tempid,@consumerclientid,@partitionindexs,@clientname,getdate(),getdate(),getdate())", Par); return rev == 1; }); }
public virtual tb_consumer_model CreateModel(DataRow dr) { var o = new tb_consumer_model(); // if (dr.Table.Columns.Contains("id")) { o.id = dr["id"].Toint(); } //��������ʱid(�����������Ψһ,Guidתlong) if (dr.Table.Columns.Contains("tempid")) { o.tempid = dr["tempid"].Tolong(); } //������clinet��id if (dr.Table.Columns.Contains("consumerclientid")) { o.consumerclientid = dr["consumerclientid"].Toint(); } //֧�ֵķ���˳���(֧�ֶ��˳���) if (dr.Table.Columns.Contains("partitionindexs")) { o.partitionindexs = dr["partitionindexs"].Tostring(); } //�ͻ������� if (dr.Table.Columns.Contains("clientname")) { o.clientname = dr["clientname"].Tostring(); } //�������ʱ��(�Ե�ǰ��ʱ��Ϊ) if (dr.Table.Columns.Contains("lastheartbeat")) { o.lastheartbeat = dr["lastheartbeat"].ToDateTime(); } //��һ�θ���ʱ��(�Ե�ǰ��ʱ��Ϊ) if (dr.Table.Columns.Contains("lastupdatetime")) { o.lastupdatetime = dr["lastupdatetime"].ToDateTime(); } //�ͻ��˴���ʱ��(�Ե�ǰ��ʱ��Ϊ) if (dr.Table.Columns.Contains("createtime")) { o.createtime = dr["createtime"].ToDateTime(); } return o; }