narsil/Tanshu.Accounts.Repository/BusinessLayer/PrintLocationBI.cs

39 lines
1.4 KiB
C#
Raw Normal View History

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);
}
}
}