DalPcData.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using ProjectBase.Data.BaseDAL.BaseDatabase;
  2. using ProjectBase.Util;
  3. using SIMDP.DAL.IDALSQL;
  4. using SIMDP.Model;
  5. using System;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using System.Data;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace SIMDP.DAL.DALSQL
  13. {
  14. public class DalPcData : BaseDALSQL<MoPcData>, IDalPcData
  15. {
  16. #region 对象实例及构造函数
  17. public static DalPcData Instance
  18. {
  19. get
  20. {
  21. return new DalPcData();
  22. }
  23. }
  24. public DalPcData() : base("PC_DATA", "ID")
  25. {
  26. }
  27. #endregion
  28. /// <summary>
  29. /// 将DataReader的属性值转化为实体类的属性值,返回实体类
  30. /// </summary>
  31. /// <param name="dr">有效的DataReader对象</param>
  32. /// <returns>实体类对象</returns>
  33. protected override MoPcData DataReaderToEntity(IDataReader dataReader)
  34. {
  35. MoPcData info = new MoPcData();
  36. SmartDataReader reader = new SmartDataReader(dataReader);
  37. info.Id = reader.GetInt32("ID");
  38. info.ImportTime = reader.GetDateTime("IMPORT_TIME");
  39. info.Model = reader.GetInt32("MODEL");
  40. info.Color = reader.GetInt32("COLOR");
  41. info.Vin = reader.GetString("VIN");
  42. return info;
  43. }
  44. /// <summary>
  45. /// 将实体对象的属性值转化为Hashtable对应的键值
  46. /// </summary>
  47. /// <param name="obj">有效的实体对象</param>
  48. /// <returns>包含键值映射的Hashtable</returns>
  49. protected override Hashtable GetHashByEntity(MoPcData obj)
  50. {
  51. MoPcData info = obj as MoPcData;
  52. Hashtable hash = new Hashtable();
  53. hash.Add("ID", info.Id);
  54. hash.Add("IMPORT_TIME", info.ImportTime);
  55. hash.Add("MODEL", info.Model);
  56. hash.Add("COLOR", info.Color);
  57. hash.Add("VIN", info.Vin);
  58. return hash;
  59. }
  60. /// <summary>
  61. /// 获取字段中文别名(用于界面显示)的字典集合
  62. /// </summary>
  63. /// <returns></returns>
  64. public override Dictionary<string, string> GetColumnNameAlias()
  65. {
  66. Dictionary<string, string> dict = new Dictionary<string, string>();
  67. #region 添加别名解析
  68. //dict.Add("ID", "编号");
  69. dict.Add("ID", "");
  70. dict.Add("ImportTime", "记录数据导入日期(防止第二天写入前未清除)");
  71. dict.Add("Model", "型号");
  72. dict.Add("Color", "颜色");
  73. dict.Add("Vin", "VIN码,限制17个字符");
  74. #endregion
  75. return dict;
  76. }
  77. }
  78. }