narsil/Tanshu.Accounts.BI/FoodTableBI.cs
2011-01-10 05:06:24 +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 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();
}
}
}
}
}