#region
using System;
using System.Collections.Generic;
using System.Data;
using CSFrameworkV5.Core;
using CSFrameworkV5.Interfaces;
using CSFrameworkV5.Models;
///*************************************************************************/
///*
///* 文件名 :bllUser.cs
///
///* 程序说明 : 用户管理的业务逻辑层
///
///* 原创作者 :www.csframework.com
///* Copyright 2006-2021 wwww.csframework.com, 保留所有权利.
///*
///**************************************************************************/
#endregion
namespace CSFrameworkV5.Business.BLL_Permission
{
///
/// 用户管理的业务逻辑层
///
public class bllUser : bllBaseDataDict
{
private IBridge_User _Current;
public bllUser()
{
_KeyFieldName = tb_MyUser.__KeyName; //主键字段
_SummaryTableName = tb_MyUser.__TableName; //表名
_DataDictBridge =
BridgeFactory.CreateDataDictBridge(typeof(tb_MyUser));
_Current = BridgeFactory.CreateUserBridge();
}
public override bool CheckNoExists(string account)
{
return _Current.ExistsUser(account);
}
public bool CopyPermission(string sourceUser, string targetUser)
{
return _Current.CopyPermission(sourceUser, targetUser);
}
public override bool Delete(string account)
{
return _Current.DeleteUser(account);
}
public bool DeleteUserGroup(string account, string groupCode)
{
return _Current.DeleteUserGroup(account, groupCode);
}
public bool DeleteUserRole(string account, string roleID)
{
return _Current.DeleteUserRole(account, roleID);
}
public bool DestroyRights(string account)
{
return _Current.DestroyRights(account);
}
///
/// 获取指定用户数据
///
/// 用户帐号
///
public DataTable GetUser(string account)
{
return _Current.GetUser(account);
}
public DataTable GetUserGroups(string user)
{
return _Current.GetUserGroups(user);
}
public DataSet GetUserReportData(DateTime createDateFrom,
DateTime createDateTo)
{
return _Current.GetUserReportData(createDateFrom, createDateTo);
}
public DataTable GetUserRoles(string currentUser)
{
return _Current.GetUserRoles(currentUser);
}
public DataTable GetUserRoles4Picker(string currentUser, string content)
{
return _Current.GetUserRoles4Picker(currentUser, content);
}
public DataTable GetUserRolesAll(string user)
{
return _Current.GetUserRolesAll(user);
}
///
/// 获取所有用户数据
///
///
public DataTable GetUsers()
{
_SummaryTable = _Current.GetUsers();
SetDefault(_SummaryTable);
return _SummaryTable;
}
///
/// 修改用户密码
///
/// 用户帐号
/// 新密码
///
public bool ModifyPassword(string account, string OldPwd, string NewPwd)
{
return _Current.ModifyPassword(account, OldPwd, NewPwd);
}
public bool insrer(string account, string OldPwd, string NewPwd)
{
return _Current.insrer(account, OldPwd, NewPwd);
}
public DataTable Search(string content)
{
return _Current.Search(content);
}
public List SearchEx(string content, string ignoreGroup)
{
return _Current.SearchEx(content, ignoreGroup);
}
protected override void SetDefault(DataTable data)
{
data.Columns[tb_MyUser.IsLocked].DefaultValue = 0;
}
public bool SetLockState(string account, bool isLock)
{
return _Current.SetLockState(account, isLock);
}
public bool TryLogin(string user, string encodedPwd)
{
return _Current.TryLogin(user, encodedPwd);
}
public static void Validate(LoginUser user)
{
var wcf = BridgeFactory.CreateUserBridge();
if (wcf.ExistsUser(user.Account)) throw new Exception("用户已经存在!");
}
public static void ValidateLogin(string userID, string password)
{
if (userID.Trim() == "") throw new Exception("用户编号不正确或不能为空!");
if (password.Trim() == "") throw new Exception("密码不正确或不能为空!");
}
}
}