DalAuthoryRole.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using ProjectBase.Data.BaseDAL.BaseDatabase;
  2. using ProjectBase.Util;
  3. using SIASUN.Autopilot.DAL.IDALSQL;
  4. using SIASUN.Autopilot.Model;
  5. using System;
  6. using System.Collections;
  7. using System.Collections.Generic;
  8. using System.Data;
  9. namespace SIASUN.Autopilot.DAL.DALSQL
  10. {
  11. public class DalAuthoryRole : BaseDALSQL<MoAuthoryRole>, IDalAuthoryRole
  12. {
  13. #region 对象实例及构造函数
  14. public static DalAuthoryRole Instance
  15. {
  16. get
  17. {
  18. return new DalAuthoryRole();
  19. }
  20. }
  21. public DalAuthoryRole() : base("authory_role", new string[] { "role_id" })
  22. {
  23. this.sortField = "role_id";
  24. this.isDescending = false;
  25. }
  26. #endregion
  27. /// <summary>
  28. /// 将DataReader的属性值转化为实体类的属性值,返回实体类
  29. /// </summary>
  30. /// <param name="dr">有效的DataReader对象</param>
  31. /// <returns>实体类对象</returns>
  32. protected override MoAuthoryRole DataReaderToEntity(IDataReader dataReader)
  33. {
  34. MoAuthoryRole info = new MoAuthoryRole();
  35. SmartDataReader reader = new SmartDataReader(dataReader);
  36. info.RoleId = reader.GetString("role_id");
  37. info.RoleName = reader.GetString("role_name");
  38. info.RoleTime = reader.GetDateTime("role_time");
  39. info.RoleDescription = reader.GetString("role_description");
  40. return info;
  41. }
  42. /// <summary>
  43. /// 将实体对象的属性值转化为Hashtable对应的键值
  44. /// </summary>
  45. /// <param name="obj">有效的实体对象</param>
  46. /// <returns>包含键值映射的Hashtable</returns>
  47. protected override Hashtable GetHashByEntity(MoAuthoryRole obj)
  48. {
  49. MoAuthoryRole info = obj as MoAuthoryRole;
  50. Hashtable hash = new Hashtable();
  51. hash.Add("role_id", info.RoleId);
  52. hash.Add("role_name", info.RoleName);
  53. hash.Add("role_time", info.RoleTime);
  54. hash.Add("role_description", info.RoleDescription);
  55. return hash;
  56. }
  57. }
  58. }