narsil/Tanshu.Accounts.Repository/BusinessLayer/ProductGroupBI.cs
unknown d8ecec8bb6 Added inverse Attribute to ProductGroup.
BillInventory Renamed.
Refactored Bill to be more usable.
Added Bill Detail Report.
Added Open Bill and Bill Details Roles.
Zero Rate Products have Yellow background Color.
Refactored UserBI, FoodTableBI, ModifierBI, PrintLocationBI, ProductBI, ProductGroupBI, TaxBI, UserBI,
Cached the Products List.
Product and Product Group Form Working.
2011-06-23 18:17:48 +05:30

50 lines
1.5 KiB
C#

using System.Collections.Generic;
using Tanshu.Accounts.Entities;
using NHibernate;
namespace Tanshu.Accounts.Repository
{
public class ProductGroupBI : FluentBase<ProductGroup>
{
public ProductGroupBI()
: base()
{ }
public ProductGroupBI(bool beginTransaction)
: base(beginTransaction)
{ }
public ProductGroupBI(ISession session)
: base(session)
{ }
public ProductGroupBI(ISession session, bool beginTransaction)
: base(session, beginTransaction)
{ }
public new IList<ProductGroup> List()
{
return Session.QueryOver<ProductGroup>()
.OrderBy(x => x.Name).Asc
.List();
}
public IList<string> GetProductGroupTypes()
{
const string query = @"select distinct(pg.GroupType) from ProductGroup pg order by pg.GroupType";
var hnq = Session.CreateQuery(query);
return hnq.List<string>();
}
public ProductGroup GetProductGroupOfProduct(int productID)
{
using (var session = SessionManager.Session)
{
var item = (from p in session.QueryOver<Product>()
where p.ProductID == productID
select p.ProductGroup).SingleOrDefault<ProductGroup>();
NHibernateUtil.Initialize(item);
return item;
}
}
}
}