narsil/Tanshu.Accounts.BI/ProductGroupBI.cs
2011-01-22 18:08:30 +05:30

70 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using Tanshu.Accounts.Contracts;
using Tanshu.Accounts.DAOFactory;
using System.Data.SqlClient;
using Tanshu.Data.DAO;
namespace Tanshu.Accounts.BI
{
public class ProductGroupBI : IProductGroupBI
{
public ProductGroupBO GetProductGroup(Guid productGroupID)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (var dao = factory.GetProductGroupDAO(connection))
{
return dao.GetProductGroup(productGroupID);
}
}
}
public ProductGroupBO GetProductGroupByName(string name)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (var dao = factory.GetProductGroupDAO(connection))
{
return dao.GetProductGroup(name);
}
}
}
public bool Insert(ProductGroupBO productGroup)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (var dao = factory.GetProductGroupDAO(connection))
{
return dao.Insert(productGroup);
}
}
}
public bool Update(ProductGroupBO productGroup)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (var dao = factory.GetProductGroupDAO(connection))
{
return dao.Update(productGroup);
}
}
}
public List<ProductGroupBO> GetProductGroups()
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (var dao = factory.GetProductGroupDAO(connection))
{
return dao.GetProductGroups();
}
}
}
}
}