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.Text; namespace SIASUN.Autopilot.DAL.DALSQL { public class DalWhite : BaseDALSQL, IDalWhite { #region 对象实例及构造函数 public static DalWhite Instance { get { return new DalWhite(); } } public DalWhite() : base("black", new string[] { "black_id" }) { this.sortField = "black_id"; this.isDescending = false; } #endregion /// /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// /// 有效的DataReader对象 /// 实体类对象 protected override MoWhite DataReaderToEntity(IDataReader dataReader) { MoWhite info = new MoWhite(); SmartDataReader reader = new SmartDataReader(dataReader); info.ID = reader.GetInt64("black_id"); info.Name = reader.GetString("black_name"); info.UserAccount = reader.GetString("black_UserAccount"); info.UserName = reader.GetString("black_UserName"); info.Type = reader.GetInt32("black_type"); info.Forbid = Convert.ToBoolean(reader.GetInt32("black_forbid")); info.IPStart = reader.GetString("black_ipStart"); info.IPEnd = reader.GetString("black_ipEnd"); info.Note = reader.GetString("black_note"); info.CreatorAccount = reader.GetString("black_creatorAccount"); info.CreatorName = reader.GetString("black_creatorName"); info.CreateTime = Convert.ToDateTime(reader.GetString("black_createTime")); info.EditorAccount = reader.GetString("black_editorAccount"); info.EditorName = reader.GetString("black_editorName"); info.EditTime = Convert.ToDateTime(reader.GetString("black_editorTime")); return info; } /// /// 将实体对象的属性值转化为Hashtable对应的键值 /// /// 有效的实体对象 /// 包含键值映射的Hashtable protected override Hashtable GetHashByEntity(MoWhite obj) { MoWhite info = obj as MoWhite; Hashtable hash = new Hashtable(); //hash.Add("logIn_id", info.ID); hash.Add("black_name", info.Name); hash.Add("black_UserAccount", info.UserAccount); hash.Add("black_UserName", info.UserName); hash.Add("black_type", info.Type); hash.Add("black_forbid", info.Forbid); hash.Add("black_ipStart", info.IPStart); hash.Add("black_ipEnd", info.IPEnd); hash.Add("black_note", info.Note); hash.Add("black_creatorAccount", info.CreatorAccount); hash.Add("black_creatorName", info.CreatorName); hash.Add("black_createTime", info.CreateTime); hash.Add("black_editorAccount", info.EditorAccount); hash.Add("black_editorName", info.EditorName); hash.Add("black_editorTime", info.EditTime); return hash; } } }