This commit is contained in:
Andy Howard
2024-11-19 09:47:00 +00:00
parent c5ee285e27
commit 8b872cc8f3
214 changed files with 7924 additions and 5519 deletions
+1
View File
@@ -7,6 +7,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.31" />
<PackageReference Include="System.Data.Odbc" Version="6.0.2" />
</ItemGroup>
<ItemGroup>
@@ -24,8 +24,8 @@ using System.Text;
namespace Sarand.BusinessMgr.Net.Core.Web.App
{
//=======================================================================
public abstract class SbmApplication_Web : SbmApplication
//=======================================================================
public abstract class SbmApplication_Web : SbmApplication
{
//-------------------------------------------------------------------
// Data members.
@@ -98,9 +98,9 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
//-------------------------------------------------------------------
// Create consoles.
public override SbmConfigConsole CreateConfigConsole(SbmSessionContext sessionContext)
public override SbmSessionConsole CreateSessionConsole(ISbmUserContext_Core userContext)
{
return SbmConfigConsole.CreateConsole(sessionContext);
return SbmSessionConsole.CreateConsole(userContext);
}
public override SaDiaryConsole CreateDiaryConsole(ISbmUserContext_Core userContext)
{
@@ -114,10 +114,6 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
{
return new SbmCodeTypeConsole_Web(userContext);
}
public override SaReferenceDataConsole CreateReferenceDataConsole(ISbmUserContext_Core userContext)
{
return null;
}
public override SaItemDataConsole CreateItemDataConsole(ISbmUserContext_Core userContext)
{
return null;
@@ -0,0 +1,74 @@
using DocumentFormat.OpenXml.Drawing.Diagrams;
using Sarand.BusinessMgr.Net.Standard.Base.App;
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Sarand.BusinessMgr.Net.Core.Web.App
{
//=======================================================================
/// <summary>
/// Facade Instance configuration for core databases without Control configuration.
/// </summary>
public class SbmInstanceConfig_Core : SbmInstanceConfig
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
public SbmInstanceConfig_Core(SbmSessionContext_Web sessionContext)
{
this.SessionContext = sessionContext;
}
//-------------------------------------------------------------------
// Properties.
private SbmSessionContext_Web SessionContext { get; }
//-------------------------------------------------------------------
// Allowed data component types.
//-------------------------------------------------------------------
// Supported affiliate types.
public override bool AllowAffiliateType(Sbm.AffiliateType affiliateType, bool defaultResponse)
{
return defaultResponse;
}
// Supported affiliate types.
public override bool AllowAssociationType(Sbm.AssociationType affiliateType, bool defaultResponse)
{
return defaultResponse;
}
// Supported affiliate types.
public override bool AllowTransactionType(Sbm.TransactionType affiliateType, bool defaultResponse)
{
return defaultResponse;
}
//-------------------------------------------------------------------
// Supported application options.
public override bool AllowApplicationOption(Sbm.ConfigOption option, bool defaultResponse)
{
return defaultResponse;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -1,153 +0,0 @@
using DocumentFormat.OpenXml.Drawing.Diagrams;
using Sarand.BusinessMgr.Net.Standard.Base.App;
using Sarand.BusinessMgr.Net.Standard.Base.Bus.Control;
using Sarand.BusinessMgr.Net.Standard.Base.Mgr.Control;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Sarand.BusinessMgr.Net.Core.Web.App
{
//=======================================================================
public class SbmInstanceConfig_Web : SbmInstanceConfig
{
//-------------------------------------------------------------------
// Data members.
private readonly SysId controlOwnerId;
private readonly SysId controlRepositoryId;
//-------------------------------------------------------------------
// Construction.
public SbmInstanceConfig_Web(SysId controlOwnerId, SysId controlRepositoryId)
{
this.controlOwnerId = controlOwnerId;
this.controlRepositoryId = controlRepositoryId;
PopulateControlParams();
}
//-------------------------------------------------------------------
// Populate Repository Configuration parameters.
private void PopulateControlParams()
{
using (DisposableCollection<SacsDisposable> disposables = new DisposableCollection<SacsDisposable>())
{
SbmcItemMgr controlItemMgr = SbmGlobals_Web.System.CreateControlItemMgr();
if (controlItemMgr != null)
{
disposables.Add(controlItemMgr);
PopulateControlParams(controlItemMgr, new ItemId((short)SbmcHierarchyItem.ItemType.Owner, controlOwnerId));
PopulateControlParams(controlItemMgr, new ItemId((short)SbmcHierarchyItem.ItemType.Repository, controlRepositoryId));
}
}
}
private void PopulateControlParams(SbmcItemMgr controlItemMgr, ItemId paramItemId)
{
if (!ItemId.IsValid(paramItemId)) return;
using (DisposableCollection<SacsHierarchyItem> disposables = new DisposableCollection<SacsHierarchyItem>())
{
// Query item params.
SbmcItemParam.Params prmParam = new SbmcItemParam.Params();
prmParam.ItemIdsIncluded.Add(paramItemId);
prmParam.StatusCat = SbmcItemParam.StatusCat.ActiveOnly;
List<SbmcItemParam> itemParams = controlItemMgr.GetItemParamList(prmParam);
disposables.AddRange(itemParams);
foreach (SbmcItemParam itemParam in itemParams)
PopulateControlParam(itemParam);
}
}
private void PopulateControlParam(SbmcItemParam itemParam)
{
// Affiliate types.
if (IsConfigParamOfType(ConfigParamType.AllowedAffiliateTypes, itemParam))
AffiliateTypes_Allowed.UnionWith(EnumUtil.ParseEnums<Sbm.AffiliateType>(Regex.Split(itemParam.Value, "[\\s,;\\-]+")));
else if (IsConfigParamOfType(ConfigParamType.DisallowedAffiliateTypes, itemParam))
AffiliateTypes_Disallowed.UnionWith(EnumUtil.ParseEnums<Sbm.AffiliateType>(Regex.Split(itemParam.Value, "[\\s,;\\-]+")));
// Association types.
else if (IsConfigParamOfType(ConfigParamType.AllowedAssociationTypes, itemParam))
AssociationTypes_Allowed.UnionWith(EnumUtil.ParseEnums<Sbm.AssociationType>(Regex.Split(itemParam.Value, "[\\s,;\\-]+")));
else if (IsConfigParamOfType(ConfigParamType.DisallowedAssociationTypes, itemParam))
AssociationTypes_Disallowed.UnionWith(EnumUtil.ParseEnums<Sbm.AssociationType>(Regex.Split(itemParam.Value, "[\\s,;\\-]+")));
// Transaction types.
else if (IsConfigParamOfType(ConfigParamType.AllowedTransactionTypes, itemParam))
TransactionTypes_Allowed.UnionWith(EnumUtil.ParseEnums<Sbm.TransactionType>(Regex.Split(itemParam.Value, "[\\s,;\\-]+")));
else if (IsConfigParamOfType(ConfigParamType.DisallowedTransactionTypes, itemParam))
TransactionTypes_Disallowed.UnionWith(EnumUtil.ParseEnums<Sbm.TransactionType>(Regex.Split(itemParam.Value, "[\\s,;\\-]+")));
// Application options.
else if (IsConfigParamOfType(ConfigParamType.ApplicationOption, itemParam))
{
Sbm.ConfigOption option = EnumUtil.ParseEnum(itemParam.Name, Sbm.ConfigOption.Unknown);
if (option != Sbm.ConfigOption.Unknown)
{
if (itemParam.Value.EqualsCI(ApplicationOptionValue_Allow))
ApplicationOptions_Allowed.Add(option);
else if (itemParam.Value.EqualsCI(ApplicationOptionValue_Disallow))
ApplicationOptions_Disallowed.Add(option);
else if (itemParam.Value.EqualsCI(ApplicationOptionValue_Default))
ApplicationOptions_Default.Add(option);
else
SaLogger.Warn($"{SysUtil.Fn} Unrecognised application option value: {itemParam.Value}. Option: {option}.");
}
else
SaLogger.Warn($"{SysUtil.Fn} Unrecognised application option: {itemParam.Name}.");
}
}
//-------------------------------------------------------------------
// Allowed data component types.
//-------------------------------------------------------------------
// Supported affiliate types.
private readonly HashSet<Sbm.AffiliateType> AffiliateTypes_Allowed = new HashSet<Sbm.AffiliateType>();
private readonly HashSet<Sbm.AffiliateType> AffiliateTypes_Disallowed = new HashSet<Sbm.AffiliateType>();
public override bool AllowAffiliateType(Sbm.AffiliateType affiliateType)
{
if (AffiliateTypes_Disallowed.Contains(affiliateType)) return false;
if (AffiliateTypes_Allowed.Contains(affiliateType)) return true;
return false;
}
// Supported affiliate types.
private readonly HashSet<Sbm.AssociationType> AssociationTypes_Allowed = new HashSet<Sbm.AssociationType>();
private readonly HashSet<Sbm.AssociationType> AssociationTypes_Disallowed = new HashSet<Sbm.AssociationType>();
public override bool AllowAssociationType(Sbm.AssociationType affiliateType)
{
if (AssociationTypes_Disallowed.Contains(affiliateType)) return false;
if (AssociationTypes_Allowed.Contains(affiliateType)) return true;
return false;
}
// Supported affiliate types.
private readonly HashSet<Sbm.TransactionType> TransactionTypes_Allowed = new HashSet<Sbm.TransactionType>();
private readonly HashSet<Sbm.TransactionType> TransactionTypes_Disallowed = new HashSet<Sbm.TransactionType>();
public override bool AllowTransactionType(Sbm.TransactionType affiliateType)
{
if (TransactionTypes_Disallowed.Contains(affiliateType)) return false;
if (TransactionTypes_Allowed.Contains(affiliateType)) return true;
return false;
}
//-------------------------------------------------------------------
// Supported application options.
private readonly HashSet<Sbm.ConfigOption> ApplicationOptions_Allowed = new HashSet<Sbm.ConfigOption>();
private readonly HashSet<Sbm.ConfigOption> ApplicationOptions_Disallowed = new HashSet<Sbm.ConfigOption>();
private readonly HashSet<Sbm.ConfigOption> ApplicationOptions_Default = new HashSet<Sbm.ConfigOption>();
public override bool AllowApplicationOption(Sbm.ConfigOption option, bool defaultResponse)
{
if (ApplicationOptions_Disallowed.Contains(option)) return false;
if (ApplicationOptions_Allowed.Contains(option)) return true;
if (ApplicationOptions_Default.Contains(option)) return defaultResponse;
return false;
}
//-------------------------------------------------------------------
}
//=======================================================================
}
+27 -18
View File
@@ -28,7 +28,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
// Properties.
public abstract IStringLocalizer MainProperties { get; }
public virtual List<IStringLocalizer> AlternativeProperties { get; } = new List<IStringLocalizer>();
private HashSet<String> MissingKeysLogged { get; } = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
private HashSet<String> MissingKeysLogged { get; } = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
//-------------------------------------------------------------------
// Generic phrase translation.
@@ -36,7 +36,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
/// <summary>Retrieve localised text.</summary>
public LocalizedString GetText(string key, bool logMissingKey = true)
{
return GetText(key, new object[] { }, logMissingKey );
return GetText(key, new object[] { }, logMissingKey);
}
public LocalizedString GetText(string key, object param)
{
@@ -49,22 +49,22 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
public LocalizedString GetText(string key, object[] parameters, bool logMissingKey = true)
{
LocalizedString text = MainProperties.GetString(key, parameters);
if (text.ResourceNotFound)
{
// Look up key in alternative property files.
foreach (IStringLocalizer properties in AlternativeProperties ?? new List<IStringLocalizer>())
{
text = parameters == null || parameters.IsEmpty() ? properties.GetString(key) : properties.GetString(key, parameters);
if (!text.ResourceNotFound)
break;
}
}
if (text.ResourceNotFound && logMissingKey && !MissingKeysLogged.Contains(key))
{
MissingKeysLogged.Add(key);
SaLogger.Debug($"{SysUtil.Fn} Key not found: {key}");
}
return text;
if (text.ResourceNotFound)
{
// Look up key in alternative property files.
foreach (IStringLocalizer properties in AlternativeProperties ?? new List<IStringLocalizer>())
{
text = parameters == null || parameters.IsEmpty() ? properties.GetString(key) : properties.GetString(key, parameters);
if (!text.ResourceNotFound)
break;
}
}
if (text.ResourceNotFound && logMissingKey && !MissingKeysLogged.Contains(key))
{
MissingKeysLogged.Add(key);
SaLogger.Debug($"{SysUtil.Fn} Key not found: {key}");
}
return text;
}
// Square bracket indexing.
@@ -162,6 +162,15 @@ namespace Sarand.BusinessMgr.Net.Core.Web.App
return affiliateTypeCodes.GetDescForType(affiliateType, affiliateTypeCodes.GetCodeForType(affiliateType));
}
// Association Type.
public String GetAssociationTypeCaption(Sbm.AssociationType associationType)
{
if ((int)associationType < 1) return "";
// ToDo Association Type localisation.
List<TypeCodeDesc> associationTypeCodes = codes.GetCodesOfType(Sbm.SystemCode.AssociationType);
return associationTypeCodes.GetDescForType(associationType, associationTypeCodes.GetCodeForType(associationType));
}
// Asset Type.
public String GetAssetTypeCaption(Sbm.AssetType assetType)
{
@@ -29,8 +29,8 @@ using System.Threading.Tasks;
namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
{
//=======================================================================
public abstract class SbmController_Base : SaController
//=======================================================================
public abstract class SbmController_Base : SaController
{
//-------------------------------------------------------------------
// Data members.
@@ -64,7 +64,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
// Properties.
public SbmLocaliser Localiser { get; }
protected SbmApplication_Web App { get { return SbmGlobals_Web.Application; } }
public SbmAppConfig AppConfig { get { return App.AppConfig; } }
public App.SbmAppConfig AppConfig { get { return App.AppConfig; } }
public abstract SbmSessionContext SessionContext { get; }
public abstract ISbmUserContext_Core UserContext_Core { get; }
// Business components.
@@ -84,7 +84,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Controllers
protected SbmcInstanceMgr ControlInstanceMgr { get { return Internals_Control.ControlInstanceMgr; } }
protected SbmcItemMgr ControlItemMgr { get { return Internals_Control.ControlItemMgr; } }
// Consoles.
public SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } }
public SbmSessionConsole SessionConsole { get { return Internals.SessionConsole; } }
public SaDiaryConsole DiaryConsole { get { return Internals.DiaryConsole; } }
public SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
public SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
@@ -12,17 +12,17 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
public static class SbmAppConfigHelper
{
//-------------------------------------------------------------------
public static Dictionary<String, SbmAppConfig> ExtractAppConfigs(IConfigurationSection appConfigsSection)
public static Dictionary<String, App.SbmAppConfig> ExtractAppConfigs(IConfigurationSection appConfigsSection)
{
// NB The set of configurations will only allow one per context.
// Only the last configuration found for each context will be stored (NB usually only one of each apart from 'Defaults').
Dictionary<String, SbmAppConfig> appConfigs = new Dictionary<String, SbmAppConfig>();
// NB The set of configurations will only allow one per context.
// Only the last configuration found for each context will be stored (NB usually only one of each apart from 'Defaults').
Dictionary<string, App.SbmAppConfig> appConfigs = new Dictionary<string, App.SbmAppConfig>();
// Start the list with a default 'Defaults' configuration - values set to application defaults (defined in Sbm).
// NB This can be overridden in each level of configuration.
// Settings from the 'Defaults' configuration provide values where they are missing from other configurations.
// NB Coverage may not be 100% - just where it's proven needed.
SbmAppConfig defaultsAppConfig = new SbmAppConfig(Sbm.Config.Context_Defaults, null, null);
// Start the list with a default 'Defaults' configuration - values set to application defaults (defined in Sbm).
// NB This can be overridden in each level of configuration.
// Settings from the 'Defaults' configuration provide values where they are missing from other configurations.
// NB Coverage may not be 100% - just where it's proven needed.
App.SbmAppConfig defaultsAppConfig = new App.SbmAppConfig(Sbm.Config.Context_Defaults, null, null);
appConfigs.Add(defaultsAppConfig.Context, defaultsAppConfig);
// Load session configurations.
@@ -30,8 +30,8 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
{
if (StringUtil.IsEmpty(appConfigSection.Key)) continue;
// Extract the configuration, supplying current 'Defaults' to supply missing values, and add to the list.
SbmAppConfig appConfig = new SbmAppConfig(appConfigSection.Key, appConfigSection, defaultsAppConfig);
// Extract the configuration, supplying current 'Defaults' to supply missing values, and add to the list.
App.SbmAppConfig appConfig = new App.SbmAppConfig(appConfigSection.Key, appConfigSection, defaultsAppConfig);
appConfigs.Remove(appConfigSection.Key);
appConfigs.Add(appConfigSection.Key, appConfig);
@@ -48,13 +48,13 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
//=======================================================================
public static class AppConfigList
{
public static SbmAppConfig getConfigForApplication(this List<SbmAppConfig> appConfigs)
public static App.SbmAppConfig getConfigForApplication(this List<App.SbmAppConfig> appConfigs)
{
SbmAppConfig defaultsAppConfig = new SbmAppConfig("", null, null);
App.SbmAppConfig defaultsAppConfig = new App.SbmAppConfig("", null, null);
SbmApplication app = SbmGlobals_Web.Application;
if (app != null)
{
foreach (SbmAppConfig appConfig in appConfigs)
foreach (App.SbmAppConfig appConfig in appConfigs)
{
if (appConfig.Environments.ContainsCI(app.EnvironmentName))
return appConfig;
@@ -75,7 +75,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Helpers
//=======================================================================
public static class EmailConfigList
{
public static SbmEmailConfig getConfigForSession(this List<SbmEmailConfig> emailConfigs, SbmAppConfig appConfig)
public static SbmEmailConfig getConfigForSession(this List<SbmEmailConfig> emailConfigs, App.SbmAppConfig appConfig)
{
if (appConfig != null && !StringUtil.IsEmpty(appConfig.Email.Context))
{
+21 -13
View File
@@ -58,7 +58,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
//-------------------------------------------------------------------
// Application properties.
private SbmApplication_Web App { get { return SbmGlobals_Web.Application; } }
protected SbmAppConfig AppConfig { get { return App.AppConfig; } }
protected App.SbmAppConfig AppConfig { get { return App.AppConfig; } }
protected SbmSystem_Web System { get { return App.System_Web; } }
public String SessionCookieName { get { return App.SessionCookieName; } }
public SbmSessionData SessionData { get { return SessionData_Web; } }
@@ -94,7 +94,7 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
protected SbmcInstanceMgr ControlInstanceMgr { get { return Internals_Control.ControlInstanceMgr; } }
protected SbmcItemMgr ControlItemMgr { get { return Internals_Control.ControlItemMgr; } }
// Consoles.
protected SbmConfigConsole ConfigConsole { get { return Internals.ConfigConsole; } }
protected SbmSessionConsole SessionConsole { get { return Internals.SessionConsole; } }
protected SaDiaryConsole DiaryConsole { get { return Internals.DiaryConsole; } }
protected SaSecurityConsole SecurityConsole { get { return Internals.SecurityConsole; } }
protected SaCodeTypeConsole CodeTypeConsole { get { return Internals.CodeTypeConsole; } }
@@ -251,17 +251,26 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
// NB Use methods rathe rthan accessors for properties that depend on session data
// to avoid the model binding logic invoking a getter before it's ready for use.
/// <summary>List of Address Types for dropdown.</summary>
/// <summary>List of Code Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetCodeTypesForSelect()
{
List<CodeDesc> codeTypes = new List<CodeDesc>();
SaCodeType.Params prmCodeType = new SaCodeType.Params();
prmCodeType.SortColumns.Add(CodeTypeConsole.GetCodeTypeColumnDfn(SaCodeType.Column.Name));
List<CodeDesc> codeTypes = new List<CodeDesc>();
SaCodeType.Params prmCodeType = new SaCodeType.Params();
prmCodeType.SortColumns.Add(CodeTypeConsole.GetCodeTypeColumnDfn(SaCodeType.Column.Name));
foreach (SaCodeType codeType in CodeTypeConsole.GetCodeTypeList(prmCodeType))
codeTypes.Add(codeType.Code, codeType.Name);
codeTypes.Add(codeType.Code, codeType.Name);
return new SelectList(codeTypes, "Code", "Desc");
}
/// <summary>List of Code Type Codes for dropdown.</summary>
public IEnumerable<SelectListItem> GetCodeTypeCodesForSelect(Sbm.ApplCodeType codeType, bool activeOnly = true)
{
List<CodeDesc> codes = new List<CodeDesc>();
foreach (SaCode code in CodeTypeConsole.GetCodesForCodeType(SbmSystem.GetCodeTypeCode(codeType), activeOnly))
codes.Add(code.Code, code.Description);
return new SelectList(codes, "Code", "Desc");
}
/// <summary>List of Address Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetAddressTypeCodesForSelect()
{
@@ -270,12 +279,12 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
/// <summary>List of Affiliate Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetAffiliateTypeCodesForSelect()
{
return new SelectList(GetCodesOfType(Sbm.SystemCode.AffiliateType), "Code", "Desc");
}
{
return new SelectList(GetCodesOfType(Sbm.SystemCode.AffiliateType), "Code", "Desc");
}
/// <summary>List of Association Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetAssociationTypeCodesForSelect()
/// <summary>List of Association Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetAssociationTypeCodesForSelect()
{
return new SelectList(GetCodesOfType(Sbm.SystemCode.AssociationType), "Code", "Desc");
}
@@ -283,7 +292,6 @@ namespace Sarand.BusinessMgr.Net.Core.Web.Models
/// <summary>List of Commodity Types for dropdown.</summary>
public IEnumerable<SelectListItem> GetCommodityTypeCodesForSelect()
{
return new SelectList(GetCodesOfType(Sbm.SystemCode.CommodityType), "Code", "Desc");
}