Feature: Added SortOrder to Inventory.

Chore: Settle Choices form greatly simplified.
Feature: Modifiers are now cached.
This commit is contained in:
tanshu
2014-11-10 16:36:49 +05:30
parent 3706d8eb1e
commit c52f382ec2
12 changed files with 247 additions and 130 deletions

View File

@ -13,6 +13,7 @@ namespace Tanshu.Accounts.Repository
{
private static IList<ProductGroup> cache = null;
private static Dictionary<int, PrintLocation> locations = new Dictionary<int, PrintLocation>();
private static Dictionary<Guid, IList<Modifier>> modifiers = new Dictionary<Guid, IList<Modifier>>();
private static string location = ConfigurationManager.AppSettings["Location"].ToLowerInvariant();
private static IList<Role> roles = null;
@ -62,6 +63,18 @@ namespace Tanshu.Accounts.Repository
}
return locations[location.GetHashCode() ^ productGroupID.GetHashCode()];
}
public static IList<Modifier> ProductGroupModifiers(Guid productGroupID)
{
if (!modifiers.ContainsKey(productGroupID))
{
using (var bi = new ProductGroupModifierBI())
{
var list = bi.List(productGroupID);
modifiers.Add(productGroupID, list);
}
}
return modifiers[productGroupID];
}
public static IList<Role> UserRoles(Guid userID)
{
if (roles == null)
@ -82,6 +95,7 @@ namespace Tanshu.Accounts.Repository
{
cache = null;
locations = new Dictionary<int, PrintLocation>();
modifiers = new Dictionary<Guid, IList<Modifier>>();
}
public static bool Log
{

View File

@ -24,9 +24,12 @@ namespace Tanshu.Accounts.Repository
item.User = voucher.User;
UpdateBillType(voucher);
_session.Save(item);
int index = 0;
foreach (var inv in item.Inventories)
{
inv.Kot = item;
inv.SortOrder = index;
index++;
_session.Save(inv);
foreach (var modifier in inv.InventoryModifier)
{
@ -72,9 +75,12 @@ namespace Tanshu.Accounts.Repository
item.Table = voucher.Table;
item.User = voucher.User;
_session.Save(item);
int index = 0;
foreach (var inv in item.Inventories)
{
inv.Kot = item;
inv.SortOrder = index;
index++;
_session.Save(inv);
foreach (var modifier in inv.InventoryModifier)
{