2010-03-02 17:56:21 +00:00
|
|
|
|
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)
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return dao.Insert(waiter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public bool Update(WaiterBO waiter)
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return dao.Update(waiter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public bool Delete(Guid waiterID)
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return dao.Delete(waiterID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public WaiterBO GetWaiter(Guid waiterID)
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return dao.GetWaiter(waiterID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public WaiterBO GetWaiter(int code)
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return dao.GetWaiter(code);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public List<WaiterBO> GetWaiters()
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return dao.GetWaiters();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public List<WaiterBO> GetFilteredWaiters(Dictionary<string, string> filter)
|
|
|
|
|
{
|
2011-12-05 09:23:02 +00:00
|
|
|
|
var factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
|
|
|
using (var connection = factory.Connection)
|
2010-03-02 17:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
using (IWaiterDAO dao = factory.GetWaiterDAO(connection))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return dao.GetFilteredWaiters(filter);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|