DalAuthoryUser.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 DalAuthoryUser : BaseDALSQL<MoAuthoryUser>, IDalAuthoryUser
  12. {
  13. #region 对象实例及构造函数
  14. public static DalAuthoryUser Instance
  15. {
  16. get
  17. {
  18. return new DalAuthoryUser();
  19. }
  20. }
  21. public DalAuthoryUser() : base("authory_user", new string[] { "login_account" })
  22. {
  23. this.sortField = "login_account";
  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 MoAuthoryUser DataReaderToEntity(IDataReader dataReader)
  33. {
  34. MoAuthoryUser info = new MoAuthoryUser();
  35. SmartDataReader reader = new SmartDataReader(dataReader);
  36. info.LoginAccount = reader.GetString("login_account");
  37. info.LoginPasswd = reader.GetString("login_passwd");
  38. info.UserName = reader.GetString("user_name");
  39. info.UserMobile = reader.GetString("user_mobile");
  40. info.UserEmail = reader.GetString("user_email");
  41. info.UserTime = reader.GetDateTime("user_time");
  42. info.GroupId = reader.GetString("group_id");
  43. info.UserStatus = reader.GetInt32("user_status");
  44. info.UserSex = reader.GetInt32("user_sex");
  45. info.CardId = reader.GetString("card_id");
  46. return info;
  47. }
  48. /// <summary>
  49. /// 将实体对象的属性值转化为Hashtable对应的键值
  50. /// </summary>
  51. /// <param name="obj">有效的实体对象</param>
  52. /// <returns>包含键值映射的Hashtable</returns>
  53. protected override Hashtable GetHashByEntity(MoAuthoryUser obj)
  54. {
  55. MoAuthoryUser info = obj as MoAuthoryUser;
  56. Hashtable hash = new Hashtable();
  57. hash.Add("login_account", info.LoginAccount);
  58. hash.Add("login_passwd", info.LoginPasswd);
  59. hash.Add("user_name", info.UserName);
  60. hash.Add("user_mobile", info.UserMobile);
  61. hash.Add("user_email", info.UserEmail);
  62. hash.Add("user_time", info.UserTime);
  63. hash.Add("group_id", info.GroupId);
  64. hash.Add("user_status", info.UserStatus);
  65. hash.Add("user_sex", info.UserSex);
  66. hash.Add("card_id", info.CardId);
  67. return hash;
  68. }
  69. }
  70. }