DalLocationRuleInfo.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 DalLocationRuleInfo : BaseDALSQL<MoLocationRuleInfo>, IDalLocationRuleInfo
  15. {
  16. #region 对象实例及构造函数
  17. public static DalLocationRuleInfo Instance
  18. {
  19. get
  20. {
  21. return new DalLocationRuleInfo();
  22. }
  23. }
  24. public DalLocationRuleInfo() : base("location_rule_info", new string[] { "rule_name", "locaton_id" })
  25. {
  26. this.sortField = "rule_name";
  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 MoLocationRuleInfo DataReaderToEntity(IDataReader dataReader)
  36. {
  37. MoLocationRuleInfo info = new MoLocationRuleInfo();
  38. SmartDataReader reader = new SmartDataReader(dataReader);
  39. info.RuleName = reader.GetString("rule_name");
  40. info.LocatonId = reader.GetInt64("locaton_id");
  41. info.LocationLon = reader.GetDouble("location_lon");
  42. info.LocationLat = reader.GetDouble("location_lat");
  43. info.LocationHeight = reader.GetDouble("location_height");
  44. info.LocationSpeed = reader.GetFloat("location_speed");
  45. return info;
  46. }
  47. /// <summary>
  48. /// 将实体对象的属性值转化为Hashtable对应的键值
  49. /// </summary>
  50. /// <param name="obj">有效的实体对象</param>
  51. /// <returns>包含键值映射的Hashtable</returns>
  52. protected override Hashtable GetHashByEntity(MoLocationRuleInfo obj)
  53. {
  54. MoLocationRuleInfo info = obj as MoLocationRuleInfo;
  55. Hashtable hash = new Hashtable();
  56. hash.Add("rule_name", info.RuleName);
  57. hash.Add("locaton_id", info.LocatonId);
  58. hash.Add("location_lon", info.LocationLon);
  59. hash.Add("location_lat", info.LocationLat);
  60. hash.Add("location_speed", info.LocationSpeed);
  61. hash.Add("location_height", info.LocationHeight);
  62. return hash;
  63. }
  64. }
  65. }