narsil/Tanshu.Accounts.BI/WaiterBI.cs
2010-03-02 23:26:21 +05:30

100 lines
3.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using Tanshu.Accounts.Contracts;
using System.Data.SqlClient;
using Tanshu.Accounts.DAOFactory;
using Tanshu.Data.DAO;
namespace Tanshu.Accounts.BI
{
public class WaiterBI : IWaiterBI
{
public bool Insert(WaiterBO waiter)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.Insert(waiter);
}
}
}
public bool Update(WaiterBO waiter)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.Update(waiter);
}
}
}
public bool Delete(Guid waiterID)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.Delete(waiterID);
}
}
}
public WaiterBO GetWaiter(Guid waiterID)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.GetWaiter(waiterID);
}
}
}
public WaiterBO GetWaiter(int code)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.GetWaiter(code);
}
}
}
public List<WaiterBO> GetWaiters()
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.GetWaiters();
}
}
}
public List<WaiterBO> GetFilteredWaiters(Dictionary<string, string> filter)
{
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (IConnectionDAO connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.GetFilteredWaiters(filter);
}
}
}
}
}