narsil/Tanshu.Accounts.BI/CustomerBI.cs

110 lines
3.5 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()
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
return dao.GetCustomerLedgers();
}
}
}
public CustomerBO GetCustomer(Guid customerID)
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
return dao.GetCustomer(customerID);
}
}
}
public List<CustomerBO> GetFilteredCustomers(Dictionary<string, string> filter)
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
return dao.GetFilteredCustomers(filter);
}
}
}
public List<CustomerBO> GetCustomers()
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
return dao.GetCustomers();
}
}
}
public List<CustomerBO> GetSingleCustomers(Guid customerID)
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
return dao.GetCustomers(customerID);
}
}
}
public bool Update(CustomerBO customer)
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
dao.Update(customer);
return true;
}
}
}
public bool Delete(Guid customerID)
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
dao.Delete(customerID);
return true;
}
}
}
public bool Insert(CustomerBO customer)
{
2011-12-05 09:23:02 +00:00
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
2010-03-02 17:56:21 +00:00
{
using (ICustomerDAO dao = factory.GetCustomerDAO(connection))
{
dao.Insert(customer);
return true;
}
}
}
}
}