narsil/Tanshu.Accounts.BI/ProductGroupBI.cs

70 lines
2.3 KiB
C#
Raw Normal View History

2011-01-09 23:36:24 +00:00
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
{
2011-01-22 12:38:30 +00:00
public class ProductGroupBI : IProductGroupBI
2011-01-09 23:36:24 +00:00
{
2011-01-22 12:38:30 +00:00
public ProductGroupBO GetProductGroup(Guid productGroupID)
2011-01-09 23:36:24 +00:00
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
2011-01-22 12:38:30 +00:00
using (var dao = factory.GetProductGroupDAO(connection))
2011-01-09 23:36:24 +00:00
{
2011-01-22 12:38:30 +00:00
return dao.GetProductGroup(productGroupID);
2011-01-09 23:36:24 +00:00
}
}
}
2011-01-22 12:38:30 +00:00
public ProductGroupBO GetProductGroupByName(string name)
2011-01-09 23:36:24 +00:00
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
2011-01-22 12:38:30 +00:00
using (var dao = factory.GetProductGroupDAO(connection))
2011-01-09 23:36:24 +00:00
{
2011-01-22 12:38:30 +00:00
return dao.GetProductGroup(name);
2011-01-09 23:36:24 +00:00
}
}
}
2011-01-22 12:38:30 +00:00
public bool Insert(ProductGroupBO productGroup)
2011-01-09 23:36:24 +00:00
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
2011-01-22 12:38:30 +00:00
using (var dao = factory.GetProductGroupDAO(connection))
2011-01-09 23:36:24 +00:00
{
2011-01-22 12:38:30 +00:00
return dao.Insert(productGroup);
2011-01-09 23:36:24 +00:00
}
}
}
2011-01-22 12:38:30 +00:00
public bool Update(ProductGroupBO productGroup)
2011-01-09 23:36:24 +00:00
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
2011-01-22 12:38:30 +00:00
using (var dao = factory.GetProductGroupDAO(connection))
2011-01-09 23:36:24 +00:00
{
2011-01-22 12:38:30 +00:00
return dao.Update(productGroup);
2011-01-09 23:36:24 +00:00
}
}
}
2011-01-22 12:38:30 +00:00
public List<ProductGroupBO> GetProductGroups()
2011-01-09 23:36:24 +00:00
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
2011-01-22 12:38:30 +00:00
using (var dao = factory.GetProductGroupDAO(connection))
2011-01-09 23:36:24 +00:00
{
2011-01-22 12:38:30 +00:00
return dao.GetProductGroups();
2011-01-09 23:36:24 +00:00
}
}
}
}
}