narsil/Tanshu.Accounts.BI/CustomerBI.cs

92 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using Tanshu.Accounts.Contracts;
namespace Tanshu.Accounts.BI
{
public class CustomerBI
{
public CustomerBO GetCustomer(Guid customerID)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.CustomerDAO(connection))
{
return dao.GetCustomer(customerID);
}
}
}
public List<CustomerBO> GetFilteredCustomers(Dictionary<string, string> filter)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.CustomerDAO(connection))
{
return dao.GetFilteredCustomers(filter);
}
}
}
public List<CustomerBO> GetCustomers()
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.CustomerDAO(connection))
{
return dao.GetCustomers();
}
}
}
public List<CustomerBO> GetSingleCustomers(Guid customerID)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.CustomerDAO(connection))
{
return dao.GetCustomers(customerID);
}
}
}
public bool Update(CustomerBO customer)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.CustomerDAO(connection))
{
dao.Update(customer);
return true;
}
}
}
public bool Delete(Guid customerID)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.CustomerDAO(connection))
{
dao.Delete(customerID);
return true;
}
}
}
public bool Insert(CustomerBO customer)
{
using (var connection = new SqlDAO.SqlConnectionDAO())
{
using (var dao = new SqlDAO.CustomerDAO(connection))
{
dao.Insert(customer);
return true;
}
}
}
}
}