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 GetProductGroups() { GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType); using (IConnectionDAO connection = factory.Connection) { using (var dao = factory.GetProductGroupDAO(connection)) { return dao.GetProductGroups(); } } } } }