narsil/Tanshu.Accounts.BI/UserBI.cs

102 lines
2.6 KiB
C#
Raw Normal View History

2010-03-02 17:56:21 +00:00
using System;
using System.Collections.Generic;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.BI
{
public class UserBI
2010-03-02 17:56:21 +00:00
{
public UserBO GetUser(Guid userID)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
2010-03-02 17:56:21 +00:00
{
using (var dao = new SqlDAO.UserDAO(connection))
2010-03-02 17:56:21 +00:00
{
return dao.GetUser(userID);
}
}
}
public bool ChangePassword(UserBO userData, string newPassword)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
2010-03-02 17:56:21 +00:00
{
using (var dao = new SqlDAO.UserDAO(connection))
2010-03-02 17:56:21 +00:00
{
return dao.ChangePassword(userData, newPassword);
}
}
}
public List<UserBO> GetUsers()
{
using (var connection = new SqlDAO.SqlConnectionDAO())
2010-03-02 17:56:21 +00:00
{
using (var dao = new SqlDAO.UserDAO(connection))
2010-03-02 17:56:21 +00:00
{
return dao.GetUsers();
}
}
}
public List<UserBO> GetFilteredUsers(Dictionary<string, string> filter)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
2010-03-02 17:56:21 +00:00
{
using (var dao = new SqlDAO.UserDAO(connection))
2010-03-02 17:56:21 +00:00
{
return dao.GetFilteredUsers(filter);
}
}
}
public bool UserExists(string userName)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
2010-03-02 17:56:21 +00:00
{
using (var dao = new SqlDAO.UserDAO(connection))
2010-03-02 17:56:21 +00:00
{
return dao.UserExists(userName);
}
}
}
public bool Insert(UserBO user)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
2010-03-02 17:56:21 +00:00
{
using (var dao = new SqlDAO.UserDAO(connection))
2010-03-02 17:56:21 +00:00
{
return dao.Insert(user);
}
}
}
public bool Update(UserBO user)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
2010-03-02 17:56:21 +00:00
{
using (var dao = new SqlDAO.UserDAO(connection))
2010-03-02 17:56:21 +00:00
{
return dao.Update(user);
}
}
}
public bool Delete(Guid userID)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
2010-03-02 17:56:21 +00:00
{
using (var dao = new SqlDAO.UserDAO(connection))
2010-03-02 17:56:21 +00:00
{
return dao.Delete(userID);
}
}
}
}
}