using ProjectBase.Data.BaseDAL.BaseDatabase; using ProjectBase.Util; using SIMDP.DAL.IDALSQL; using SIMDP.Model; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SIMDP.DAL.DALSQL { public class DalDataPoint : BaseDALSQL, IDalDataPoint { #region 对象实例及构造函数 public static DalDataPoint Instance { get { return new DalDataPoint(); } } public DalDataPoint() : base("data_point", "data_point_id") { this.sortField = "data_point_id"; this.isDescending = false; } #endregion /// /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// /// 有效的DataReader对象 /// 实体类对象 protected override MoDataPoint DataReaderToEntity(IDataReader dataReader) { MoDataPoint info = new MoDataPoint(); SmartDataReader reader = new SmartDataReader(dataReader); info.DataPointId = reader.GetInt64("data_point_id"); info.DataPointName = reader.GetString("data_point_name"); info.DataPointPlcId = reader.GetInt64("data_point_plc_id"); info.DataPointGroupId = reader.GetInt64("data_point_group_id"); info.DataPointSource = reader.GetString("data_point_source"); info.DataPointType = reader.GetInt64("data_point_type"); info.DataProc = reader.GetString("data_proc"); return info; } /// /// 将实体对象的属性值转化为Hashtable对应的键值 /// /// 有效的实体对象 /// 包含键值映射的Hashtable protected override Hashtable GetHashByEntity(MoDataPoint obj) { MoDataPoint info = obj as MoDataPoint; Hashtable hash = new Hashtable(); //hash.Add("data_point_id", info.DataPointId); hash.Add("data_point_name", info.DataPointName); hash.Add("data_point_plc_id", info.DataPointPlcId); hash.Add("data_point_group_id", info.DataPointGroupId); hash.Add("data_point_source", info.DataPointSource); hash.Add("data_point_type", info.DataPointType); hash.Add("data_proc", info.DataProc); return hash; } } }