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 DalSrsData : BaseDALSQL, IDalSrsData { #region 对象实例及构造函数 public static DalSrsData Instance { get { return new DalSrsData(); } } public DalSrsData() : base("SRS_DATA", "SEQUENCE") { } #endregion /// /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// /// 有效的DataReader对象 /// 实体类对象 protected override MoSrsData DataReaderToEntity(IDataReader dataReader) { MoSrsData info = new MoSrsData(); SmartDataReader reader = new SmartDataReader(dataReader); info.Sequence = reader.GetInt32("SEQUENCE"); info.ImportTime = reader.GetDateTime("IMPORT_TIME"); info.Model = reader.GetInt32("MODEL"); info.Color = reader.GetInt32("COLOR"); info.Vin = reader.GetString("VIN"); info.AlreadyRead = reader.GetBoolean("ALREADY_READ"); info.Operator = reader.GetString("OPERATOR"); info.ExportTime = reader.GetDateTime("EXPORT_TIME"); return info; } /// /// 将实体对象的属性值转化为Hashtable对应的键值 /// /// 有效的实体对象 /// 包含键值映射的Hashtable protected override Hashtable GetHashByEntity(MoSrsData obj) { MoSrsData info = obj as MoSrsData; Hashtable hash = new Hashtable(); hash.Add("SEQUENCE", info.Sequence); hash.Add("IMPORT_TIME", info.ImportTime); hash.Add("MODEL", info.Model); hash.Add("COLOR", info.Color); hash.Add("VIN", info.Vin); hash.Add("ALREADY_READ", info.AlreadyRead); hash.Add("OPERATOR", info.Operator); hash.Add("EXPORT_TIME", info.ExportTime); return hash; } /// /// 获取字段中文别名(用于界面显示)的字典集合 /// /// public override Dictionary GetColumnNameAlias() { Dictionary dict = new Dictionary(); #region 添加别名解析 //dict.Add("ID", "编号"); dict.Add("Sequence", "当日序列1~1500"); dict.Add("ImportTime", "记录数据导入日期(防止第二天写入前未清除)"); dict.Add("Model", "型号"); dict.Add("Color", "颜色"); dict.Add("Vin", "VIN码,限制17个字符"); dict.Add("AlreadyRead", "记录数据是否被读取,读取完成=1,新写入=0"); dict.Add("Operator", "记录操作者(SRS或PC)"); dict.Add("ExportTime", "读取时间"); #endregion return dict; } } }