Breaking Change: Changed Kot/Voucher Table Name to Guid Foreign key
Breaking Change: Renamed Discontinued to IsActive and added NA field to products. Cleanup: Removed not used attributes Change: RoleConstants changed to simple string Feature: Table Create/Edit/Reorder and Modifier Create/Edit Form Feature: Bills now show the Tax name from the database and not a hack
This commit is contained in:
@ -3,6 +3,7 @@ using Tanshu.Accounts.Entities;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
@ -14,7 +15,22 @@ namespace Tanshu.Accounts.Repository
|
||||
.OrderBy(x => x.SortOrder).Asc
|
||||
.List();
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
47
Tanshu.Accounts.Repository/BusinessLayer/GroupBI.cs
Normal file
47
Tanshu.Accounts.Repository/BusinessLayer/GroupBI.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public class GroupBI : UnitOfWork<Group>
|
||||
{
|
||||
public new IList<Group> List()
|
||||
{
|
||||
return _session.QueryOver<Group>()
|
||||
.OrderBy(x => x.Name).Asc
|
||||
.List();
|
||||
|
||||
}
|
||||
public IList<Role> RoleList()
|
||||
{
|
||||
return _session.QueryOver<Role>()
|
||||
.OrderBy(x => x.Name).Asc
|
||||
.List();
|
||||
}
|
||||
public void Update(Group group, IEnumerable<Role> selectedRoles)
|
||||
{
|
||||
var roles = new Dictionary<Role, bool>();
|
||||
foreach (var item in RoleList())
|
||||
{
|
||||
roles.Add(item, selectedRoles.Any(x => x.RoleID == item.RoleID));
|
||||
}
|
||||
foreach (var item in roles)
|
||||
{
|
||||
var id = item.Key.RoleID;
|
||||
var ug = group.RoleGroups.SingleOrDefault(x => x.Role.RoleID == id);
|
||||
if (item.Value && ug == null)
|
||||
{
|
||||
var rg = new RoleGroup() { Group = group, Role = item.Key };
|
||||
_session.Save(rg);
|
||||
}
|
||||
else if (!item.Value && ug != null)
|
||||
{
|
||||
group.RoleGroups.Remove(ug);
|
||||
_session.Delete(ug);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,156 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
using NHibernate;
|
||||
using System;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public class MembershipBI : UnitOfWork<User>
|
||||
{
|
||||
public static bool IsUserInRole(Guid userID, string roleName)
|
||||
{
|
||||
string query = @"
|
||||
SELECT COUNT(*) AS Role_Count FROM
|
||||
Auth_UserGroups ug INNER JOIN Auth_RoleGroups rg ON ug.GroupID = rg.GroupID
|
||||
INNER JOIN Auth_Roles r ON rg.RoleID = r.RoleID
|
||||
WHERE ug.UserID = :UserID AND r.Name = :Role;";
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
return session
|
||||
.CreateSQLQuery(query)
|
||||
.AddScalar("Role_Count", NHibernateUtil.Int32)
|
||||
.SetGuid("UserID", userID)
|
||||
.SetString("Role", roleName)
|
||||
.UniqueResult<int>() > 0;
|
||||
}
|
||||
}
|
||||
#region UserGroup
|
||||
public static IList<Group> GetGroups()
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
return session.CreateCriteria<Group>()
|
||||
.List<Group>();
|
||||
}
|
||||
}
|
||||
public static IList<Group> GetGroupsOfUser(Guid userID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
string query = "select ug.Group from UserGroup ug where ug.User.UserID = :userID";
|
||||
var list = session.CreateQuery(query)
|
||||
.SetParameter("userID", userID)
|
||||
.List<Group>();
|
||||
foreach (var item in list)
|
||||
NHibernateUtil.Initialize(item);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
public static IList<Group> GetGroupsNotOfUser(Guid userID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
string query = "select g from Group g where g not in (select ug.Group from UserGroup ug where ug.User.UserID = :userID)";
|
||||
var list = session.CreateQuery(query)
|
||||
.SetParameter("userID", userID)
|
||||
.List<Group>();
|
||||
foreach (var item in list)
|
||||
NHibernateUtil.Initialize(item);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
public static void AddUserToGroup(Guid userID, Guid groupID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
var userGroup = session.CreateQuery("select count(*) from UserGroup ug where ug.User.UserID = :userID and ug.Group.GroupID = :groupID")
|
||||
.SetParameter("userID", userID)
|
||||
.SetParameter("groupID", groupID)
|
||||
.UniqueResult<long>();
|
||||
if (userGroup == 0)
|
||||
{
|
||||
var user = session.Get<User>(userID);
|
||||
var group = session.Get<Group>(groupID);
|
||||
session.Save(new UserGroup() { User = user, Group = group });
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void RemoveUserFromGroup(Guid userID, Guid groupID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
string query = "delete UserGroup ug where ug.User.UserID = :userID and ug.Group.GroupID = :groupID";
|
||||
session.CreateQuery(query)
|
||||
.SetParameter("userID", userID)
|
||||
.SetParameter("groupID", groupID)
|
||||
.ExecuteUpdate();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region RoleGroup
|
||||
public static IList<Role> GetRoles()
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
return session.CreateCriteria<Role>()
|
||||
.List<Role>();
|
||||
}
|
||||
}
|
||||
public static IList<Role> GetRolesOfGroup(int groupID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
string query = "select rg.Role from RoleGroup rg where rg.Group.GroupID = :groupID";
|
||||
var list = session.CreateQuery(query)
|
||||
.SetParameter("groupID", groupID)
|
||||
.List<Role>();
|
||||
foreach (var item in list)
|
||||
NHibernateUtil.Initialize(item);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
public static IList<Role> GetRolesNotOfGroup(int groupID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
string query = "select r from Role r where r not in (select rg.Role from RoleGroup rg where rg.Group.GroupID = :groupID)";
|
||||
var list = session.CreateQuery(query)
|
||||
.SetParameter("groupID", groupID)
|
||||
.List<Role>();
|
||||
foreach (var item in list)
|
||||
NHibernateUtil.Initialize(item);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
public static void AddRoleToGroup(Guid roleID, Guid groupID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
var roleGroup = session.CreateQuery("select count(*) from RoleGroup rg where rg.Role.RoleID = :roleID and rg.Group.GroupID = :groupID")
|
||||
.SetParameter("roleID", roleID)
|
||||
.SetParameter("groupID", groupID)
|
||||
.UniqueResult<long>();
|
||||
if (roleGroup == 0)
|
||||
{
|
||||
var role = session.Get<Role>(roleID);
|
||||
var group = session.Get<Group>(groupID);
|
||||
session.Save(new RoleGroup() { Role = role, Group = group });
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void RemoveRoleFromGroup(Guid roleID, Guid groupID)
|
||||
{
|
||||
using (var session = SessionManager.Session)
|
||||
{
|
||||
string query = "delete RoleGroup rg where rg.Role.RoleID = :roleID and rg.Group.GroupID = :groupID";
|
||||
session.CreateQuery(query)
|
||||
.SetParameter("roleID", roleID)
|
||||
.SetParameter("groupID", groupID)
|
||||
.ExecuteUpdate();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,80 @@
|
||||
using NHibernate;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Tanshu.Accounts.Entities;
|
||||
|
||||
namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public class ModifierBI : UnitOfWork<Modifier>
|
||||
{
|
||||
public IList<ProductGroup> ProductGroupList()
|
||||
{
|
||||
return _session.QueryOver<ProductGroup>()
|
||||
.OrderBy(x => x.SortOrder).Asc
|
||||
.List();
|
||||
}
|
||||
public void Insert(Modifier modifier, bool showForAll, IEnumerable<ProductGroup> selectedGroups)
|
||||
{
|
||||
if (showForAll)
|
||||
selectedGroups = null;
|
||||
SetGroups(modifier, selectedGroups);
|
||||
_session.Save(modifier);
|
||||
}
|
||||
|
||||
public void Update(Modifier modifier, bool showForAll, IEnumerable<ProductGroup> selectedGroups)
|
||||
{
|
||||
if (showForAll)
|
||||
selectedGroups = null;
|
||||
SetGroups(modifier, selectedGroups);
|
||||
_session.Update(modifier);
|
||||
}
|
||||
private void SetGroups(Modifier modifier, IEnumerable<ProductGroup> selectedGroups)
|
||||
{
|
||||
if (selectedGroups == null)
|
||||
{
|
||||
var ug = modifier.ProductGroupModifiers.SingleOrDefault(x => x.ProductGroup == null);
|
||||
var others = modifier.ProductGroupModifiers.Where(x => x.ProductGroup != null).ToList();
|
||||
for (var i = others.Count() -1; i >= 0; i--)
|
||||
{
|
||||
var item = others[i];
|
||||
modifier.ProductGroupModifiers.Remove(item);
|
||||
_session.Delete(item);
|
||||
}
|
||||
if (ug == null)
|
||||
{
|
||||
var pgm = new ProductGroupModifier() { Modifier = modifier, ProductGroup = null, ShowAutomatically = false };
|
||||
_session.Save(pgm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var groups = new Dictionary<ProductGroup, bool>();
|
||||
foreach (var item in ProductGroupList())
|
||||
{
|
||||
groups.Add(item, selectedGroups.Any(x => x.ProductGroupID == item.ProductGroupID));
|
||||
}
|
||||
foreach (var item in groups)
|
||||
{
|
||||
var id = item.Key.ProductGroupID;
|
||||
var ug = modifier.ProductGroupModifiers.SingleOrDefault(x =>x.ProductGroup != null && x.ProductGroup.ProductGroupID == id);
|
||||
if (item.Value && ug == null)
|
||||
{
|
||||
var pgm = new ProductGroupModifier() { Modifier = modifier, ProductGroup = item.Key, ShowAutomatically = false };
|
||||
_session.Save(pgm);
|
||||
}
|
||||
else if (!item.Value && ug != null)
|
||||
{
|
||||
modifier.ProductGroupModifiers.Remove(ug);
|
||||
_session.Delete(ug);
|
||||
}
|
||||
}
|
||||
var blank = modifier.ProductGroupModifiers.SingleOrDefault(x => x.ProductGroup == null);
|
||||
if (blank != null)
|
||||
{
|
||||
modifier.ProductGroupModifiers.Remove(blank);
|
||||
_session.Delete(blank);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,12 +42,11 @@ namespace Tanshu.Accounts.Repository
|
||||
}
|
||||
public void UpdateSortOrder(IList<ProductGroup> list)
|
||||
{
|
||||
int order = 0;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
var productGroup = _session.Get<ProductGroup>(item.ProductGroupID);
|
||||
productGroup.SortOrder = order;
|
||||
productGroup.SortOrder = i;
|
||||
_session.Update(productGroup);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using NHibernate;
|
||||
using Tanshu.Accounts.Entities.Auth;
|
||||
@ -8,6 +9,12 @@ namespace Tanshu.Accounts.Repository
|
||||
{
|
||||
public class UserBI : UnitOfWork<User>
|
||||
{
|
||||
public IList<Group> GroupList()
|
||||
{
|
||||
return _session.QueryOver<Group>()
|
||||
.OrderBy(x => x.Name).Asc
|
||||
.List();
|
||||
}
|
||||
public IList<User> GetFilteredUsers(Dictionary<string, string> filter)
|
||||
{
|
||||
return _session.QueryOver<User>()
|
||||
@ -43,5 +50,35 @@ order by u.Name";
|
||||
.SetParameter("finishDate", finishDate)
|
||||
.List<User>();
|
||||
}
|
||||
public void Update(User user, IEnumerable<Group> selectedGroups)
|
||||
{
|
||||
var roles = new Dictionary<Group, bool>();
|
||||
foreach (var item in GroupList())
|
||||
{
|
||||
roles.Add(item, selectedGroups.Any(x => x.GroupID == item.GroupID));
|
||||
}
|
||||
foreach (var item in roles)
|
||||
{
|
||||
var id = item.Key.GroupID;
|
||||
var ug = user.UserGroups.SingleOrDefault(x => x.Group.GroupID == id);
|
||||
if (item.Value && ug == null)
|
||||
{
|
||||
var rg = new UserGroup() { User = user, Group = item.Key };
|
||||
_session.Save(rg);
|
||||
}
|
||||
else if (!item.Value && ug != null)
|
||||
{
|
||||
user.UserGroups.Remove(ug);
|
||||
_session.Delete(ug);
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool IsUserInRole(Guid userID, string roleName)
|
||||
{
|
||||
var user = _session.QueryOver<User>()
|
||||
.Where(x => x.UserID == userID)
|
||||
.SingleOrDefault();
|
||||
return user.UserGroups.SelectMany(x => x.Group.RoleGroups).Any(y=>y.Role.Name == roleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ namespace Tanshu.Accounts.Repository
|
||||
item.Voucher = voucher;
|
||||
item.Date = dt;
|
||||
item.Printed = true;
|
||||
item.TableID = voucher.TableID;
|
||||
item.Table = voucher.Table;
|
||||
item.User = voucher.User;
|
||||
item.Code = DbValues.KotCode;
|
||||
UpdateBillType(voucher);
|
||||
@ -58,7 +58,7 @@ namespace Tanshu.Accounts.Repository
|
||||
var kotID = Insert(voucher);
|
||||
if (updateTable)
|
||||
{
|
||||
var table = _session.QueryOver<FoodTable>().Where(x => x.Name == voucher.TableID).SingleOrDefault();
|
||||
var table = _session.QueryOver<FoodTable>().Where(x => x.FoodTableID == voucher.Table.FoodTableID).SingleOrDefault();
|
||||
if (table.VoucherID.HasValue)
|
||||
throw new ValidationException("A bill exists on this table, cannot overwrite");
|
||||
var status = !voucher.Printed ? "running" : "printed";
|
||||
@ -86,7 +86,7 @@ namespace Tanshu.Accounts.Repository
|
||||
item.Voucher = voucher;
|
||||
item.Date = dt;
|
||||
item.Printed = true;
|
||||
item.TableID = voucher.TableID;
|
||||
item.Table = voucher.Table;
|
||||
item.User = voucher.User;
|
||||
item.Code = DbValues.KotCode;
|
||||
_session.Save(item);
|
||||
@ -124,7 +124,7 @@ namespace Tanshu.Accounts.Repository
|
||||
var kotID = Update(voucher);
|
||||
if (updateTable)
|
||||
{
|
||||
var table = _session.QueryOver<FoodTable>().Where(x => x.Name == voucher.TableID).SingleOrDefault();
|
||||
var table = _session.QueryOver<FoodTable>().Where(x => x.FoodTableID == voucher.Table.FoodTableID).SingleOrDefault();
|
||||
var status = !voucher.Printed ? "running" : "printed";
|
||||
table.VoucherID = voucher.VoucherID;
|
||||
table.Status = status;
|
||||
@ -140,6 +140,7 @@ namespace Tanshu.Accounts.Repository
|
||||
NHibernateUtil.Initialize(voucher.Customer);
|
||||
NHibernateUtil.Initialize(voucher.Waiter);
|
||||
NHibernateUtil.Initialize(voucher.User);
|
||||
NHibernateUtil.Initialize(voucher.Table);
|
||||
foreach (var kot in voucher.Kots)
|
||||
{
|
||||
NHibernateUtil.Initialize(kot);
|
||||
@ -166,7 +167,7 @@ namespace Tanshu.Accounts.Repository
|
||||
|
||||
if (updateTable)
|
||||
{
|
||||
var table = _session.QueryOver<FoodTable>().Where(x => x.Name == voucher.TableID).SingleOrDefault();
|
||||
var table = _session.QueryOver<FoodTable>().Where(x => x.FoodTableID == voucher.Table.FoodTableID).SingleOrDefault();
|
||||
table.VoucherID = null;
|
||||
table.Status = null;
|
||||
_session.Update(table);
|
||||
@ -206,7 +207,7 @@ namespace Tanshu.Accounts.Repository
|
||||
_session.Update(newVoucher);
|
||||
|
||||
|
||||
var oldTable = _session.QueryOver<FoodTable>().Where(x => x.Name == oldVoucher.TableID).SingleOrDefault();
|
||||
var oldTable = _session.QueryOver<FoodTable>().Where(x => x.FoodTableID == oldVoucher.Table.FoodTableID).SingleOrDefault();
|
||||
foreach (var item in oldVoucher.Settlements)
|
||||
{
|
||||
_session.Delete(item);
|
||||
@ -249,13 +250,13 @@ namespace Tanshu.Accounts.Repository
|
||||
}
|
||||
}
|
||||
|
||||
public Guid MoveKot(Guid kotID, string tableName)
|
||||
public Guid MoveKot(Guid kotID, Guid tableID)
|
||||
{
|
||||
var kot = _session.Get<Kot>(kotID);
|
||||
var oldVoucher = _session.Get<Voucher>(kot.Voucher.VoucherID);
|
||||
var newVoucher = new Voucher(Session.User, oldVoucher.Customer, tableName, oldVoucher.Waiter, false, false, "");
|
||||
var table = _session.QueryOver<FoodTable>().Where(x => x.FoodTableID == tableID).SingleOrDefault();
|
||||
var newVoucher = new Voucher(Session.User, oldVoucher.Customer, table, oldVoucher.Waiter, false, false, "");
|
||||
Insert(newVoucher);
|
||||
var table = _session.QueryOver<FoodTable>().Where(x => x.Name == tableName).SingleOrDefault();
|
||||
table.VoucherID = newVoucher.VoucherID;
|
||||
table.Status = "running";
|
||||
_session.Update(table);
|
||||
@ -284,14 +285,14 @@ namespace Tanshu.Accounts.Repository
|
||||
Update(oldVoucher);
|
||||
|
||||
var status = oldVoucher.Printed ? "printed" : "running";
|
||||
var tableFirst = _session.QueryOver<FoodTable>().Where(x => x.Name == first.TableID).SingleOrDefault();
|
||||
var tableFirst = _session.QueryOver<FoodTable>().Where(x => x.FoodTableID == first.Table.FoodTableID).SingleOrDefault();
|
||||
if (tableFirst.VoucherID.HasValue)
|
||||
throw new ValidationException("A bill exists on this table, cannot overwrite");
|
||||
tableFirst.VoucherID = first.VoucherID;
|
||||
tableFirst.Status = status;
|
||||
_session.Update(tableFirst);
|
||||
|
||||
var tableSecond = _session.QueryOver<FoodTable>().Where(x => x.Name == second.TableID).SingleOrDefault();
|
||||
var tableSecond = _session.QueryOver<FoodTable>().Where(x => x.FoodTableID == second.Table.FoodTableID).SingleOrDefault();
|
||||
tableSecond.VoucherID = first.VoucherID;
|
||||
tableSecond.Status = status;
|
||||
_session.Update(tableFirst);
|
||||
@ -307,15 +308,15 @@ namespace Tanshu.Accounts.Repository
|
||||
Insert(newVoucher);
|
||||
Update(oldVoucher);
|
||||
|
||||
var table = _session.QueryOver<FoodTable>().Where(x => x.Name == oldVoucher.TableID).SingleOrDefault();
|
||||
var table = _session.QueryOver<FoodTable>().Where(x => x.FoodTableID == oldVoucher.Table.FoodTableID).SingleOrDefault();
|
||||
table.VoucherID = newVoucher.VoucherID;
|
||||
table.Status = "printed";
|
||||
_session.Update(table);
|
||||
}
|
||||
public Guid Move(string oldTableName, string newTableName)
|
||||
public Guid Move(Guid oldTableID, Guid newTableID)
|
||||
{
|
||||
var oldTable = _session.QueryOver<FoodTable>().Where(x => x.Name == oldTableName).SingleOrDefault();
|
||||
var newTable = _session.QueryOver<FoodTable>().Where(x => x.Name == newTableName).SingleOrDefault();
|
||||
var oldTable = _session.QueryOver<FoodTable>().Where(x => x.FoodTableID == oldTableID).SingleOrDefault();
|
||||
var newTable = _session.QueryOver<FoodTable>().Where(x => x.FoodTableID == newTableID).SingleOrDefault();
|
||||
var voucher = _session.Get<Voucher>(oldTable.VoucherID);
|
||||
|
||||
newTable.Status = oldTable.Status;
|
||||
@ -324,7 +325,7 @@ namespace Tanshu.Accounts.Repository
|
||||
oldTable.Status = null;
|
||||
oldTable.VoucherID = null;
|
||||
|
||||
voucher.TableID = newTable.Name;
|
||||
voucher.Table = newTable;
|
||||
|
||||
_session.Update(newTable);
|
||||
_session.Update(oldTable);
|
||||
|
||||
@ -70,7 +70,7 @@ namespace Tanshu.Accounts.Repository
|
||||
if (voucher.Settlements.Count(x => x.Settled == SettleOption.Unsettled) == 0 || voucher.Void)
|
||||
{
|
||||
var table = _session.QueryOver<FoodTable>()
|
||||
.Where(x => x.Name == voucher.TableID && x.VoucherID == voucher.VoucherID)
|
||||
.Where(x => x.FoodTableID == voucher.Table.FoodTableID && x.VoucherID == voucher.VoucherID)
|
||||
.SingleOrDefault();
|
||||
if (table != null)
|
||||
{
|
||||
|
||||
@ -30,17 +30,15 @@ namespace Tanshu.Accounts.Contracts
|
||||
}
|
||||
}
|
||||
}
|
||||
public static bool IsAllowed(RoleConstants role)
|
||||
public static bool IsAllowed(string role)
|
||||
{
|
||||
if (_currentUser == null)
|
||||
return false;
|
||||
if (_roles == null)
|
||||
_roles = new Dictionary<string, bool>();
|
||||
if (!_roles.ContainsKey(role.Role))
|
||||
_roles.Add(role.Role, MembershipBI.IsUserInRole(_currentUser.UserID, role.Role));
|
||||
return _roles[role.Role];
|
||||
|
||||
|
||||
if (!_roles.ContainsKey(role))
|
||||
_roles.Add(role, new UserBI().IsUserInRole(_currentUser.UserID, role));
|
||||
return _roles[role];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,15 +64,13 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BusinessLayer\CheckoutBI.cs" />
|
||||
<Compile Include="BusinessLayer\GroupBI.cs" />
|
||||
<Compile Include="BusinessLayer\CustomerBI.cs" />
|
||||
<Compile Include="BusinessLayer\FoodTableBI.cs" />
|
||||
<Compile Include="BusinessLayer\IUnitOfWork.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BusinessLayer\ManagementBI.cs" />
|
||||
<Compile Include="BusinessLayer\MembershipBI.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BusinessLayer\ModifierBI.cs" />
|
||||
<Compile Include="BusinessLayer\PrintLocationBI.cs" />
|
||||
<Compile Include="BusinessLayer\ProductBI.cs" />
|
||||
|
||||
Reference in New Issue
Block a user