using ProjectBase.Data.BaseDAL.BaseDatabase; using System; using SIASUN.Autopilot.Model; using System.Text; using SIASUN.Autopilot.DAL.IDALSQL; using System.Data; using System.Collections; using ProjectBase.Util; namespace SIASUN.Autopilot.DAL.DALSQL { public class DalLogOperation : BaseDALSQL, IDalLogOperation { #region 对象实例及构造函数 public static DalLogOperation Instance { get { return new DalLogOperation(); } } public DalLogOperation() : base("log_operation", new string[] { "operation_id" }) { this.sortField = "operation_id"; this.isDescending = false; } #endregion /// /// 将DataReader的属性值转化为实体类的属性值,返回实体类 /// /// 有效的DataReader对象 /// 实体类对象 protected override MoLogOperation DataReaderToEntity(IDataReader dataReader) { MoLogOperation info = new MoLogOperation(); SmartDataReader reader = new SmartDataReader(dataReader); info.ID = reader.GetInt64("operation_id"); info.Account = reader.GetString("operation_account"); info.Name = reader.GetString("operation_name"); info.GroupId = reader.GetString("operation_groupId"); info.TableName = reader.GetString("operation_tableName"); info.Type = reader.GetString("operation_type"); info.Ip = reader.GetString("operation_ip"); info.Mac = reader.GetString("operation_mac"); info.Time = Convert.ToDateTime(reader.GetString("operation_time")); return info; } /// /// 将实体对象的属性值转化为Hashtable对应的键值 /// /// 有效的实体对象 /// 包含键值映射的Hashtable protected override Hashtable GetHashByEntity(MoLogOperation obj) { MoLogOperation info = obj as MoLogOperation; Hashtable hash = new Hashtable(); //hash.Add("logIn_id", info.ID); hash.Add("operation_account", info.Account); hash.Add("operation_name", info.Name); hash.Add("operation_groupId", info.GroupId); hash.Add("operation_tableName", info.TableName); hash.Add("operation_type", info.Type); hash.Add("operation_ip", info.Ip); hash.Add("operation_mac", info.Mac); hash.Add("operation_time", info.Time); return hash; } } }