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; }
public virtual bool Add(DbConn PubConn, tb_consumer_model model) { 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,@lastheartbeat,@lastupdatetime,@createtime)", Par); return rev == 1; }
public RegisterdConsumersModel(DataRow dr) { // s.id as tb_consumer_id,tempid as tb_consumer_tempid,s.consumerclientid as tb_consumer_consumerclientid,s.partitionindexs as tb_consumer_partitionindexs //,s.clientname as tb_consumer_clientname,s.lastheartbeat as tb_consumer_lastheartbeat,s.lastupdatetime as tb_consumer_lastupdatetime,s.createtime as tb_consumer_createtime, //c.id as tb_consumer_client_id, c.client as tb_consumer_client_client,c.createtime as tb_consumer_client_createtime, p.id as tb_consumer_partition_id,p.consumerclientid as tb_consumer_partition_consumerclientid //,p.partitionindex as tb_consumer_partition_partitionindex,p.partitionid as tb_consumer_partition_partitionid,p.lastconsumertempid as tb_consumer_partition_lastconsumertempid,p.lastmqid as tb_consumer_partition_lastmqid //,p.lastupdatetime as tb_consumer_partition_lastupdatetime,p.createtime as tb_consumer_partition_createtime consumermodel = new tb_consumer_model(); // if (dr.Table.Columns.Contains("tb_consumer_id")) { consumermodel.id = dr["tb_consumer_id"].Toint(); } //消费者临时id(消费者启动后唯一,Guid转long) if (dr.Table.Columns.Contains("tb_consumer_tempid")) { consumermodel.tempid = dr["tb_consumer_tempid"].Tolong(); } //消费者clinet的id if (dr.Table.Columns.Contains("tb_consumer_consumerclientid")) { consumermodel.consumerclientid = dr["tb_consumer_consumerclientid"].Toint(); } //支持的分区顺序号(支持多个顺序号) if (dr.Table.Columns.Contains("tb_consumer_partitionindexs")) { consumermodel.partitionindexs = dr["tb_consumer_partitionindexs"].Tostring(); } //客户端名称 if (dr.Table.Columns.Contains("tb_consumer_clientname")) { consumermodel.clientname = dr["tb_consumer_clientname"].Tostring(); } //最后心跳时间(以当前库时间为准) if (dr.Table.Columns.Contains("tb_consumer_lastheartbeat")) { consumermodel.lastheartbeat = dr["tb_consumer_lastheartbeat"].ToDateTime(); } //上一次更新时间(以当前库时间为准) if (dr.Table.Columns.Contains("tb_consumer_lastupdatetime")) { consumermodel.lastupdatetime = dr["tb_consumer_lastupdatetime"].ToDateTime(); } //客户端创建时间(以当前库时间为准) if (dr.Table.Columns.Contains("tb_consumer_createtime")) { consumermodel.createtime = dr["tb_consumer_createtime"].ToDateTime(); } consumerclientmodel = new tb_consumer_client_model(); // if (dr.Table.Columns.Contains("tb_consumer_client_id")) { consumerclientmodel.id = dr["tb_consumer_client_id"].Toint(); } //客户端(消费者client,相同业务消费者注册必须一致) if (dr.Table.Columns.Contains("tb_consumer_client_client")) { consumerclientmodel.client = dr["tb_consumer_client_client"].Tostring(); } //当前消费者创建时间(以当前库时间为准) if (dr.Table.Columns.Contains("createtime")) { consumerclientmodel.createtime = dr["tb_consumer_client_createtime"].ToDateTime(); } consumerpartitionmodel = new tb_consumer_partition_model(); // if (dr.Table.Columns.Contains("tb_consumer_partition_id")) { consumerpartitionmodel.id = dr["tb_consumer_partition_id"].Toint(); } //消费者客户端ID if (dr.Table.Columns.Contains("tb_consumer_partition_consumerclientid")) { consumerpartitionmodel.consumerclientid = dr["tb_consumer_partition_consumerclientid"].Toint(); } // if (dr.Table.Columns.Contains("tb_consumer_partition_partitionindex")) { consumerpartitionmodel.partitionindex = dr["tb_consumer_partition_partitionindex"].Toint(); } //分区表ID if (dr.Table.Columns.Contains("tb_consumer_partition_partitionid")) { consumerpartitionmodel.partitionid = dr["tb_consumer_partition_partitionid"].Toint(); } // if (dr.Table.Columns.Contains("tb_consumer_partition_lastconsumertempid")) { consumerpartitionmodel.lastconsumertempid = dr["tb_consumer_partition_lastconsumertempid"].Tolong(); } //最后消费的MQID if (dr.Table.Columns.Contains("tb_consumer_partition_lastmqid")) { consumerpartitionmodel.lastmqid = dr["tb_consumer_partition_lastmqid"].Tolong(); } //消费者最后执行时间(以当前库时间为准) if (dr.Table.Columns.Contains("tb_consumer_partition_lastupdatetime")) { consumerpartitionmodel.lastupdatetime = dr["tb_consumer_partition_lastupdatetime"].ToDateTime(); } //消费者分区创建时间(以当前库时间为准) if (dr.Table.Columns.Contains("tb_consumer_partition_createtime")) { consumerpartitionmodel.createtime = dr["tb_consumer_partition_createtime"].ToDateTime(); } }
public virtual bool Edit(DbConn PubConn, tb_consumer_model model) { 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) }; Par.Add(new ProcedureParameter("@id", model.id)); int rev = PubConn.ExecuteSql("update tb_consumer set tempid=@tempid,consumerclientid=@consumerclientid,partitionindexs=@partitionindexs,clientname=@clientname,lastheartbeat=@lastheartbeat,lastupdatetime=@lastupdatetime,createtime=@createtime where id=@id", Par); return rev == 1; }
public RegisterdConsumersModel(DataRow dr) { // s.id as tb_consumer_id,tempid as tb_consumer_tempid,s.consumerclientid as tb_consumer_consumerclientid,s.partitionindexs as tb_consumer_partitionindexs //,s.clientname as tb_consumer_clientname,s.lastheartbeat as tb_consumer_lastheartbeat,s.lastupdatetime as tb_consumer_lastupdatetime,s.createtime as tb_consumer_createtime, //c.id as tb_consumer_client_id, c.client as tb_consumer_client_client,c.createtime as tb_consumer_client_createtime, p.id as tb_consumer_partition_id,p.consumerclientid as tb_consumer_partition_consumerclientid //,p.partitionindex as tb_consumer_partition_partitionindex,p.partitionid as tb_consumer_partition_partitionid,p.lastconsumertempid as tb_consumer_partition_lastconsumertempid,p.lastmqid as tb_consumer_partition_lastmqid //,p.lastupdatetime as tb_consumer_partition_lastupdatetime,p.createtime as tb_consumer_partition_createtime consumermodel = new tb_consumer_model(); // if (dr.Table.Columns.Contains("tb_consumer_id")) { consumermodel.id = dr["tb_consumer_id"].Toint(); } //消费者临时id(消费者启动后唯一,Guid转long) if (dr.Table.Columns.Contains("tb_consumer_tempid")) { consumermodel.tempid = dr["tb_consumer_tempid"].Tolong(); } //消费者clinet的id if (dr.Table.Columns.Contains("tb_consumer_consumerclientid")) { consumermodel.consumerclientid = dr["tb_consumer_consumerclientid"].Toint(); } //支持的分区顺序号(支持多个顺序号) if (dr.Table.Columns.Contains("tb_consumer_partitionindexs")) { consumermodel.partitionindexs = dr["tb_consumer_partitionindexs"].Tostring(); } //客户端名称 if (dr.Table.Columns.Contains("tb_consumer_clientname")) { consumermodel.clientname = dr["tb_consumer_clientname"].Tostring(); } //最后心跳时间(以当前库时间为准) if (dr.Table.Columns.Contains("tb_consumer_lastheartbeat")) { consumermodel.lastheartbeat = dr["tb_consumer_lastheartbeat"].ToDateTime(); } //上一次更新时间(以当前库时间为准) if (dr.Table.Columns.Contains("tb_consumer_lastupdatetime")) { consumermodel.lastupdatetime = dr["tb_consumer_lastupdatetime"].ToDateTime(); } //客户端创建时间(以当前库时间为准) if (dr.Table.Columns.Contains("tb_consumer_createtime")) { consumermodel.createtime = dr["tb_consumer_createtime"].ToDateTime(); } consumerclientmodel = new tb_consumer_client_model(); // if (dr.Table.Columns.Contains("tb_consumer_client_id")) { consumerclientmodel.id = dr["tb_consumer_client_id"].Toint(); } //客户端(消费者client,相同业务消费者注册必须一致) if (dr.Table.Columns.Contains("tb_consumer_client_client")) { consumerclientmodel.client = dr["tb_consumer_client_client"].Tostring(); } //当前消费者创建时间(以当前库时间为准) if (dr.Table.Columns.Contains("createtime")) { consumerclientmodel.createtime = dr["tb_consumer_client_createtime"].ToDateTime(); } consumerpartitionmodel = new tb_consumer_partition_model(); // if (dr.Table.Columns.Contains("tb_consumer_partition_id")) { consumerpartitionmodel.id = dr["tb_consumer_partition_id"].Toint(); } //消费者客户端ID if (dr.Table.Columns.Contains("tb_consumer_partition_consumerclientid")) { consumerpartitionmodel.consumerclientid = dr["tb_consumer_partition_consumerclientid"].Toint(); } // if (dr.Table.Columns.Contains("tb_consumer_partition_partitionindex")) { consumerpartitionmodel.partitionindex = dr["tb_consumer_partition_partitionindex"].Toint(); } //分区表ID if (dr.Table.Columns.Contains("tb_consumer_partition_partitionid")) { consumerpartitionmodel.partitionid = dr["tb_consumer_partition_partitionid"].Toint(); } // if (dr.Table.Columns.Contains("tb_consumer_partition_lastconsumertempid")) { consumerpartitionmodel.lastconsumertempid = dr["tb_consumer_partition_lastconsumertempid"].Tolong(); } //最后消费的MQID if (dr.Table.Columns.Contains("tb_consumer_partition_lastmqid")) { consumerpartitionmodel.lastmqid = dr["tb_consumer_partition_lastmqid"].Tolong(); } //消费者最后执行时间(以当前库时间为准) if (dr.Table.Columns.Contains("tb_consumer_partition_lastupdatetime")) { consumerpartitionmodel.lastupdatetime = dr["tb_consumer_partition_lastupdatetime"].ToDateTime(); } //消费者分区创建时间(以当前库时间为准) if (dr.Table.Columns.Contains("tb_consumer_partition_createtime")) { consumerpartitionmodel.createtime = dr["tb_consumer_partition_createtime"].ToDateTime(); } }