102 lines
2.6 KiB
C#
102 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Tanshu.Accounts.Contracts;
|
|
|
|
namespace Tanshu.Accounts.BI
|
|
{
|
|
public class UserBI
|
|
{
|
|
public UserBO GetUser(Guid userID)
|
|
{
|
|
|
|
using (var connection = new SqlDAO.SqlConnectionDAO())
|
|
{
|
|
using (var dao = new SqlDAO.UserDAO(connection))
|
|
{
|
|
return dao.GetUser(userID);
|
|
}
|
|
}
|
|
}
|
|
public bool ChangePassword(UserBO userData, string newPassword)
|
|
{
|
|
|
|
using (var connection = new SqlDAO.SqlConnectionDAO())
|
|
{
|
|
using (var dao = new SqlDAO.UserDAO(connection))
|
|
{
|
|
return dao.ChangePassword(userData, newPassword);
|
|
}
|
|
}
|
|
}
|
|
public List<UserBO> GetUsers()
|
|
{
|
|
|
|
using (var connection = new SqlDAO.SqlConnectionDAO())
|
|
{
|
|
using (var dao = new SqlDAO.UserDAO(connection))
|
|
{
|
|
return dao.GetUsers();
|
|
}
|
|
}
|
|
}
|
|
public List<UserBO> GetFilteredUsers(Dictionary<string, string> filter)
|
|
{
|
|
|
|
using (var connection = new SqlDAO.SqlConnectionDAO())
|
|
{
|
|
using (var dao = new SqlDAO.UserDAO(connection))
|
|
{
|
|
return dao.GetFilteredUsers(filter);
|
|
}
|
|
}
|
|
}
|
|
public bool UserExists(string userName)
|
|
{
|
|
|
|
using (var connection = new SqlDAO.SqlConnectionDAO())
|
|
{
|
|
using (var dao = new SqlDAO.UserDAO(connection))
|
|
{
|
|
return dao.UserExists(userName);
|
|
}
|
|
}
|
|
}
|
|
public bool Insert(UserBO user)
|
|
{
|
|
|
|
using (var connection = new SqlDAO.SqlConnectionDAO())
|
|
{
|
|
using (var dao = new SqlDAO.UserDAO(connection))
|
|
{
|
|
return dao.Insert(user);
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool Update(UserBO user)
|
|
{
|
|
|
|
using (var connection = new SqlDAO.SqlConnectionDAO())
|
|
{
|
|
using (var dao = new SqlDAO.UserDAO(connection))
|
|
{
|
|
return dao.Update(user);
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool Delete(Guid userID)
|
|
{
|
|
|
|
using (var connection = new SqlDAO.SqlConnectionDAO())
|
|
{
|
|
using (var dao = new SqlDAO.UserDAO(connection))
|
|
{
|
|
return dao.Delete(userID);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|