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 DalMenuInfo : BaseDALSQL, IDalMenuInfo
{
#region 对象实例及构造函数
public static DalMenuInfo Instance
{
get
{
return new DalMenuInfo();
}
}
public DalMenuInfo() : base("menu", new string[] { "menu_sequence" })
{
this.sortField = "menu_sequence";
this.isDescending = false;
}
#endregion
///
/// 将DataReader的属性值转化为实体类的属性值,返回实体类
///
/// 有效的DataReader对象
/// 实体类对象
protected override MoMenuInfo DataReaderToEntity(IDataReader dataReader)
{
MoMenuInfo info = new MoMenuInfo();
SmartDataReader reader = new SmartDataReader(dataReader);
info.ID = reader.GetString("menu_id");
info.Name = reader.GetString("menu_name");
info.PID = reader.GetString("menu_parent_id");
info.Icon = reader.GetString("menu_icon");
info.Seq = reader.GetString("menu_sequence");
info.FunctionId = reader.GetString("menu_function_id");
info.WinformType = reader.GetString("menu_winform_type");
info.Url = reader.GetString("menu_url");
info.WebIcon = reader.GetString("menu_webicon");
info.Creator_ID = reader.GetString("menu_create_id");
info.CreateTime = Convert.ToDateTime(reader.GetString("menu_create_time"));
info.Deleted = Convert.ToBoolean(reader.GetInt32("menu_delete"));
info.Visible = Convert.ToBoolean(reader.GetInt32("menu_visible"));
return info;
}
///
/// 将实体对象的属性值转化为Hashtable对应的键值
///
/// 有效的实体对象
/// 包含键值映射的Hashtable
protected override Hashtable GetHashByEntity(MoMenuInfo obj)
{
MoMenuInfo info = obj as MoMenuInfo;
Hashtable hash = new Hashtable();
hash.Add("menu_id", info.ID);
hash.Add("menu_name", info.Name);
hash.Add("menu_parent_id", info.PID);
hash.Add("menu_icon", info.Icon);
hash.Add("menu_sequence", info.Seq);
hash.Add("menu_function_id", info.FunctionId);
hash.Add("menu_winform_type", info.WinformType);
hash.Add("menu_url", info.Url);
hash.Add("menu_webicon", info.WebIcon);
hash.Add("menu_create_id", info.Creator_ID);
hash.Add("menu_create_time", info.CreateTime);
hash.Add("menu_delete", info.Deleted);
hash.Add("menu_visible", info.Visible);
return hash;
}
}
}