using ProjectBase.Data.BaseDAL.BaseDatabase; using ProjectBase.Util; using SIASUN.Autopilot.DAL.IDALSQL; using SIASUN.Autopilot.Model; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SIASUN.Autopilot.DAL.DALSQL { public class DalActionDirective : BaseDALSQL, IDalActionDirective { #region 对象实例及构造函数 public static DalActionDirective Instance { get { return new DalActionDirective(); } } public DalActionDirective() : base("action_directive", new string[] { "rule_name", "directive_id" }) { this.sortField = "rule_name"; this.isDescending = false; } #endregion /// /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// /// 有效的DataReader对象 /// 实体类对象 protected override MoActionDirective DataReaderToEntity(IDataReader dataReader) { MoActionDirective info = new MoActionDirective(); SmartDataReader reader = new SmartDataReader(dataReader); info.RuleName = reader.GetString("rule_name"); info.DirectiveId = reader.GetInt64("directive_id"); info.DirectiveInfo = reader.GetString("directive_info"); info.DirectiveResult = reader.GetInt32("directive_result"); return info; } /// /// 将实体对象的属性值转化为Hashtable对应的键值 /// /// 有效的实体对象 /// 包含键值映射的Hashtable protected override Hashtable GetHashByEntity(MoActionDirective obj) { MoActionDirective info = obj as MoActionDirective; Hashtable hash = new Hashtable(); hash.Add("rule_name", info.RuleName); hash.Add("directive_id", info.DirectiveId); hash.Add("directive_info", info.DirectiveInfo); hash.Add("directive_result", info.DirectiveResult); return hash; } } }