public ADeeWu.HuoBi3J.Model.Key_BusinessCircle GetEntity(string where) { DataTable dt = this.Select(where,""); if(dt.Rows.Count==0) return null; DataRow dr = dt.Rows[0]; ADeeWu.HuoBi3J.Model.Key_BusinessCircle Entity = new ADeeWu.HuoBi3J.Model.Key_BusinessCircle(); Entity.BID = long.Parse(dr["BID"].ToString()); Entity.BName = dr["BName"] as string; Entity.CreateTime = dr["CreateTime"] as DateTime?; Entity.Lat = dr["Lat"] as double?; Entity.Lng = dr["Lng"] as double?; return Entity; }
public ADeeWu.HuoBi3J.Model.Key_BusinessCircle[] GetEntityList(string orderBy,string[] columns,params object[] values) { StringBuilder builder = new StringBuilder(); builder.Append("select * from [Key_BusinessCircle] where 1=1"); db.Parameters.Clear(); for(int i=0;i<columns.Length;i++) { builder.AppendFormat(" and [{0}]=@{0}", columns[i]); db.Parameters.Append("@"+columns[i],values[i]); } if (!string.IsNullOrEmpty(orderBy)) { builder.AppendFormat(" order by {0}", orderBy); } DataTable dt = db.Select(builder.ToString()); ADeeWu.HuoBi3J.Model.Key_BusinessCircle[] EntityList = new ADeeWu.HuoBi3J.Model.Key_BusinessCircle[dt.Rows.Count]; if (dt.Rows.Count == 0) return EntityList; for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; ADeeWu.HuoBi3J.Model.Key_BusinessCircle Entity = new ADeeWu.HuoBi3J.Model.Key_BusinessCircle(); Entity.BID = long.Parse(dr["BID"].ToString()); Entity.BName = dr["BName"] as string; Entity.CreateTime = dr["CreateTime"] as DateTime?; Entity.Lat = dr["Lat"] as double?; Entity.Lng = dr["Lng"] as double?; EntityList[i] = Entity; } return EntityList; }
public ADeeWu.HuoBi3J.Model.Key_BusinessCircle GetEntity(long BID) { db.Parameters.Clear(); db.Parameters.Append("@BID",BID); DataTable dt = db.Select("select * from [Key_BusinessCircle] where 1=1 and [BID]=@BID"); if(dt.Rows.Count==0) return null; DataRow dr = dt.Rows[0]; ADeeWu.HuoBi3J.Model.Key_BusinessCircle Entity = new ADeeWu.HuoBi3J.Model.Key_BusinessCircle(); Entity.BID = long.Parse(dr["BID"].ToString()); Entity.BName = dr["BName"] as string; Entity.CreateTime = dr["CreateTime"] as DateTime?; Entity.Lat = dr["Lat"] as double?; Entity.Lng = dr["Lng"] as double?; return Entity; }