DalLogOperation.cs 2.7 KB

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