public void SetEnt(BuGPSInfo ent, IDataReader dr) { ent.GPSId = MyConvert.ToString(dr["GPSId"]); ent.SynchronizationType = MyConvert.ToString(dr["SynchronizationType"]); ent.SynchronizationTime = MyConvert.ToDateTime(dr["SynchronizationTime"]); ent.SynchronizationStatus = MyConvert.ToString(dr["SynchronizationStatus"]); ent.Longitude = MyConvert.ToString(dr["Longitude"]); ent.Latitude = MyConvert.ToString(dr["Latitude"]); ent.CarId = MyConvert.ToInt(dr["CarId"]); }
/// <summary> /// 得到列表 /// </summary> /// <param name="ent"></param> /// <returns></returns> public List <BuGPSInfo> GetBuGPSInfoList(string Where) { List <BuGPSInfo> list = new List <BuGPSInfo>(); using (DbDataReader reader = DataBaseManage.ExecuteReader(DalSql + Where)) { while (reader.Read()) { BuGPSInfo ent = new BuGPSInfo(); SetEnt(ent, reader); list.Add(ent); } } return(list); }
/// <summary> /// 根据GPSId得到 BuGPSInfo 实体 /// </summary> /// <param name="ent"></param> /// <returns></returns> public BuGPSInfo GetBuGPSInfo(string GPSId) { BuGPSInfo ent = null; string sql = DalSql; sql = sql + " And GPSId"; MySqlParameter[] paras = new MySqlParameter[] { new MySqlParameter("GPSId", GPSId) }; using (DbDataReader reader = DataBaseManage.ExecuteReader(sql, paras)) { if (reader.Read()) { ent = new BuGPSInfo(); SetEnt(ent, reader); } } return(ent); }