public virtual tb_producter_model CreateModel(DataRow dr) { var o = new tb_producter_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(); } //���������� if(dr.Table.Columns.Contains("productername")) { o.productername = dr["productername"].Tostring(); } //ip��ַ if(dr.Table.Columns.Contains("ip")) { o.ip = dr["ip"].Tostring(); } //����id if(dr.Table.Columns.Contains("mqpathid")) { o.mqpathid = dr["mqpathid"].Toint(); } //�������������ʱ�� if(dr.Table.Columns.Contains("lastheartbeat")) { o.lastheartbeat = dr["lastheartbeat"].ToDateTime(); } //�����ߴ���ʱ�� if(dr.Table.Columns.Contains("createtime")) { o.createtime = dr["createtime"].ToDateTime(); } return o; }
public virtual bool Add(DbConn PubConn, tb_producter_model model) { List<ProcedureParameter> Par = new List<ProcedureParameter>() { //��������ʱid(�����������Ψһ,Guidתlong) new ProcedureParameter("@tempid", model.tempid), //���������� new ProcedureParameter("@productername", model.productername), //ip��ַ new ProcedureParameter("@ip", model.ip), //����id new ProcedureParameter("@mqpathid", model.mqpathid), //�������������ʱ�� new ProcedureParameter("@lastheartbeat", model.lastheartbeat), //�����ߴ���ʱ�� new ProcedureParameter("@createtime", model.createtime) }; int rev = PubConn.ExecuteSql(@"insert into tb_producter(tempid,productername,ip,mqpathid,lastheartbeat,createtime) values(@tempid,@productername,@ip,@mqpathid,@lastheartbeat,@createtime)", Par); return rev == 1; }
public virtual bool Edit(DbConn PubConn, tb_producter_model model) { List<ProcedureParameter> Par = new List<ProcedureParameter>() { //��������ʱid(�����������Ψһ,Guidתlong) new ProcedureParameter("@tempid", model.tempid), //���������� new ProcedureParameter("@productername", model.productername), //ip��ַ new ProcedureParameter("@ip", model.ip), //����id new ProcedureParameter("@mqpathid", model.mqpathid), //�������������ʱ�� new ProcedureParameter("@lastheartbeat", model.lastheartbeat), //�����ߴ���ʱ�� new ProcedureParameter("@createtime", model.createtime) }; Par.Add(new ProcedureParameter("@id", model.id)); int rev = PubConn.ExecuteSql("update tb_producter set tempid=@tempid,productername=@productername,ip=@ip,mqpathid=@mqpathid,lastheartbeat=@lastheartbeat,createtime=@createtime where id=@id", Par); return rev == 1; }