重构代码:移除Description和Status的[]标注
This commit is contained in:
parent
09a9537044
commit
8303249371
|
@ -97,7 +97,7 @@ namespace Bootstrap.DataAccess
|
|||
/// <returns></returns>
|
||||
public virtual IEnumerable<Group> RetrieveGroupsByUserId(string userId)
|
||||
{
|
||||
string sql = "select g.ID,g.GroupName,g.[Description],case ug.GroupID when g.ID then 'checked' else '' end [status] from Groups g left join UserGroup ug on g.ID=ug.GroupID and UserID=@UserID";
|
||||
string sql = "select g.ID,g.GroupName,g.Description,case ug.GroupID when g.ID then 'checked' else '' end status from Groups g left join UserGroup ug on g.ID=ug.GroupID and UserID=@UserID";
|
||||
List<Group> groups = new List<Group>();
|
||||
DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql);
|
||||
cmd.Parameters.Add(DbAccessManager.DBAccess.CreateParameter("@UserID", userId));
|
||||
|
@ -169,7 +169,7 @@ namespace Bootstrap.DataAccess
|
|||
public virtual IEnumerable<Group> RetrieveGroupsByRoleId(string roleId)
|
||||
{
|
||||
List<Group> groups = new List<Group>();
|
||||
string sql = "select g.ID,g.GroupName,g.[Description],case rg.GroupID when g.ID then 'checked' else '' end [status] from Groups g left join RoleGroup rg on g.ID=rg.GroupID and RoleID=@RoleID";
|
||||
string sql = "select g.ID,g.GroupName,g.Description,case rg.GroupID when g.ID then 'checked' else '' end status from Groups g left join RoleGroup rg on g.ID=rg.GroupID and RoleID=@RoleID";
|
||||
DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql);
|
||||
cmd.Parameters.Add(DbAccessManager.DBAccess.CreateParameter("@RoleID", roleId));
|
||||
using (DbDataReader reader = DbAccessManager.DBAccess.ExecuteReader(cmd))
|
||||
|
@ -239,7 +239,7 @@ namespace Bootstrap.DataAccess
|
|||
{
|
||||
var entities = new List<string>();
|
||||
var db = DbAccessManager.DBAccess;
|
||||
using (DbCommand cmd = db.CreateCommand(CommandType.Text, "select g.GroupName, g.[Description] from Groups g inner join UserGroup ug on g.ID = ug.GroupID inner join Users u on ug.UserID = u.ID where UserName = @UserName"))
|
||||
using (DbCommand cmd = db.CreateCommand(CommandType.Text, "select g.GroupName, g.Description from Groups g inner join UserGroup ug on g.ID = ug.GroupID inner join Users u on ug.UserID = u.ID where UserName = @UserName"))
|
||||
{
|
||||
cmd.Parameters.Add(db.CreateParameter("@UserName", userName));
|
||||
using (DbDataReader reader = db.ExecuteReader(cmd))
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace Bootstrap.DataAccess
|
|||
public virtual IEnumerable<Role> RetrieveRolesByUserId(string userId)
|
||||
{
|
||||
List<Role> roles = new List<Role>();
|
||||
string sql = "select r.ID, r.RoleName, r.[Description], case ur.RoleID when r.ID then 'checked' else '' end [status] from Roles r left join UserRole ur on r.ID = ur.RoleID and UserID = @UserID";
|
||||
string sql = "select r.ID, r.RoleName, r.Description, case ur.RoleID when r.ID then 'checked' else '' end status from Roles r left join UserRole ur on r.ID = ur.RoleID and UserID = @UserID";
|
||||
DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql);
|
||||
cmd.Parameters.Add(DbAccessManager.DBAccess.CreateParameter("@UserID", userId));
|
||||
using (DbDataReader reader = DbAccessManager.DBAccess.ExecuteReader(cmd))
|
||||
|
@ -177,7 +177,7 @@ namespace Bootstrap.DataAccess
|
|||
/// <returns></returns>
|
||||
public virtual IEnumerable<Role> RetrieveRolesByMenuId(string menuId)
|
||||
{
|
||||
string sql = "select r.ID, r.RoleName, r.[Description], case ur.RoleID when r.ID then 'checked' else '' end [status] from Roles r left join NavigationRole ur on r.ID = ur.RoleID and NavigationID = @NavigationID";
|
||||
string sql = "select r.ID, r.RoleName, r.Description, case ur.RoleID when r.ID then 'checked' else '' end status from Roles r left join NavigationRole ur on r.ID = ur.RoleID and NavigationID = @NavigationID";
|
||||
List<Role> roles = new List<Role>();
|
||||
DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql);
|
||||
cmd.Parameters.Add(DbAccessManager.DBAccess.CreateParameter("@NavigationID", menuId));
|
||||
|
@ -251,7 +251,7 @@ namespace Bootstrap.DataAccess
|
|||
public virtual IEnumerable<Role> RetrieveRolesByGroupId(string groupId)
|
||||
{
|
||||
List<Role> roles = new List<Role>();
|
||||
string sql = "select r.ID, r.RoleName, r.[Description], case ur.RoleID when r.ID then 'checked' else '' end [status] from Roles r left join RoleGroup ur on r.ID = ur.RoleID and GroupID = @GroupID";
|
||||
string sql = "select r.ID, r.RoleName, r.Description, case ur.RoleID when r.ID then 'checked' else '' end status from Roles r left join RoleGroup ur on r.ID = ur.RoleID and GroupID = @GroupID";
|
||||
DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql);
|
||||
cmd.Parameters.Add(DbAccessManager.DBAccess.CreateParameter("@GroupID", groupId));
|
||||
using (DbDataReader reader = DbAccessManager.DBAccess.ExecuteReader(cmd))
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace Bootstrap.DataAccess
|
|||
if (string.IsNullOrEmpty(userName) && string.IsNullOrEmpty(password)) return false;
|
||||
string oldPassword = null;
|
||||
string passwordSalt = null;
|
||||
string sql = "select [Password], PassSalt from Users where ApprovedTime is not null and UserName = @UserName";
|
||||
string sql = "select Password, PassSalt from Users where ApprovedTime is not null and UserName = @UserName";
|
||||
var db = DbAccessManager.DBAccess;
|
||||
using (DbCommand cmd = db.CreateCommand(CommandType.Text, sql))
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ namespace Bootstrap.DataAccess
|
|||
/// <returns></returns>
|
||||
public virtual IEnumerable<User> RetrieveNewUsers()
|
||||
{
|
||||
string sql = "select ID, UserName, DisplayName, RegisterTime, [Description] from Users Where ApprovedTime is null order by RegisterTime desc";
|
||||
string sql = "select ID, UserName, DisplayName, RegisterTime, Description from Users Where ApprovedTime is null order by RegisterTime desc";
|
||||
List<User> users = new List<User>();
|
||||
DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql);
|
||||
using (DbDataReader reader = DbAccessManager.DBAccess.ExecuteReader(cmd))
|
||||
|
@ -272,7 +272,7 @@ namespace Bootstrap.DataAccess
|
|||
public virtual IEnumerable<User> RetrieveUsersByRoleId(string roleId)
|
||||
{
|
||||
List<User> users = new List<User>();
|
||||
string sql = "select u.ID, u.UserName, u.DisplayName, case ur.UserID when u.ID then 'checked' else '' end [status] from Users u left join UserRole ur on u.ID = ur.UserID and RoleID = @RoleID where u.ApprovedTime is not null";
|
||||
string sql = "select u.ID, u.UserName, u.DisplayName, case ur.UserID when u.ID then 'checked' else '' end status from Users u left join UserRole ur on u.ID = ur.UserID and RoleID = @RoleID where u.ApprovedTime is not null";
|
||||
DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql);
|
||||
cmd.Parameters.Add(DbAccessManager.DBAccess.CreateParameter("@RoleID", roleId));
|
||||
using (DbDataReader reader = DbAccessManager.DBAccess.ExecuteReader(cmd))
|
||||
|
@ -340,7 +340,7 @@ namespace Bootstrap.DataAccess
|
|||
public virtual IEnumerable<User> RetrieveUsersByGroupId(string groupId)
|
||||
{
|
||||
List<User> users = new List<User>();
|
||||
string sql = "select u.ID, u.UserName, u.DisplayName, case ur.UserID when u.ID then 'checked' else '' end [status] from Users u left join UserGroup ur on u.ID = ur.UserID and GroupID =@groupId where u.ApprovedTime is not null";
|
||||
string sql = "select u.ID, u.UserName, u.DisplayName, case ur.UserID when u.ID then 'checked' else '' end status from Users u left join UserGroup ur on u.ID = ur.UserID and GroupID =@groupId where u.ApprovedTime is not null";
|
||||
DbCommand cmd = DbAccessManager.DBAccess.CreateCommand(CommandType.Text, sql);
|
||||
cmd.Parameters.Add(DbAccessManager.DBAccess.CreateParameter("@GroupID", groupId));
|
||||
using (DbDataReader reader = DbAccessManager.DBAccess.ExecuteReader(cmd))
|
||||
|
|
Loading…
Reference in New Issue