using Bootstrap.Security;
using Longbow.Data;
using System.Collections.Generic;
namespace Bootstrap.DataAccess
{
///
/// 用户表相关操作类
///
public static class UserHelper
{
///
/// 查询所有用户
///
///
///
public static IEnumerable RetrieveUsers() => DbAdapterManager.Create().RetrieveUsers();
///
///
///
///
///
///
public static bool Authenticate(string userName, string password) => DbAdapterManager.Create().Authenticate(userName, password);
///
/// 查询所有的新注册用户
///
///
public static IEnumerable RetrieveNewUsers() => DbAdapterManager.Create().RetrieveNewUsers();
///
/// 删除用户
///
///
public static bool DeleteUser(IEnumerable value) => DbAdapterManager.Create().DeleteUser(value);
///
/// 保存新建
///
///
///
public static bool SaveUser(User p) => DbAdapterManager.Create().SaveUser(p);
///
///
///
///
///
///
///
public static bool UpdateUser(int id, string password, string displayName) => DbAdapterManager.Create().UpdateUser(id, password, displayName);
///
///
///
///
///
///
public static bool ApproveUser(int id, string approvedBy) => DbAdapterManager.Create().ApproveUser(id, approvedBy);
///
///
///
///
///
///
///
public static bool ChangePassword(string userName, string password, string newPass) => DbAdapterManager.Create().ChangePassword(userName, password, newPass);
///
///
///
///
///
///
///
public static bool RejectUser(int id, string rejectBy) => DbAdapterManager.Create().RejectUser(id, rejectBy);
///
/// 通过roleId获取所有用户
///
///
///
public static IEnumerable RetrieveUsersByRoleId(int roleId) => DbAdapterManager.Create().RetrieveUsersByRoleId(roleId);
///
/// 通过角色ID保存当前授权用户(插入)
///
/// 角色ID
/// 用户ID数组
///
public static bool SaveUsersByRoleId(int id, IEnumerable userIds) => DbAdapterManager.Create().SaveUsersByRoleId(id, userIds);
///
/// 通过groupId获取所有用户
///
///
///
public static IEnumerable RetrieveUsersByGroupId(int groupId) => DbAdapterManager.Create().RetrieveUsersByGroupId(groupId);
///
/// 通过部门ID保存当前授权用户(插入)
///
/// GroupID
/// 用户ID数组
///
public static bool SaveUsersByGroupId(int id, IEnumerable userIds) => DbAdapterManager.Create().SaveUsersByGroupId(id, userIds);
/// 根据用户名修改用户头像
///
///
///
///
public static bool SaveUserIconByName(string userName, string iconName) => DbAdapterManager.Create().SaveUserIconByName(userName, iconName);
///
///
///
///
///
///
public static bool SaveDisplayName(string userName, string displayName) => DbAdapterManager.Create().SaveDisplayName(userName, displayName);
///
/// 根据用户名更改用户皮肤
///
///
///
///
public static bool SaveUserCssByName(string userName, string cssName) => DbAdapterManager.Create().SaveUserCssByName(userName, cssName);
///
///
///
///
///
public static BootstrapUser RetrieveUserByUserName(string name) => DbAdapterManager.Create().RetrieveUserByUserName(name);
}
}