d8ecec8bb6
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.
78 lines
2.2 KiB
C#
78 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq.Expressions;
|
|
using Tanshu.Accounts.Contracts;
|
|
using Tanshu.Accounts.Entities;
|
|
using NHibernate;
|
|
|
|
namespace Tanshu.Accounts.Repository
|
|
{
|
|
public class ProductBI : FluentBase<Product>
|
|
{
|
|
public ProductBI()
|
|
: base()
|
|
{ }
|
|
|
|
public ProductBI(bool beginTransaction)
|
|
: base(beginTransaction)
|
|
{ }
|
|
|
|
public ProductBI(ISession session)
|
|
: base(session)
|
|
{ }
|
|
|
|
public ProductBI(ISession session, bool beginTransaction)
|
|
: base(session, beginTransaction)
|
|
{ }
|
|
|
|
|
|
public Product Get(string nameAndUnits)
|
|
{
|
|
return Get(x => x.Name + " (" + x.Units + ")" == nameAndUnits);
|
|
}
|
|
public new IList<Product> List(Expression<Func<Product, bool>> query)
|
|
{
|
|
var list = base.List(query);
|
|
foreach (var item in list)
|
|
{
|
|
NHibernateUtil.Initialize(item.ProductGroup);
|
|
NHibernateUtil.Initialize(item.Tax);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
public new IList<Product> List()
|
|
{
|
|
var list = base.List();
|
|
foreach (var item in list)
|
|
{
|
|
NHibernateUtil.Initialize(item.ProductGroup);
|
|
NHibernateUtil.Initialize(item.Tax);
|
|
}
|
|
return list;
|
|
}
|
|
|
|
public static List<ProductDisplaySmall> GetFilteredProducts(Dictionary<string, string> filter)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public static List<ProductDisplaySmall> GetUnFilteredProducts()
|
|
{
|
|
Dictionary<string, string> filter = new Dictionary<string, string>();
|
|
filter.Add("Name", "");
|
|
filter.Add("Type", "");
|
|
return GetFilteredProducts(filter);
|
|
}
|
|
public static IList<Product> List(int productGroupID)
|
|
{
|
|
using (var session = SessionManager.Session)
|
|
{
|
|
return (from product in session.QueryOver<Product>()
|
|
where product.ProductGroup.ProductGroupID == productGroupID
|
|
select product).List();
|
|
}
|
|
}
|
|
}
|
|
}
|