98 lines
3.6 KiB
C#
98 lines
3.6 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;
|
|
using System.Configuration;
|
|
|
|
namespace Tanshu.Accounts.BI
|
|
{
|
|
public class PrintLocationBI : IPrintLocationBI
|
|
{
|
|
public void Insert(PrintLocationBO printLocation)
|
|
{
|
|
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
using (IConnectionDAO connection = factory.Connection)
|
|
{
|
|
using (IPrintLocationDAO dao = factory.GetPrintLocationDAO(connection))
|
|
{
|
|
dao.Insert(printLocation);
|
|
}
|
|
}
|
|
}
|
|
public void Update(PrintLocationBO printLocation)
|
|
{
|
|
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
using (IConnectionDAO connection = factory.Connection)
|
|
{
|
|
using (IPrintLocationDAO dao = factory.GetPrintLocationDAO(connection))
|
|
{
|
|
dao.Update(printLocation);
|
|
}
|
|
}
|
|
}
|
|
public bool Delete(int tableID)
|
|
{
|
|
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
using (IConnectionDAO connection = factory.Connection)
|
|
{
|
|
using (IPrintLocationDAO dao = factory.GetPrintLocationDAO(connection))
|
|
{
|
|
return dao.Delete(tableID);
|
|
}
|
|
}
|
|
}
|
|
public PrintLocationBO GetPrintLocation(int printLocationID)
|
|
{
|
|
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
using (IConnectionDAO connection = factory.Connection)
|
|
{
|
|
using (IPrintLocationDAO dao = factory.GetPrintLocationDAO(connection))
|
|
{
|
|
return dao.GetPrintLocation(printLocationID);
|
|
}
|
|
}
|
|
}
|
|
public PrintLocationBO GetPrintLocation(Guid productTypeID, string location)
|
|
{
|
|
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
using (IConnectionDAO connection = factory.Connection)
|
|
{
|
|
using (IPrintLocationDAO dao = factory.GetPrintLocationDAO(connection))
|
|
{
|
|
return dao.GetPrintLocation(productTypeID, location);
|
|
}
|
|
}
|
|
}
|
|
public PrintLocationBO GetPrintLocation(string location)
|
|
{
|
|
GetFactory factory = GetFactory.GetDAOFactory(Database.GetFactoryType);
|
|
using (IConnectionDAO connection = factory.Connection)
|
|
{
|
|
using (IPrintLocationDAO dao = factory.GetPrintLocationDAO(connection))
|
|
{
|
|
return dao.GetPrintLocation(null, location);
|
|
}
|
|
}
|
|
}
|
|
public static PrintLocationBO BasePrinter
|
|
{
|
|
get
|
|
{
|
|
string location = ConfigurationManager.AppSettings["Location"].ToLowerInvariant();
|
|
return new PrintLocationBI().GetPrintLocation(location);
|
|
}
|
|
}
|
|
public static PrintLocationBO KotPrinter(Guid productTypeID)
|
|
{
|
|
string location = ConfigurationManager.AppSettings["Location"].ToLowerInvariant();
|
|
PrintLocationBO p = new PrintLocationBI().GetPrintLocation(productTypeID, location);
|
|
if (p == null)
|
|
p = new PrintLocationBI().GetPrintLocation(location);
|
|
return p;
|
|
}
|
|
}
|
|
}
|