59909a5ee7
Must use the Repositories with Using or else bad things will happen.
39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using System.Configuration;
|
|
using NHibernate;
|
|
using Tanshu.Accounts.Entities;
|
|
|
|
namespace Tanshu.Accounts.Repository
|
|
{
|
|
public class PrintLocationBI : FluentGenericBase<PrintLocation>
|
|
{
|
|
public PrintLocationBI()
|
|
: base()
|
|
{ }
|
|
public PrintLocationBI(bool beginTransaction)
|
|
: base(beginTransaction)
|
|
{ }
|
|
public PrintLocationBI(ISession session)
|
|
: base(session)
|
|
{ }
|
|
public PrintLocationBI(ISession session, bool beginTransaction)
|
|
: base(session, beginTransaction)
|
|
{ }
|
|
public static PrintLocation BasePrinter
|
|
{
|
|
get
|
|
{
|
|
var location = ConfigurationManager.AppSettings["Location"].ToLowerInvariant();
|
|
using (var bi = new PrintLocationBI(false))
|
|
return bi.Get(x => x.Location == location && x.ProductGroup == null);
|
|
}
|
|
}
|
|
public static PrintLocation KotPrinter(int productGroupID)
|
|
{
|
|
var location = ConfigurationManager.AppSettings["Location"].ToLowerInvariant();
|
|
using (var bi = new PrintLocationBI(false))
|
|
return bi.Get(x => x.Location == location && x.ProductGroup.ProductGroupID == productGroupID) ??
|
|
bi.Get(x => x.Location == location && x.ProductGroup == null);
|
|
}
|
|
}
|
|
}
|