using ProjectBase.Data.BaseDAL.BaseDatabase; using ProjectBase.Util; using SIMDP.DAL.IDALSQL; using SIMDP.Model; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SIMDP.DAL.DALSQL { public class DalSystemNotice : BaseDALSQL, IDalSystemNotice { #region 对象实例及构造函数 public static DalSystemNotice Instance { get { return new DalSystemNotice(); } } public DalSystemNotice() : base("system_notice","notic_id") { this.sortField = "notic_id"; this.isDescending = false; } #endregion /// /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// /// 有效的DataReader对象 /// 实体类对象 protected override MoSystemNotice DataReaderToEntity(IDataReader dataReader) { MoSystemNotice info = new MoSystemNotice(); SmartDataReader reader = new SmartDataReader(dataReader); info.ID = reader.GetInt64("notic_id"); info.NoticeTitle = reader.GetString("notice_title"); info.NoticeType = reader.GetInt32("notice_type"); info.NoticeContent = reader.GetString("notice_content"); info.NoticeOperator = reader.GetString("notice_operator"); info.NoticeTime = Convert.ToDateTime(reader.GetString("notice_time")); info.NoticeSign = Convert.ToBoolean(reader.GetInt32("notice_sign")); return info; } /// /// 将实体对象的属性值转化为Hashtable对应的键值 /// /// 有效的实体对象 /// 包含键值映射的Hashtable protected override Hashtable GetHashByEntity(MoSystemNotice obj) { MoSystemNotice info = obj as MoSystemNotice; Hashtable hash = new Hashtable(); //hash.Add("notic_id", info.ID); hash.Add("notice_title", info.NoticeTitle); hash.Add("notice_type", info.NoticeType); hash.Add("notice_content", info.NoticeContent); hash.Add("notice_sign", info.NoticeSign); hash.Add("notice_operator", info.NoticeOperator); hash.Add("notice_time", info.NoticeTime); return hash; } } }