DalLocationMap.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using ProjectBase.Data.BaseDAL.BaseDatabase;
  2. using ProjectBase.Util;
  3. using SIASUN.Autopilot.DAL.IDALSQL;
  4. using SIASUN.Autopilot.Model;
  5. using System;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using System.Data;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace SIASUN.Autopilot.DAL.DALSQL
  13. {
  14. public class DalLocationMap : BaseDALSQL<MoLocationMap>, IDalLocationMap
  15. {
  16. #region 对象实例及构造函数
  17. public static DalLocationMap Instance
  18. {
  19. get
  20. {
  21. return new DalLocationMap();
  22. }
  23. }
  24. public DalLocationMap() : base("location_map", new string[] { "map_id" })
  25. {
  26. this.sortField = "map_id";
  27. this.isDescending = false;
  28. }
  29. #endregion
  30. /// <summary>
  31. /// 将DataReader的属性值转化为实体类的属性值,返回实体类
  32. /// </summary>
  33. /// <param name="dr">有效的DataReader对象</param>
  34. /// <returns>实体类对象</returns>
  35. protected override MoLocationMap DataReaderToEntity(IDataReader dataReader)
  36. {
  37. MoLocationMap info = new MoLocationMap();
  38. SmartDataReader reader = new SmartDataReader(dataReader);
  39. info.MapId = reader.GetString("map_id");
  40. info.LocationLon1 = reader.GetFloat("location_lon_1");
  41. info.LocationLat1 = reader.GetFloat("location_lat_1");
  42. info.LocationLon2 = reader.GetFloat("location_lon_2");
  43. info.LocationLat2 = reader.GetFloat("location_lat_2");
  44. info.LocationX1 = reader.GetFloat("location_X_1");
  45. info.LocationY1 = reader.GetFloat("location_Y_1");
  46. info.LocationX2 = reader.GetFloat("location_X_2");
  47. info.LocationY2 = reader.GetFloat("location_Y_2");
  48. return info;
  49. }
  50. /// <summary>
  51. /// 将实体对象的属性值转化为Hashtable对应的键值
  52. /// </summary>
  53. /// <param name="obj">有效的实体对象</param>
  54. /// <returns>包含键值映射的Hashtable</returns>
  55. protected override Hashtable GetHashByEntity(MoLocationMap obj)
  56. {
  57. MoLocationMap info = obj as MoLocationMap;
  58. Hashtable hash = new Hashtable();
  59. hash.Add("map_id", info.MapId);
  60. hash.Add("location_lon_1", info.LocationLon1);
  61. hash.Add("location_lat_1", info.LocationLat1);
  62. hash.Add("location_lon_2", info.LocationLon2);
  63. hash.Add("location_lat_2", info.LocationLat2);
  64. hash.Add("location_X_1", info.LocationX1);
  65. hash.Add("location_Y_1", info.LocationY1);
  66. hash.Add("location_X_2", info.LocationX2);
  67. hash.Add("location_Y_2", info.LocationY2);
  68. return hash;
  69. }
  70. }
  71. }