DalAuthoryUser.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using ProjectBase.Data.BaseDAL.BaseDatabase;
  2. using ProjectBase.Util;
  3. using SIMDP.DAL.IDALSQL;
  4. using SIMDP.Model;
  5. using System.Collections;
  6. using System.Data;
  7. namespace SIMDP.DAL.DALSQL
  8. {
  9. public class DalAuthoryUser : BaseDALSQL<MoAuthoryUser>, IDalAuthoryUser
  10. {
  11. #region 对象实例及构造函数
  12. public static DalAuthoryUser Instance
  13. {
  14. get
  15. {
  16. return new DalAuthoryUser();
  17. }
  18. }
  19. public DalAuthoryUser() : base("authory_user", "login_account")
  20. {
  21. this.sortField = "login_account";
  22. this.isDescending = false;
  23. }
  24. #endregion
  25. /// <summary>
  26. /// 将DataReader的属性值转化为实体类的属性值,返回实体类
  27. /// </summary>
  28. /// <param name="dr">有效的DataReader对象</param>
  29. /// <returns>实体类对象</returns>
  30. protected override MoAuthoryUser DataReaderToEntity(IDataReader dataReader)
  31. {
  32. MoAuthoryUser info = new MoAuthoryUser();
  33. SmartDataReader reader = new SmartDataReader(dataReader);
  34. info.LoginAccount = reader.GetString("login_account");
  35. info.LoginPasswd = reader.GetString("login_passwd");
  36. info.UserName = reader.GetString("user_name");
  37. info.UserMobile = reader.GetString("user_mobile");
  38. info.UserEmail = reader.GetString("user_email");
  39. info.UserTime = reader.GetDateTime("user_time");
  40. info.GroupId = reader.GetString("group_id");
  41. info.UserStatus = reader.GetInt32("user_status");
  42. info.UserSex = reader.GetInt32("user_sex");
  43. info.CardId = reader.GetString("card_id");
  44. return info;
  45. }
  46. /// <summary>
  47. /// 将实体对象的属性值转化为Hashtable对应的键值
  48. /// </summary>
  49. /// <param name="obj">有效的实体对象</param>
  50. /// <returns>包含键值映射的Hashtable</returns>
  51. protected override Hashtable GetHashByEntity(MoAuthoryUser obj)
  52. {
  53. MoAuthoryUser info = obj as MoAuthoryUser;
  54. Hashtable hash = new Hashtable();
  55. hash.Add("login_account", info.LoginAccount);
  56. hash.Add("login_passwd", info.LoginPasswd);
  57. hash.Add("user_name", info.UserName);
  58. hash.Add("user_mobile", info.UserMobile);
  59. hash.Add("user_email", info.UserEmail);
  60. hash.Add("user_time", info.UserTime);
  61. hash.Add("group_id", info.GroupId);
  62. hash.Add("user_status", info.UserStatus);
  63. hash.Add("user_sex", info.UserSex);
  64. hash.Add("card_id", info.CardId);
  65. return hash;
  66. }
  67. }
  68. }