narsil/Tanshu.Accounts.BI/CustomerBI.cs

110 lines
3.7 KiB
C#
Raw Normal View History

2010-03-02 17:56:21 +00:00
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using Tanshu.Accounts.Contracts;
using System.Data.SqlClient;
using Tanshu.Accounts.DAOFactory;
using Tanshu.Data.DAO;
namespace Tanshu.Accounts.BI
{
public class CustomerBI : ICustomerBI
{
public List<LedgerBO> GetCustomerLedgers()
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
return dao.GetCustomerLedgers();
}
}
}
public CustomerBO GetCustomer(Guid customerID)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
return dao.GetCustomer(customerID);
}
}
}
public List<CustomerBO> GetFilteredCustomers(Dictionary<string, string> filter)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
return dao.GetFilteredCustomers(filter);
}
}
}
public List<CustomerBO> GetCustomers()
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
return dao.GetCustomers();
}
}
}
public List<CustomerBO> GetSingleCustomers(Guid customerID)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
return dao.GetCustomers(customerID);
}
}
}
public bool Update(CustomerBO customer)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
dao.Update(customer);
return true;
}
}
}
public bool Delete(Guid customerID)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
dao.Delete(customerID);
return true;
}
}
}
public bool Insert(CustomerBO customer)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
dao.Insert(customer);
return true;
}
}
}
}
}