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 DalPcData : BaseDALSQL, IDalPcData { #region 对象实例及构造函数 public static DalPcData Instance { get { return new DalPcData(); } } public DalPcData() : base("PC_DATA", "ID") { } #endregion /// /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// /// 有效的DataReader对象 /// 实体类对象 protected override MoPcData DataReaderToEntity(IDataReader dataReader) { MoPcData info = new MoPcData(); SmartDataReader reader = new SmartDataReader(dataReader); info.Id = reader.GetInt32("ID"); info.ImportTime = reader.GetDateTime("IMPORT_TIME"); info.Model = reader.GetInt32("MODEL"); info.Color = reader.GetInt32("COLOR"); info.Vin = reader.GetString("VIN"); return info; } /// /// 将实体对象的属性值转化为Hashtable对应的键值 /// /// 有效的实体对象 /// 包含键值映射的Hashtable protected override Hashtable GetHashByEntity(MoPcData obj) { MoPcData info = obj as MoPcData; Hashtable hash = new Hashtable(); hash.Add("ID", info.Id); hash.Add("IMPORT_TIME", info.ImportTime); hash.Add("MODEL", info.Model); hash.Add("COLOR", info.Color); hash.Add("VIN", info.Vin); return hash; } /// /// 获取字段中文别名(用于界面显示)的字典集合 /// /// public override Dictionary GetColumnNameAlias() { Dictionary dict = new Dictionary(); #region 添加别名解析 //dict.Add("ID", "编号"); dict.Add("ID", ""); dict.Add("ImportTime", "记录数据导入日期(防止第二天写入前未清除)"); dict.Add("Model", "型号"); dict.Add("Color", "颜色"); dict.Add("Vin", "VIN码,限制17个字符"); #endregion return dict; } } }