narsil/Tanshu.Accounts.BI/FoodTableBI.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
{
public class FoodTableBI : IFoodTableBI
{
public void Insert(FoodTableBO foodTable)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IFoodTableDAO dao = factory.GetFoodTableDAO(connection))
{
dao.Insert(foodTable);
}
}
}
public void Update(FoodTableBO foodTable)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IFoodTableDAO dao = factory.GetFoodTableDAO(connection))
{
dao.Update(foodTable);
}
}
}
public bool Delete(int tableID)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IFoodTableDAO dao = factory.GetFoodTableDAO(connection))
{
return dao.Delete(tableID);
}
}
}
public FoodTableBO GetFoodTable(int tableID)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IFoodTableDAO dao = factory.GetFoodTableDAO(connection))
{
return dao.GetFoodTable(tableID);
}
}
}
public List<FoodTableBO> GetFoodTables()
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IFoodTableDAO dao = factory.GetFoodTableDAO(connection))
{
return dao.GetFoodTables();
}
}
}
}
}