using ProjectBase.Data.BaseDAL.BaseDatabase; using ProjectBase.Util; using SIASUN.Autopilot.DAL.IDALSQL; using SIASUN.Autopilot.Model; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Text; namespace SIASUN.Autopilot.DAL.DALSQL { public class DalBeckhoffNode : BaseDALSQL, IDALBeckhoffNode { #region 对象实例及构造函数 public static DalBeckhoffNode Instance { get { return new DalBeckhoffNode(); } } public DalBeckhoffNode() : base("plc_beckhoff", new string[] { "id" }) { this.sortField = "id"; this.isDescending = false; } #endregion /// /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// /// 有效的DataReader对象 /// 实体类对象 protected override MoBeckhoffNode DataReaderToEntity(IDataReader dataReader) { MoBeckhoffNode info = new MoBeckhoffNode(); SmartDataReader reader = new SmartDataReader(dataReader); info.SequenceId = reader.GetInt64("id"); info.IP = reader.GetString("ip"); info.Port = reader.GetInt32("port"); info.NodeName = reader.GetString("node_name"); info.DataType = reader.GetString("datatype"); info.ReceiveType = reader.GetInt32("receivetype"); return info; } /// /// 将实体对象的属性值转化为Hashtable对应的键值 /// /// 有效的实体对象 /// 包含键值映射的Hashtable protected override Hashtable GetHashByEntity(MoBeckhoffNode obj) { MoBeckhoffNode info = obj as MoBeckhoffNode; Hashtable hash = new Hashtable(); hash.Add("id", info.SequenceId); hash.Add("ip", info.IP); hash.Add("port", info.Port); hash.Add("node_name", info.NodeName); hash.Add("datatype", info.DataType); hash.Add("receivetype", info.ReceiveType); return hash; } } }