protected override string ConnName
{
get { return DbConfig.PurviewConnection; }
}
protected override Sys_RoleInfo FillModelFromReader(System.Data.Common.DbDataReader reader, params string[] fields)
{
return ModelFromReader(reader, fields);
}
protected Sys_RoleInfo ModelFromReader(System.Data.Common.DbDataReader reader, params string[] fields)
{
var info = new Sys_RoleInfo();
if (UtilDAL.HasFields("RoleID", fields)) { info.RoleID = (int)reader["RoleID"]; }
if (UtilDAL.HasFields("Name", fields)) { info.Name = reader["Name"].ToString(); }
return info;
}
public List<Sys_RoleInfo> GetList(string fields, string query, string orderby, int pageIndex, int pageSize, out int totalCount)
public Sys_RoleInfo GetInfo(string fields, string query)
{
if (string.IsNullOrWhiteSpace(fields)) { fields = "*"; }
if (string.IsNullOrWhiteSpace(query)) { query = "1=1"; }
string sql = string.Format("SELECT {0} FROM dbo.Sys_Role WHERE {1}", fields, query);
return FindOne(sql);
}
public object Insert(Sys_RoleInfo info)
{
string sql = @"INSERT INTO Sys_Role(Name) VALUES(@Name);select @@IDENTITY";
return GetScalar(sql, UtilDAL.CreateParameter("Name", info.Name));
}
public int Update(Sys_RoleInfo info)
{
string sql = @"Update Sys_Role set Name=@Name where RoleID=@RoleID";
return Execute(sql, UtilDAL.CreateParameter("@RoleID", info.RoleID),
UtilDAL.CreateParameter("@Name", info.Name));
}
public int Delete(string query)
{
var sql = string.Format("DELETE Sys_Role WHERE {0} ", query);
return Execute(sql);
}
欢迎光临 苏飞论坛 (http://www.sufeinet.com/) | Powered by Discuz! X3.4 |