using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ProjectBase.Data.BaseDAL.BaseDatabase; using ProjectBase.Util; using SIMDP.DAL.IDALSQL; using SIMDP.Model; using System.Data; using System.Collections; namespace SIMDP.DAL.DALSQL { public class DalPlcInfo: BaseDALSQL, IDalPlcInfo { #region 对象实例及构造函数 public static DalPlcInfo Instance { get { return new DalPlcInfo(); } } public DalPlcInfo() : base("plc_info", "plc_id") { this.sortField = "plc_id"; this.isDescending = false; } #endregion /// /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// /// 有效的DataReader对象 /// 实体类对象 protected override MoPlcInfo DataReaderToEntity(IDataReader dataReader) { MoPlcInfo info = new MoPlcInfo(); SmartDataReader reader = new SmartDataReader(dataReader); info.PlcId = reader.GetInt64("plc_id"); info.PlcName = reader.GetString("plc_name"); info.LinkType = reader.GetInt64("link_type"); info.LinkConfig = reader.GetString("link_config"); return info; } /// /// 将实体对象的属性值转化为Hashtable对应的键值 /// /// 有效的实体对象 /// 包含键值映射的Hashtable protected override Hashtable GetHashByEntity(MoPlcInfo obj) { MoPlcInfo info = obj as MoPlcInfo; Hashtable hash = new Hashtable(); //hash.Add("plc_id", info.PlcId); hash.Add("plc_name", info.PlcName); hash.Add("link_type", info.LinkType); hash.Add("link_config", info.LinkConfig); return hash; } /// /// 获取字段中文别名(用于界面显示)的字典集合 /// /// public override Dictionary GetColumnNameAlias() { Dictionary dict = new Dictionary(); #region 添加别名解析 dict.Add("plc_id", "PLC编号"); dict.Add("plc_name", "PLC名称"); dict.Add("link_type", "连接类型"); dict.Add("link_config", "连接信息"); #endregion return dict; } } }