DalActionDirective.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. namespace SIASUN.Autopilot.DAL.DALSQL
  13. {
  14. public class DalActionDirective : BaseDALSQL<MoActionDirective>, IDalActionDirective
  15. {
  16. #region 对象实例及构造函数
  17. public static DalActionDirective Instance
  18. {
  19. get
  20. {
  21. return new DalActionDirective();
  22. }
  23. }
  24. public DalActionDirective() : base("action_directive", new string[] { "rule_name", "directive_id" })
  25. {
  26. this.sortField = "rule_name";
  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 MoActionDirective DataReaderToEntity(IDataReader dataReader)
  36. {
  37. MoActionDirective info = new MoActionDirective();
  38. SmartDataReader reader = new SmartDataReader(dataReader);
  39. info.RuleName = reader.GetString("rule_name");
  40. info.DirectiveId = reader.GetInt64("directive_id");
  41. info.DirectiveInfo = reader.GetString("directive_info");
  42. info.DirectiveResult = reader.GetInt32("directive_result");
  43. return info;
  44. }
  45. /// <summary>
  46. /// 将实体对象的属性值转化为Hashtable对应的键值
  47. /// </summary>
  48. /// <param name="obj">有效的实体对象</param>
  49. /// <returns>包含键值映射的Hashtable</returns>
  50. protected override Hashtable GetHashByEntity(MoActionDirective obj)
  51. {
  52. MoActionDirective info = obj as MoActionDirective;
  53. Hashtable hash = new Hashtable();
  54. hash.Add("rule_name", info.RuleName);
  55. hash.Add("directive_id", info.DirectiveId);
  56. hash.Add("directive_info", info.DirectiveInfo);
  57. hash.Add("directive_result", info.DirectiveResult);
  58. return hash;
  59. }
  60. }
  61. }