2011-06-29 20:27:07 +00:00
|
|
|
|
using NHibernate;
|
2011-03-11 18:49:48 +00:00
|
|
|
|
using Tanshu.Accounts.Entities;
|
2011-04-11 12:55:45 +00:00
|
|
|
|
using System.Linq;
|
2014-10-12 09:41:45 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2014-10-16 11:11:55 +00:00
|
|
|
|
using System.Linq.Expressions;
|
2011-01-30 07:14:05 +00:00
|
|
|
|
|
|
|
|
|
namespace Tanshu.Accounts.Repository
|
|
|
|
|
{
|
2014-10-12 09:41:45 +00:00
|
|
|
|
public class FoodTableBI : UnitOfWork<FoodTable>
|
2011-01-30 07:14:05 +00:00
|
|
|
|
{
|
2014-10-12 09:41:45 +00:00
|
|
|
|
public new IList<FoodTable> List()
|
2011-02-18 16:54:48 +00:00
|
|
|
|
{
|
2014-10-12 09:41:45 +00:00
|
|
|
|
return _session.QueryOver<FoodTable>()
|
|
|
|
|
.OrderBy(x => x.SortOrder).Asc
|
|
|
|
|
.List();
|
2011-02-18 16:54:48 +00:00
|
|
|
|
}
|
2014-10-16 11:11:55 +00:00
|
|
|
|
public new IList<FoodTable> List(Expression<Func<FoodTable, bool>> query)
|
|
|
|
|
{
|
|
|
|
|
return _session.QueryOver<FoodTable>()
|
|
|
|
|
.Where(query)
|
|
|
|
|
.OrderBy(x => x.SortOrder).Asc
|
|
|
|
|
.List();
|
|
|
|
|
}
|
|
|
|
|
public void UpdateSortOrder(IList<FoodTable> list)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < list.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var item = list[i];
|
|
|
|
|
var foodTable = _session.Get<FoodTable>(item.FoodTableID);
|
|
|
|
|
foodTable.SortOrder = i;
|
|
|
|
|
_session.Update(foodTable);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-01-30 07:14:05 +00:00
|
|
|
|
}
|
2011-03-11 18:49:48 +00:00
|
|
|
|
}
|