using ProjectBase.Data.BaseDAL.BaseDatabase; using ProjectBase.Util; using SIASUN.Autopilot.DAL.IDALSQL; using SIASUN.Autopilot.Model; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SIASUN.Autopilot.DAL.DALSQL { public class DalLocationMap : BaseDALSQL, IDalLocationMap { #region 对象实例及构造函数 public static DalLocationMap Instance { get { return new DalLocationMap(); } } public DalLocationMap() : base("location_map", new string[] { "map_id" }) { this.sortField = "map_id"; this.isDescending = false; } #endregion /// /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// /// 有效的DataReader对象 /// 实体类对象 protected override MoLocationMap DataReaderToEntity(IDataReader dataReader) { MoLocationMap info = new MoLocationMap(); SmartDataReader reader = new SmartDataReader(dataReader); info.MapId = reader.GetString("map_id"); info.LocationLon1 = reader.GetFloat("location_lon_1"); info.LocationLat1 = reader.GetFloat("location_lat_1"); info.LocationLon2 = reader.GetFloat("location_lon_2"); info.LocationLat2 = reader.GetFloat("location_lat_2"); info.LocationX1 = reader.GetFloat("location_X_1"); info.LocationY1 = reader.GetFloat("location_Y_1"); info.LocationX2 = reader.GetFloat("location_X_2"); info.LocationY2 = reader.GetFloat("location_Y_2"); return info; } /// /// 将实体对象的属性值转化为Hashtable对应的键值 /// /// 有效的实体对象 /// 包含键值映射的Hashtable protected override Hashtable GetHashByEntity(MoLocationMap obj) { MoLocationMap info = obj as MoLocationMap; Hashtable hash = new Hashtable(); hash.Add("map_id", info.MapId); hash.Add("location_lon_1", info.LocationLon1); hash.Add("location_lat_1", info.LocationLat1); hash.Add("location_lon_2", info.LocationLon2); hash.Add("location_lat_2", info.LocationLat2); hash.Add("location_X_1", info.LocationX1); hash.Add("location_Y_1", info.LocationY1); hash.Add("location_X_2", info.LocationX2); hash.Add("location_Y_2", info.LocationY2); return hash; } } }