narsil/Tanshu.Accounts.BI/WaiterBI.cs
2011-12-05 14:53:02 +05:30

100 lines
2.9 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)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.Insert(waiter);
}
}
}
public bool Update(WaiterBO waiter)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.Update(waiter);
}
}
}
public bool Delete(Guid waiterID)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.Delete(waiterID);
}
}
}
public WaiterBO GetWaiter(Guid waiterID)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.GetWaiter(waiterID);
}
}
}
public WaiterBO GetWaiter(int code)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.GetWaiter(code);
}
}
}
public List<WaiterBO> GetWaiters()
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.GetWaiters();
}
}
}
public List<WaiterBO> GetFilteredWaiters(Dictionary<string, string> filter)
{
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
using (var connection = factory.Connection)
{
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
{
return dao.GetFilteredWaiters(filter);
}
}
}
}
}