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 DalSequence : BaseDALSQL, IDalSequence { #region 对象实例及构造函数 public static DalSequence Instance { get { return new DalSequence(); } } public DalSequence() : base("sequence", "sequence_id") { this.sortField = "sequence_id"; this.isDescending = false; } #endregion /// /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// /// 有效的DataReader对象 /// 实体类对象 protected override MoSequence DataReaderToEntity(IDataReader dataReader) { MoSequence info = new MoSequence(); SmartDataReader reader = new SmartDataReader(dataReader); info.SequenceId = reader.GetInt64("sequence_id"); info.SequenceName = reader.GetString("sequence_name"); info.SequenceCurrent = reader.GetInt64("sequence_current"); info.SequenceMax = reader.GetInt64("sequence_max"); info.AddValue = reader.GetInt32("add_value"); return info; } /// /// 将实体对象的属性值转化为Hashtable对应的键值 /// /// 有效的实体对象 /// 包含键值映射的Hashtable protected override Hashtable GetHashByEntity(MoSequence obj) { MoSequence info = obj as MoSequence; Hashtable hash = new Hashtable(); //hash.Add("data_point_id", info.DataPointId); hash.Add("sequence_name", info.SequenceName); hash.Add("sequence_current", info.SequenceCurrent); hash.Add("sequence_max", info.SequenceMax); hash.Add("add_value", info.AddValue); return hash; } } }