DalLogOperation.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using ProjectBase.Data.BaseDAL.BaseDatabase;
  7. using ProjectBase.Util;
  8. using SIMDP.DAL.IDALSQL;
  9. using SIMDP.Model;
  10. using System.Collections;
  11. using System.Data;
  12. namespace SIMDP.DAL.DALSQL
  13. {
  14. public class DalLogOperation : BaseDALSQL<MoLogOperation>, IDalLogOperation
  15. {
  16. #region 对象实例及构造函数
  17. public static DalLogOperation Instance
  18. {
  19. get
  20. {
  21. return new DalLogOperation();
  22. }
  23. }
  24. public DalLogOperation() : base("log_operation", "operation_id")
  25. {
  26. this.sortField = "operation_id";
  27. this.isDescending = false;
  28. }
  29. #endregion
  30. /// <summary>
  31. /// 将DataReader的属性值转化为实体类的属性值,返回实体类
  32. /// </summary>
  33. /// <param name="dr">有效的DataReader对象</param>
  34. /// <returns>实体类对象</returns>
  35. protected override MoLogOperation DataReaderToEntity(IDataReader dataReader)
  36. {
  37. MoLogOperation info = new MoLogOperation();
  38. SmartDataReader reader = new SmartDataReader(dataReader);
  39. info.ID = reader.GetInt64("operation_id");
  40. info.Account = reader.GetString("operation_account");
  41. info.Name = reader.GetString("operation_name");
  42. info.GroupId = reader.GetString("operation_groupId");
  43. info.TableName = reader.GetString("operation_tableName");
  44. info.Type = reader.GetString("operation_type");
  45. info.Ip = reader.GetString("operation_ip");
  46. info.Mac = reader.GetString("operation_mac");
  47. info.Time = Convert.ToDateTime(reader.GetString("operation_time"));
  48. return info;
  49. }
  50. /// <summary>
  51. /// 将实体对象的属性值转化为Hashtable对应的键值
  52. /// </summary>
  53. /// <param name="obj">有效的实体对象</param>
  54. /// <returns>包含键值映射的Hashtable</returns>
  55. protected override Hashtable GetHashByEntity(MoLogOperation obj)
  56. {
  57. MoLogOperation info = obj as MoLogOperation;
  58. Hashtable hash = new Hashtable();
  59. //hash.Add("logIn_id", info.ID);
  60. hash.Add("operation_account", info.Account);
  61. hash.Add("operation_name", info.Name);
  62. hash.Add("operation_groupId", info.GroupId);
  63. hash.Add("operation_tableName", info.TableName);
  64. hash.Add("operation_type", info.Type);
  65. hash.Add("operation_ip", info.Ip);
  66. hash.Add("operation_mac", info.Mac);
  67. hash.Add("operation_time", info.Time);
  68. return hash;
  69. }
  70. }
  71. }