DalDataPoint.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using ProjectBase.Data.BaseDAL.BaseDatabase;
  2. using ProjectBase.Util;
  3. using SIMDP.DAL.IDALSQL;
  4. using SIMDP.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 SIMDP.DAL.DALSQL
  13. {
  14. public class DalDataPoint : BaseDALSQL<MoDataPoint>, IDalDataPoint
  15. {
  16. #region 对象实例及构造函数
  17. public static DalDataPoint Instance
  18. {
  19. get
  20. {
  21. return new DalDataPoint();
  22. }
  23. }
  24. public DalDataPoint() : base("data_point", "data_point_id")
  25. {
  26. this.sortField = "data_point_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 MoDataPoint DataReaderToEntity(IDataReader dataReader)
  36. {
  37. MoDataPoint info = new MoDataPoint();
  38. SmartDataReader reader = new SmartDataReader(dataReader);
  39. info.DataPointId = reader.GetInt64("data_point_id");
  40. info.DataPointName = reader.GetString("data_point_name");
  41. info.DataPointPlcId = reader.GetInt64("data_point_plc_id");
  42. info.DataPointGroupId = reader.GetInt64("data_point_group_id");
  43. info.DataPointSource = reader.GetString("data_point_source");
  44. info.DataPointType = reader.GetInt64("data_point_type");
  45. info.DataProc = reader.GetString("data_proc");
  46. return info;
  47. }
  48. /// <summary>
  49. /// 将实体对象的属性值转化为Hashtable对应的键值
  50. /// </summary>
  51. /// <param name="obj">有效的实体对象</param>
  52. /// <returns>包含键值映射的Hashtable</returns>
  53. protected override Hashtable GetHashByEntity(MoDataPoint obj)
  54. {
  55. MoDataPoint info = obj as MoDataPoint;
  56. Hashtable hash = new Hashtable();
  57. //hash.Add("data_point_id", info.DataPointId);
  58. hash.Add("data_point_name", info.DataPointName);
  59. hash.Add("data_point_plc_id", info.DataPointPlcId);
  60. hash.Add("data_point_group_id", info.DataPointGroupId);
  61. hash.Add("data_point_source", info.DataPointSource);
  62. hash.Add("data_point_type", info.DataPointType);
  63. hash.Add("data_proc", info.DataProc);
  64. return hash;
  65. }
  66. }
  67. }