General tidy.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Interfaces;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
@@ -265,7 +266,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static bool IsMenuOptionApplicable(ISbmUserContext userContext, SbmConfigConsole configConsole, Sbm.MenuOption menuOption)
|
||||
{
|
||||
String fn = ClassName + ".IsMenuOptionApplicable";
|
||||
if (!userContext.ValidUser)
|
||||
{
|
||||
// ToDo Only Login menu option available.
|
||||
@@ -295,7 +295,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
return configConsole.AllowOption(userContext, Sbm.ConfigOption.TimeRecording);
|
||||
//-----------------------------------------------------------
|
||||
}
|
||||
SaLogger.Warn(fn + " Unsupport menu option - " + menuOption.ToString());
|
||||
SaLogger.Warn($"{SysUtil.Fn} Unsupport menu option - {menuOption.ToString()}");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,8 +101,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
//-------------------------------------------------------------------
|
||||
public static SbmConfigConsole CreateConsole(SbmSessionContext sessionContext)
|
||||
{
|
||||
String fn = "SbmConfigConsole.CreateConsole";
|
||||
SaLogger.Warn(fn + ".CreateConsole Creating default configuration console.");
|
||||
SaLogger.Warn($"{SysUtil.Fn} Creating default configuration console.");
|
||||
// Default console.
|
||||
SbmVersion consoleVersion = new SbmVersion("Standard", Sbm.Version.GetFullVersion(), SbmSystem.AssemblyBuildAt);
|
||||
return new SbmConfigConsole(Sbm.ConfigConsole.Generic, consoleVersion, sessionContext);
|
||||
@@ -186,8 +185,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// Application events.
|
||||
public virtual void OnOpenDatabase()
|
||||
{
|
||||
String fn = GetType().Name + ".OnOpenDatabase";
|
||||
SaLogger.Trace(fn);
|
||||
SaLogger.Trace($"{SysUtil.Fn}");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:30
|
||||
// Code generated by Sarand Database Utilities Thu 6-Jun-2024 17:06:27
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
@@ -1159,10 +1159,19 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String tableName = tables[(int)tableIdx];
|
||||
String tableName = tables[(int)tableIdx].Name;
|
||||
if (delimitReservedWords) tableName = DelimitReservedWord(tableName);
|
||||
return tableName;
|
||||
}
|
||||
public static String GetTableNameQual (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String schemaName = tables[(int)tableIdx].Schema;
|
||||
String tableName = tables[(int)tableIdx].Name;
|
||||
if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); tableName = DelimitReservedWord(tableName); }
|
||||
return (StringUtil.IsBlank(schemaName) ? "" : schemaName + ".") + tableName;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Identify the table that corresponds with the specified column.
|
||||
@@ -1212,8 +1221,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
public static String DelimitReservedWord (String word)
|
||||
{
|
||||
if (!IsReservedWord(word)) return word;
|
||||
switch (reservedWordDelim)
|
||||
return IsReservedWord(word) ? DelimitWord(word) : word;
|
||||
}
|
||||
public static String DelimitWord (String word)
|
||||
{
|
||||
return DelimitWord(word, reservedWordDelim);
|
||||
}
|
||||
public static String DelimitWord (String word, DbReservedWordDelim wordDelim)
|
||||
{
|
||||
switch (wordDelim)
|
||||
{
|
||||
case DbReservedWordDelim.None:
|
||||
break;
|
||||
@@ -1290,52 +1306,62 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table definitions.
|
||||
private static readonly String[] tables =
|
||||
private class TableDfn
|
||||
{
|
||||
"Address",
|
||||
"Affiliate",
|
||||
"Association",
|
||||
"Commodity",
|
||||
"CommodityCustomer",
|
||||
"CommoditySupplier",
|
||||
"Constituent",
|
||||
"Container",
|
||||
"ContainerItem",
|
||||
"Currency",
|
||||
"IndexDefragLog",
|
||||
"Interface",
|
||||
"InterfaceDataItem",
|
||||
"InterfaceProcess",
|
||||
"InterfaceProcessDataItem",
|
||||
"InterfaceProcessMessage",
|
||||
"ItemBatch",
|
||||
"ItemLink",
|
||||
"Language",
|
||||
"Location",
|
||||
"Movement",
|
||||
"PortfolioItem",
|
||||
"Process",
|
||||
"Region",
|
||||
"Requirement",
|
||||
"SaAsset",
|
||||
"SaAssetCategory",
|
||||
"SaAssetProcess",
|
||||
"SaDiaryEntry",
|
||||
"SaDiaryLink",
|
||||
"SaPrice",
|
||||
"SaPriceSet",
|
||||
"SaVehicle",
|
||||
"SaVehicleClass",
|
||||
"SaVehicleEvent",
|
||||
"SaVehicleFeature",
|
||||
"StockLevel",
|
||||
"SysParam",
|
||||
"SystemAccount",
|
||||
"SystemAccountUser",
|
||||
"SystemUser",
|
||||
"TaxCode",
|
||||
"Transaction",
|
||||
"UnitMeasure",
|
||||
internal String Schema { get; set; }
|
||||
internal String Name { get; set; }
|
||||
internal TableDfn (String schema, String name)
|
||||
{
|
||||
this.Schema= schema;
|
||||
this.Name = name;
|
||||
}
|
||||
}
|
||||
private static readonly TableDfn[] tables =
|
||||
{
|
||||
new TableDfn("dbo","Address"),
|
||||
new TableDfn("dbo","Affiliate"),
|
||||
new TableDfn("dbo","Association"),
|
||||
new TableDfn("dbo","Commodity"),
|
||||
new TableDfn("dbo","CommodityCustomer"),
|
||||
new TableDfn("dbo","CommoditySupplier"),
|
||||
new TableDfn("dbo","Constituent"),
|
||||
new TableDfn("dbo","Container"),
|
||||
new TableDfn("dbo","ContainerItem"),
|
||||
new TableDfn("dbo","Currency"),
|
||||
new TableDfn("dbo","IndexDefragLog"),
|
||||
new TableDfn("dbo","Interface"),
|
||||
new TableDfn("dbo","InterfaceDataItem"),
|
||||
new TableDfn("dbo","InterfaceProcess"),
|
||||
new TableDfn("dbo","InterfaceProcessDataItem"),
|
||||
new TableDfn("dbo","InterfaceProcessMessage"),
|
||||
new TableDfn("dbo","ItemBatch"),
|
||||
new TableDfn("dbo","ItemLink"),
|
||||
new TableDfn("dbo","Language"),
|
||||
new TableDfn("dbo","Location"),
|
||||
new TableDfn("dbo","Movement"),
|
||||
new TableDfn("dbo","PortfolioItem"),
|
||||
new TableDfn("dbo","Process"),
|
||||
new TableDfn("dbo","Region"),
|
||||
new TableDfn("dbo","Requirement"),
|
||||
new TableDfn("dbo","SaAsset"),
|
||||
new TableDfn("dbo","SaAssetCategory"),
|
||||
new TableDfn("dbo","SaAssetProcess"),
|
||||
new TableDfn("dbo","SaDiaryEntry"),
|
||||
new TableDfn("dbo","SaDiaryLink"),
|
||||
new TableDfn("dbo","SaPrice"),
|
||||
new TableDfn("dbo","SaPriceSet"),
|
||||
new TableDfn("dbo","SaVehicle"),
|
||||
new TableDfn("dbo","SaVehicleClass"),
|
||||
new TableDfn("dbo","SaVehicleEvent"),
|
||||
new TableDfn("dbo","SaVehicleFeature"),
|
||||
new TableDfn("dbo","StockLevel"),
|
||||
new TableDfn("dbo","SysParam"),
|
||||
new TableDfn("dbo","SystemAccount"),
|
||||
new TableDfn("dbo","SystemAccountUser"),
|
||||
new TableDfn("dbo","SystemUser"),
|
||||
new TableDfn("dbo","TaxCode"),
|
||||
new TableDfn("dbo","Transaction"),
|
||||
new TableDfn("dbo","UnitMeasure"),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -1358,8 +1384,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
this.DataLen = dataLen;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private static readonly ColumnDfn[] columns =
|
||||
{
|
||||
new ColumnDfn(1,"Id",4,4,false,10),
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Sat 10-Jul-2021 16:26:28
|
||||
// Code generated by Sarand Database Utilities Thu 6-Jun-2024 17:06:27
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
@@ -98,10 +98,19 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String tableName = tables[(int)tableIdx];
|
||||
String tableName = tables[(int)tableIdx].Name;
|
||||
if (delimitReservedWords) tableName = DelimitReservedWord(tableName);
|
||||
return tableName;
|
||||
}
|
||||
public static String GetTableNameQual (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String schemaName = tables[(int)tableIdx].Schema;
|
||||
String tableName = tables[(int)tableIdx].Name;
|
||||
if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); tableName = DelimitReservedWord(tableName); }
|
||||
return (StringUtil.IsBlank(schemaName) ? "" : schemaName + ".") + tableName;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Identify the table that corresponds with the specified column.
|
||||
@@ -151,8 +160,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
}
|
||||
public static String DelimitReservedWord (String word)
|
||||
{
|
||||
if (!IsReservedWord(word)) return word;
|
||||
switch (reservedWordDelim)
|
||||
return IsReservedWord(word) ? DelimitWord(word) : word;
|
||||
}
|
||||
public static String DelimitWord (String word)
|
||||
{
|
||||
return DelimitWord(word, reservedWordDelim);
|
||||
}
|
||||
public static String DelimitWord (String word, DbReservedWordDelim wordDelim)
|
||||
{
|
||||
switch (wordDelim)
|
||||
{
|
||||
case DbReservedWordDelim.None:
|
||||
break;
|
||||
@@ -229,11 +245,21 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table definitions.
|
||||
private static readonly String[] tables =
|
||||
private class TableDfn
|
||||
{
|
||||
"Database",
|
||||
"DatabaseAccount",
|
||||
"UserAccount",
|
||||
internal String Schema { get; set; }
|
||||
internal String Name { get; set; }
|
||||
internal TableDfn (String schema, String name)
|
||||
{
|
||||
this.Schema= schema;
|
||||
this.Name = name;
|
||||
}
|
||||
}
|
||||
private static readonly TableDfn[] tables =
|
||||
{
|
||||
new TableDfn("dbo","Database"),
|
||||
new TableDfn("dbo","DatabaseAccount"),
|
||||
new TableDfn("dbo","UserAccount"),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -256,8 +282,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
this.DataLen = dataLen;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private static readonly ColumnDfn[] columns =
|
||||
{
|
||||
new ColumnDfn(1,"Id",4,4,true,10),
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
using Sarand.Net.Standard.Base.Helpers;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
//=======================================================================
|
||||
public static class SbmResourceConsole
|
||||
{
|
||||
//----------------------------------------------------------------------
|
||||
// Definitions.
|
||||
public enum TextResource
|
||||
{
|
||||
SaBaseCss,
|
||||
SaBaseJs,
|
||||
SbmBaseCss,
|
||||
SbmBaseJs,
|
||||
JQueryJs,
|
||||
JQueryUiCss,
|
||||
JQueryUiJs,
|
||||
}
|
||||
public enum ImageResource
|
||||
{
|
||||
// Sapphire icons.
|
||||
sapphire01_side_32_png,
|
||||
sapphire01_side_40_png,
|
||||
sapphire01_side_64_png,
|
||||
// Menu icons.
|
||||
arrow_down_black_16_png,
|
||||
arrow_down_black_24_png,
|
||||
arrow_up_black_16_png,
|
||||
arrow_up_black_24_png,
|
||||
star_amber_16_png,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public static Assembly Assembly { get { return typeof(SacsResourceHelper).GetTypeInfo().Assembly; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public static String GetTextResource(TextResource textResource)
|
||||
{
|
||||
switch (textResource)
|
||||
{
|
||||
case TextResource.SaBaseCss:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.SaBaseCss);
|
||||
case TextResource.SaBaseJs:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.SaBaseJs);
|
||||
case TextResource.SbmBaseCss:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.SaBaseCss) + SacsResourceHelper.GetManifestResourceAsText(Assembly, "", "sbm_base.css");
|
||||
case TextResource.SbmBaseJs:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.SaBaseJs) + SacsResourceHelper.GetManifestResourceAsText(Assembly, "", "sbm_base.js");
|
||||
|
||||
case TextResource.JQueryJs:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.JQueryJs);
|
||||
case TextResource.JQueryUiCss:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.JQueryUiCss);
|
||||
case TextResource.JQueryUiJs:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.JQueryUiJs);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public static byte[] GetImageResource(ImageResource imageResource)
|
||||
{
|
||||
String partialPath = "";
|
||||
String resourceFilename = "";
|
||||
switch (imageResource)
|
||||
{
|
||||
// Sapphire icons.
|
||||
case ImageResource.sapphire01_side_32_png:
|
||||
partialPath = "sapphire";
|
||||
resourceFilename = "sapphire01-side-32.png";
|
||||
break;
|
||||
case ImageResource.sapphire01_side_40_png:
|
||||
partialPath = "sapphire";
|
||||
resourceFilename = "sapphire01-side-40.png";
|
||||
break;
|
||||
case ImageResource.sapphire01_side_64_png:
|
||||
partialPath = "sapphire";
|
||||
resourceFilename = "sapphire01-side-64.png";
|
||||
break;
|
||||
|
||||
// Menu icons.
|
||||
case ImageResource.arrow_down_black_16_png:
|
||||
resourceFilename = "arrow-down-black-16.png";
|
||||
break;
|
||||
case ImageResource.arrow_down_black_24_png:
|
||||
resourceFilename = "arrow-down-black-24.png";
|
||||
break;
|
||||
case ImageResource.arrow_up_black_16_png:
|
||||
resourceFilename = "arrow-up-black-16.png";
|
||||
break;
|
||||
case ImageResource.arrow_up_black_24_png:
|
||||
resourceFilename = "arrow-up-black-24.png";
|
||||
break;
|
||||
case ImageResource.star_amber_16_png:
|
||||
resourceFilename = "star-amber-16.png";
|
||||
break;
|
||||
}
|
||||
if (!StringUtil.IsEmpty(resourceFilename))
|
||||
{
|
||||
var assembly = typeof(SbmResourceConsole).GetTypeInfo().Assembly;
|
||||
byte[] resourceData = SacsResourceHelper.GetManifestResourceAsBinary(assembly, partialPath, resourceFilename);
|
||||
if (resourceData != null)
|
||||
return resourceData;
|
||||
}
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
}
|
||||
@@ -44,7 +44,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// Refresh profile.
|
||||
public void RefreshProfile(SbmConfigConsole configConsole, SaSecurityConsole securityConsole, SysId userId, List<TypeCodeDesc> securityRights)
|
||||
{
|
||||
String fn = GetType().Name + ".RefreshProfile";
|
||||
ClearErrorState();
|
||||
|
||||
// Make a note of the security right.
|
||||
@@ -63,7 +62,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
if (hostSecurityProfile == null && includeHostSecurityProfile)
|
||||
hostSecurityProfile = securityConsole.GetHostSecurityProfile();
|
||||
}
|
||||
SaLogger.Debug(fn + " User: '" + UserDisplayName + "' [Id: " + UserId + "]" + (SysId.IsValid(previousUserId) ? ". Previous UserId: " + SysId.ToString(previousUserId) : ""));
|
||||
SaLogger.Debug($"{SysUtil.Fn} User: '{UserDisplayName}' [Id: {UserId}]" + (SysId.IsValid(previousUserId) ? ". Previous UserId: " + SysId.ToString(previousUserId) : ""));
|
||||
|
||||
RefreshProfileSettings(configConsole);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.ItemOptions;
|
||||
using Sarand.Net.Standard.Base.Security;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
@@ -96,7 +97,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
SbmAffiliate affiliateUser = accountMgr.GetAffiliateByUserId(userId);
|
||||
if (affiliateUser == null)
|
||||
{
|
||||
SaLogger.Warn(GetType().Name + ".StartUserSession Unable to retrieve affiliate for UserId: " + SysId.ToString(userId));
|
||||
SaLogger.Warn($"{SysUtil.Fn} Unable to retrieve affiliate for UserId: {SysId.ToString(userId)}");
|
||||
return false;
|
||||
}
|
||||
List<SysIdString> userSupervisedOwners = accountMgr.GetAffiliatesSupervisedBy(affiliateUser.Id);
|
||||
|
||||
@@ -1,52 +1,139 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Org.BouncyCastle.Asn1.IsisMtt;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Bus;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Mgr;
|
||||
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.Xml.Linq;
|
||||
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
{
|
||||
//=======================================================================
|
||||
public class SbmSysParamCache
|
||||
public class SbmSysParamCache : SacsDisposable
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
public enum ParamName
|
||||
{
|
||||
/// <summary>User's selected organisation.</summary>
|
||||
SelectedCompany,
|
||||
SelectedOwner = SelectedCompany,
|
||||
DefaultView,
|
||||
ApplicationSize,
|
||||
LeftPanelWidth,
|
||||
SelectedAssociation,
|
||||
SelectedTransaction,
|
||||
SelectedPortfolio,
|
||||
SelectedPortfolioItem,
|
||||
SelectedCommodity,
|
||||
AssocMaintTab,
|
||||
}
|
||||
public static String ParamName_SelectedCompany = "SelectedCompany";
|
||||
public static String ParamName_DefaultView = "DefaultView";
|
||||
public static String ParamName_ApplicationSize = "AppSize";
|
||||
public static String ParamName_LeftPanelWidth = "LeftPanelWidth";
|
||||
public static String ParamName_SelectedAssociation = "SelectedAssociation";
|
||||
public static String ParamName_SelectedTransaction = "SelectedTransaction";
|
||||
public static String ParamName_SelectedPortfolio = "SelectedPortfolio";
|
||||
public static String ParamName_SelectedPortfolioItem = "SelectedPortfolioItem";
|
||||
public static String ParamName_SelectedCommodity = "SelectedCommodity";
|
||||
public static String ParamName_AssocMaintTab = "AssocMaintTab";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
protected readonly List<SbmSysParam> userSysParams = new List<SbmSysParam>();
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Protected Construction - use derived objects.
|
||||
// Construction.
|
||||
public SbmSysParamCache(ISbmUserContext userContext)
|
||||
{
|
||||
this.UserContext = userContext;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public ISbmUserContext UserContext { get; }
|
||||
public SysId AffiliateIdUser { get; private set; }
|
||||
public SysId AffiliateIdUser { get { return UserContext.User.AffiliateId; } }
|
||||
public bool Modified { get; private set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Utilities.
|
||||
public static String GetParamName(ParamName paramName)
|
||||
{
|
||||
switch (paramName)
|
||||
{
|
||||
case ParamName.SelectedCompany:
|
||||
return ParamName_SelectedCompany;
|
||||
case ParamName.DefaultView:
|
||||
return ParamName_DefaultView;
|
||||
case ParamName.ApplicationSize:
|
||||
return ParamName_ApplicationSize;
|
||||
case ParamName.LeftPanelWidth:
|
||||
return ParamName_LeftPanelWidth;
|
||||
case ParamName.SelectedAssociation:
|
||||
return ParamName_SelectedAssociation;
|
||||
case ParamName.SelectedTransaction:
|
||||
return ParamName_SelectedTransaction;
|
||||
case ParamName.SelectedPortfolio:
|
||||
return ParamName_SelectedPortfolio;
|
||||
case ParamName.SelectedPortfolioItem:
|
||||
return ParamName_SelectedPortfolioItem;
|
||||
case ParamName.SelectedCommodity:
|
||||
return ParamName_SelectedCommodity;
|
||||
case ParamName.AssocMaintTab:
|
||||
return ParamName_AssocMaintTab;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
/// <summary>Retrieve the value for the user parameter.</summary>
|
||||
public String GetParamValue(String name, SysId affiliateIdTarget = null, SysId associationId = null)
|
||||
public String GetUserParamValue(ParamName paramName, SysId affiliateIdTarget = null, SysId associationId = null)
|
||||
{
|
||||
return GetUserParamValue(GetParamName(paramName), affiliateIdTarget, associationId);
|
||||
}
|
||||
|
||||
/// <summary>Retrieve the value for the user parameter.</summary>
|
||||
public String GetUserParamValue(String name, SysId affiliateIdTarget = null, SysId associationId = null)
|
||||
{
|
||||
if (!SysId.IsValid(UserContext.User.AffiliateId)) return "";
|
||||
return GetParam(name, affiliateIdTarget, associationId)?.Value ?? "";
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
/// <summary>Store value against user parameter.</summary>
|
||||
public bool SetSessionParam(String name, String value, SysId affiliateIdTarget = null, SysId associationId = null)
|
||||
public bool SetUserParamValue(ParamName paramName, String value, SysId affiliateIdTarget = null, SysId associationId = null)
|
||||
{
|
||||
return SetUserParamValue(GetParamName(paramName), value, affiliateIdTarget, associationId);
|
||||
}
|
||||
|
||||
/// <summary>Store value against user parameter.</summary>
|
||||
public bool SetUserParamValue(String name, String value, SysId affiliateIdTarget = null, SysId associationId = null)
|
||||
{
|
||||
bool success = false;
|
||||
if (!SysId.IsValid(UserContext.User.AffiliateId)) return false;
|
||||
SbmSysParam sysParam = GetParam(name, affiliateIdTarget, associationId);
|
||||
if (sysParam != null)
|
||||
{
|
||||
// Update the value.
|
||||
sysParam.Value = value;
|
||||
if (!sysParam.Value.Equals(value))
|
||||
{
|
||||
// Update the value.
|
||||
sysParam.Value = value;
|
||||
Modified = true;
|
||||
}
|
||||
success = true;
|
||||
}
|
||||
return success;
|
||||
@@ -98,7 +185,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
/// <summary>Store the params cached for the current user.</summary>
|
||||
public bool Store()
|
||||
{
|
||||
String fn = GetType().Name + ".Store";
|
||||
bool success = true;
|
||||
using (SbmAccountMgr accountMgr = CreateAccountMgr())
|
||||
{
|
||||
@@ -110,7 +196,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
if (!accountMgr.InsertSysParam(sysParam, UserContext.DbUpdateInfo))
|
||||
{
|
||||
success = false;
|
||||
SaLogger.Warn(fn + " Failed to add parameter - " + accountMgr.ErrorStateMessage);
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to add parameter - {accountMgr.ErrorStateMessage}");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -119,11 +205,12 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
if (!accountMgr.UpdateSysParam(sysParam, UserContext.DbUpdateInfo))
|
||||
{
|
||||
success = false;
|
||||
SaLogger.Warn(fn + " Failed to update parameter - " + accountMgr.ErrorStateMessage);
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to update parameter - {accountMgr.ErrorStateMessage}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (success) Modified = false;
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -131,8 +218,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
/// <summary>Clear the params cached for the current user.</summary>
|
||||
public void Clear()
|
||||
{
|
||||
AffiliateIdUser = null;
|
||||
ListUtil.ClearAndDispose(userSysParams);
|
||||
Modified = false;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -130,7 +130,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
SessionContext = sessionContext;
|
||||
organisationData = new OrganisationData_Internal();
|
||||
securityProfile = new SbmSecurityProfile(this, true);
|
||||
DbUpdateInfo = new DbUpdateInfo(User.AffiliateId, User.DisplayName, SacsSystem.ComputerName);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -139,7 +138,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
public ISbmUserContext.IUserData User { get { return userData; } }
|
||||
public bool ValidUser { get { return SysId.IsValid(userData.SecurityItemId) && SysId.IsValid(userData.AffiliateId); } }
|
||||
public ISbmUserContext.IOrganisationData Organisation { get { return organisationData; } }
|
||||
public DbUpdateInfo DbUpdateInfo { get; private set; }
|
||||
public DbUpdateInfo DbUpdateInfo { get { return new DbUpdateInfo(User?.AffiliateId, User?.DisplayName ?? "", SacsSystem.ComputerName); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security profile.
|
||||
@@ -283,19 +282,15 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
protected void SetUserData(SaSecurityItem securityItemUser, SbmAffiliate affiliateUser, List<SysIdString> supervisedOwners)
|
||||
{
|
||||
userData.Refresh(securityItemUser, affiliateUser, supervisedOwners);
|
||||
DbUpdateInfo = new DbUpdateInfo(User.AffiliateId, User.DisplayName, SacsSystem.ComputerName);
|
||||
}
|
||||
protected void ClearUserData()
|
||||
{
|
||||
userData.Clear();
|
||||
organisationData.Clear();
|
||||
SetSecurityProfile(new SbmSecurityProfile(this, true));
|
||||
DbUpdateInfo = new DbUpdateInfo(User.AffiliateId, User.DisplayName, SacsSystem.ComputerName);
|
||||
}
|
||||
protected void SetOrganisationData(SysId affiliateIdOrganisation)
|
||||
{
|
||||
String fn = GetType().Name + ".SetOrganisationData";
|
||||
|
||||
// Interface context for selected organisation.
|
||||
String interfaceContext = SbmAccountMgr.GetInterfaceContext(affiliateIdOrganisation);
|
||||
|
||||
@@ -329,7 +324,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.App
|
||||
// Retrieve the options for this association.
|
||||
organisationData.configOptionsCache.Reset(associationItemId_Owner, affiliateItemId_Owner);
|
||||
organisationData.configOptionsCache.ItemOptions.AddRange(itemOptionConsole.GetItemOptionsForItem(associationItemId_Owner));
|
||||
SaLogger.Debug(fn + " Populated organisation options: " + organisationData.configOptionsCache.ItemOptions.Count);
|
||||
SaLogger.Debug($"{SysUtil.Fn} Populated organisation options: {organisationData.configOptionsCache.ItemOptions.Count}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,17 +444,16 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
// Id.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Item type.
|
||||
if ((int)ItemType > 1 && ItemType != data.ItemType)
|
||||
throw new NotSupportedException(fn + " Item Type cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Item Type cannot be changed");
|
||||
// Item Id.
|
||||
if (SysId.IsValid(ItemId) && SysId.ToInt(ItemId) != SysId.ToInt(data.ItemId))
|
||||
throw new NotSupportedException(fn + " Item Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Item Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -471,10 +471,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -416,10 +416,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -256,10 +256,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -164,10 +165,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -587,10 +587,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -1130,10 +1130,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -169,10 +169,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -162,10 +163,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -441,10 +442,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -202,10 +203,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -203,10 +204,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -291,10 +291,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -165,10 +166,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -202,10 +202,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -164,10 +164,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
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;
|
||||
|
||||
@@ -232,10 +233,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -153,10 +154,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -215,10 +215,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -226,10 +227,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -203,12 +204,11 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(PriceSetId) && SysId.ToInt(PriceSetId) != SysId.ToInt(data.PriceSetId))
|
||||
throw new NotSupportedException(fn + "Price set Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Price set Id cannot be changed");
|
||||
if (SysId.IsValid(CommodityId) && SysId.ToInt(CommodityId) != SysId.ToInt(data.CommodityId))
|
||||
throw new NotSupportedException(fn + "Commodity Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Commodity Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -164,10 +165,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -171,10 +172,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -768,10 +768,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -203,10 +204,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -169,10 +170,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -179,10 +180,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
@@ -133,10 +134,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
@@ -160,10 +161,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -1060,10 +1060,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -162,10 +162,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -374,10 +375,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -296,10 +297,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -227,10 +228,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Sarand.BusinessMgr.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Bus;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -234,10 +235,9 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Bus
|
||||
public Data GetData() { return data.Clone(); }
|
||||
public void SetData(Data data)
|
||||
{
|
||||
String fn = GetType().Name + ".SetData";
|
||||
// Properties that cannot be changed if previously specified.
|
||||
if (SysId.IsValid(Id) && SysId.ToInt(Id) != SysId.ToInt(data.Id))
|
||||
throw new NotSupportedException(fn + " Id cannot be changed");
|
||||
throw new NotSupportedException($"{SysUtil.Fn} Id cannot be changed");
|
||||
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
|
||||
this.data.PopulateFrom(data);
|
||||
}
|
||||
|
||||
@@ -45,8 +45,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Helpers
|
||||
/// </summary>
|
||||
public static int GetPasswordStrength(String password)
|
||||
{
|
||||
String fn = "PasswordHelper.GetPasswordStrength";
|
||||
|
||||
// 0 - Blank.
|
||||
if (StringUtil.IsEmpty(password)) return 0;
|
||||
|
||||
@@ -61,7 +59,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Helpers
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Debug(fn + " " + ExceptionUtil.GetLogMessage(exc));
|
||||
SaLogger.Debug($"{SysUtil.Fn} {ExceptionUtil.GetLogMessage(exc)}");
|
||||
}
|
||||
int passwordLength = StringUtil.GetLength(password);
|
||||
|
||||
|
||||
@@ -14,6 +14,14 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Helpers
|
||||
// Definitions.
|
||||
public enum TextResource
|
||||
{
|
||||
// Base text resources.
|
||||
SaBaseCss,
|
||||
SaBaseJs,
|
||||
SbmBaseCss,
|
||||
SbmBaseJs,
|
||||
JQueryJs,
|
||||
JQueryUiCss,
|
||||
JQueryUiJs,
|
||||
// Email stylesheets.
|
||||
Email_Main_Css,
|
||||
// Email partial content.
|
||||
@@ -26,8 +34,22 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Helpers
|
||||
public enum ImageResource
|
||||
{
|
||||
BusinessMgr_logo_h75_png,
|
||||
// Sapphire icons.
|
||||
sapphire01_side_32_png,
|
||||
sapphire01_side_40_png,
|
||||
sapphire01_side_64_png,
|
||||
// Menu icons.
|
||||
arrow_down_black_16_png,
|
||||
arrow_down_black_24_png,
|
||||
arrow_up_black_16_png,
|
||||
arrow_up_black_24_png,
|
||||
star_amber_16_png,
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Properties.
|
||||
public static Assembly Assembly { get { return typeof(SacsResourceHelper).GetTypeInfo().Assembly; } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Text resources.
|
||||
public static String GetTextResource(TextResource textResource)
|
||||
@@ -36,6 +58,22 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Helpers
|
||||
String resourceFilename = "";
|
||||
switch (textResource)
|
||||
{
|
||||
// Base text resources.
|
||||
case TextResource.SaBaseCss:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.SaBaseCss);
|
||||
case TextResource.SaBaseJs:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.SaBaseJs);
|
||||
case TextResource.SbmBaseCss:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.SaBaseCss) + SacsResourceHelper.GetManifestResourceAsText(Assembly, "", "sbm_base.css");
|
||||
case TextResource.SbmBaseJs:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.SaBaseJs) + SacsResourceHelper.GetManifestResourceAsText(Assembly, "", "sbm_base.js");
|
||||
case TextResource.JQueryJs:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.JQueryJs);
|
||||
case TextResource.JQueryUiCss:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.JQueryUiCss);
|
||||
case TextResource.JQueryUiJs:
|
||||
return SacsResourceHelper.GetResourceText(SacsResourceHelper.TextResource.JQueryUiJs);
|
||||
|
||||
// Email stylesheet.
|
||||
case TextResource.Email_Main_Css:
|
||||
resourceFilename = "sbm-email-main.css";
|
||||
@@ -55,8 +93,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Helpers
|
||||
}
|
||||
if (!StringUtil.IsEmpty(resourceFilename))
|
||||
{
|
||||
var assembly = typeof(SbmResourceHelper).GetTypeInfo().Assembly;
|
||||
String resourceText = SacsResourceHelper.GetManifestResourceAsText(assembly, partialPath, resourceFilename);
|
||||
String resourceText = SacsResourceHelper.GetManifestResourceAsText(Assembly, partialPath, resourceFilename);
|
||||
if (!StringUtil.IsEmpty(resourceText))
|
||||
return resourceText;
|
||||
}
|
||||
@@ -74,11 +111,41 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Helpers
|
||||
case ImageResource.BusinessMgr_logo_h75_png:
|
||||
resourceFilename = "BusinessMgr-logo-h75.png";
|
||||
break;
|
||||
|
||||
// Sapphire icons.
|
||||
case ImageResource.sapphire01_side_32_png:
|
||||
partialPath = "sapphire";
|
||||
resourceFilename = "sapphire01-side-32.png";
|
||||
break;
|
||||
case ImageResource.sapphire01_side_40_png:
|
||||
partialPath = "sapphire";
|
||||
resourceFilename = "sapphire01-side-40.png";
|
||||
break;
|
||||
case ImageResource.sapphire01_side_64_png:
|
||||
partialPath = "sapphire";
|
||||
resourceFilename = "sapphire01-side-64.png";
|
||||
break;
|
||||
|
||||
// Menu icons.
|
||||
case ImageResource.arrow_down_black_16_png:
|
||||
resourceFilename = "arrow-down-black-16.png";
|
||||
break;
|
||||
case ImageResource.arrow_down_black_24_png:
|
||||
resourceFilename = "arrow-down-black-24.png";
|
||||
break;
|
||||
case ImageResource.arrow_up_black_16_png:
|
||||
resourceFilename = "arrow-up-black-16.png";
|
||||
break;
|
||||
case ImageResource.arrow_up_black_24_png:
|
||||
resourceFilename = "arrow-up-black-24.png";
|
||||
break;
|
||||
case ImageResource.star_amber_16_png:
|
||||
resourceFilename = "star-amber-16.png";
|
||||
break;
|
||||
}
|
||||
if (!StringUtil.IsEmpty(resourceFilename))
|
||||
{
|
||||
var assembly = typeof(SbmResourceHelper).GetTypeInfo().Assembly;
|
||||
byte[] resourceData = SacsResourceHelper.GetManifestResourceAsBinary(assembly, partialPath, resourceFilename);
|
||||
byte[] resourceData = SacsResourceHelper.GetManifestResourceAsBinary(Assembly, partialPath, resourceFilename);
|
||||
if (resourceData != null)
|
||||
return resourceData;
|
||||
}
|
||||
|
||||
@@ -280,13 +280,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
private CodeTypeCache codeTypeCache;
|
||||
public bool CodeTypeHasCodes(Sbm.ApplCodeType codeType)
|
||||
{
|
||||
if (DebugMode && !SupportedCodeTypes.Contains(codeType)) throw new NotSupportedException(GetType().Name + ".CodeTypeHasCodes Unsupported code type: " + codeType);
|
||||
if (DebugMode && !SupportedCodeTypes.Contains(codeType)) throw new NotSupportedException($"{SysUtil.Fn} Unsupported code type: {codeType}");
|
||||
PopulateCodeTypes();
|
||||
return codeTypeCache.CodeTypeHasCodes(codeType);
|
||||
}
|
||||
public String GetCodeTypeCodeDesc(Sbm.ApplCodeType codeType, String code, bool defaultToCode = true)
|
||||
{
|
||||
if (DebugMode && !SupportedCodeTypes.Contains(codeType)) throw new NotSupportedException(GetType().Name + ".GetCodeTypeCodeDesc Unsupported code type: " + codeType);
|
||||
if (DebugMode && !SupportedCodeTypes.Contains(codeType)) throw new NotSupportedException($"{SysUtil.Fn} Unsupported code type: {codeType}");
|
||||
PopulateCodeTypes();
|
||||
List<SaCode> codes = codeTypeCache.GetCodesForCodeType(codeType, false);
|
||||
if (codes != null)
|
||||
@@ -295,13 +295,13 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.Mgr
|
||||
}
|
||||
public List<SaCode> GetCodesForCodeType(Sbm.ApplCodeType codeType, bool activeOnly = true)
|
||||
{
|
||||
if (DebugMode && !SupportedCodeTypes.Contains(codeType)) throw new NotSupportedException(GetType().Name + ".GetCodesForCodeType Unsupported code type: " + codeType);
|
||||
if (DebugMode && !SupportedCodeTypes.Contains(codeType)) throw new NotSupportedException($"{SysUtil.Fn} Unsupported code type: {codeType}");
|
||||
PopulateCodeTypes();
|
||||
return codeTypeCache.GetCodesForCodeType(codeType, activeOnly);
|
||||
}
|
||||
public List<CodeDesc> GetCodeDescsForCodeType(Sbm.ApplCodeType codeType, bool activeOnly = true)
|
||||
{
|
||||
if (DebugMode && !SupportedCodeTypes.Contains(codeType)) throw new NotSupportedException(GetType().Name + ".GetCodeDescsForCodeType Unsupported code type: " + codeType);
|
||||
if (DebugMode && !SupportedCodeTypes.Contains(codeType)) throw new NotSupportedException($"{SysUtil.Fn} Unsupported code type: {codeType}");
|
||||
PopulateCodeTypes();
|
||||
return codeTypeCache.GetCodeDescsForCodeType(codeType, activeOnly);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.WebService
|
||||
//-------------------------------------------------------------------
|
||||
public async Task<bool> RequestIsAlive(SbmWebServiceInstanceDefinition instanceDefinition)
|
||||
{
|
||||
String fn = GetType().Name + ".IsAlive";
|
||||
try
|
||||
{
|
||||
RequestData requestData = new RequestData(instanceDefinition);
|
||||
@@ -65,7 +64,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.WebService
|
||||
if (serviceResponse.ResponseData.EqualsCI(SbmWebServiceDfn.IsAliveResponse))
|
||||
return true;
|
||||
}
|
||||
catch (Exception exc) { SaLogger.Warn(fn + " " + exc.GetLogMessage()); }
|
||||
catch (Exception exc) { SaLogger.Warn($"{SysUtil.Fn} " + exc.GetLogMessage()); }
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -79,7 +78,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.WebService
|
||||
}
|
||||
public async Task<ItemCountResponseData> RequestItemCount(SbmWebServiceRequest.Config configRequest, Dictionary<String, String> filters, SacsTaskData taskData)
|
||||
{
|
||||
String fn = GetType().Name + ".GetItemCount";
|
||||
if (SacsSystem.DebugMode && configRequest.RequestType != SbmWebServiceRequest.RequestType.Count) Debugger.Break();
|
||||
|
||||
// Service Request.
|
||||
@@ -133,7 +131,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.WebService
|
||||
}
|
||||
public async Task<QueryListResponseData> RequestQueryList(SbmWebServiceRequest.Config configRequest, Dictionary<String, String> filters, List<string> columns, List<String> sortColumns, SacsTaskData taskData)
|
||||
{
|
||||
String fn = GetType().Name + ".GetItemList";
|
||||
if (SacsSystem.DebugMode && configRequest.RequestType != SbmWebServiceRequest.RequestType.QueryList) Debugger.Break();
|
||||
|
||||
// Service Request.
|
||||
@@ -147,7 +144,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.WebService
|
||||
requestData.Data = serviceRequestData.GenerateRequestData();
|
||||
SbmWebServiceResponse serviceResponse = await DoWebServiceRequest(requestData);
|
||||
QueryListResponseData responseData = new QueryListResponseData(serviceResponse);
|
||||
//if (SacsSystem.DebugMode && responseData.ResponseElement != null) SaLogger.Debug(fn + " Response:\n\n" + responseData.ResponseElement.FormatXml() + "\n");
|
||||
//if (SacsSystem.DebugMode && responseData.ResponseElement != null) SaLogger.Debug($"{SysUtil.Fn} Response:\n\n" + responseData.ResponseElement.FormatXml() + "\n");
|
||||
|
||||
// Interpret response.
|
||||
if (serviceResponse.ResponseElement != null && !taskData.IsCancellationRequested)
|
||||
@@ -209,7 +206,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.WebService
|
||||
}
|
||||
public async Task<ItemListResponseData> RequestItemList(SbmWebServiceRequest.Config configRequest, Dictionary<String, String> filters, List<String> sortColumns, SacsTaskData taskData)
|
||||
{
|
||||
String fn = GetType().Name + ".GetItemList";
|
||||
if (SacsSystem.DebugMode && configRequest.RequestType != SbmWebServiceRequest.RequestType.ItemList) Debugger.Break();
|
||||
|
||||
// Service Request.
|
||||
@@ -222,7 +218,7 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.WebService
|
||||
requestData.Data = serviceRequestData.GenerateRequestData();
|
||||
SbmWebServiceResponse serviceResponse = await DoWebServiceRequest(requestData);
|
||||
ItemListResponseData responseData = new ItemListResponseData(serviceResponse);
|
||||
//if (SacsSystem.DebugMode && responseData.ResponseElement != null) SaLogger.Debug(fn + " Response:\n\n" + responseData.ResponseElement.FormatXml() + "\n");
|
||||
//if (SacsSystem.DebugMode && responseData.ResponseElement != null) SaLogger.Debug($"{SysUtil.Fn} Response:\n\n" + responseData.ResponseElement.FormatXml() + "\n");
|
||||
|
||||
// Interpret response.
|
||||
if (serviceResponse.ResponseElement != null && !taskData.IsCancellationRequested)
|
||||
@@ -272,7 +268,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.WebService
|
||||
}
|
||||
public async Task<ItemDataResponseData> RequestItemData(SbmWebServiceRequest.Config configRequest, Dictionary<String, String> filters, SacsTaskData taskData)
|
||||
{
|
||||
String fn = GetType().Name + ".GetItemData";
|
||||
if (SacsSystem.DebugMode && configRequest.RequestType != SbmWebServiceRequest.RequestType.Item) Debugger.Break();
|
||||
|
||||
// Service Request.
|
||||
@@ -349,7 +344,6 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.WebService
|
||||
}
|
||||
public async Task<StoreItemResponseData> StoreItem(SbmWebServiceRequest.Config configRequest, XElement itemElement, SacsTaskData taskData)
|
||||
{
|
||||
String fn = GetType().Name + ".StoreItem";
|
||||
if (SacsSystem.DebugMode && configRequest.RequestType != SbmWebServiceRequest.RequestType.Store) Debugger.Break();
|
||||
|
||||
// Service Request.
|
||||
@@ -374,18 +368,17 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.WebService
|
||||
/// </summary>
|
||||
public async Task<SbmWebServiceResponse> DoWebServiceRequest(RequestData requestData)
|
||||
{
|
||||
String fn = GetType().Name + ".DoWebServiceRequest";
|
||||
SbmWebServiceResponse serviceResponse = null;
|
||||
// Throw canceled exception if task has been cancelled - invoke at regular intervals.
|
||||
requestData.ThrowIfCancellationRequested();
|
||||
|
||||
// Log request.
|
||||
//if (SacsSystem.DebugMode) SaLogger.Debug(fn + " Request URL:" + requestData.InstanceDefinition.URL);
|
||||
//if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn} Request URL:" + requestData.InstanceDefinition.URL);
|
||||
if (requestData.Debug)
|
||||
{
|
||||
if (requestData.Data.Length < 512)
|
||||
SaLogger.Debug(fn + " Request:\n\t" + requestData.Data);
|
||||
else SaLogger.Debug(fn + " Request length:" + requestData.Data.Length);
|
||||
SaLogger.Debug($"{SysUtil.Fn} Request:\n\t" + requestData.Data);
|
||||
else SaLogger.Debug($"{SysUtil.Fn} Request length:" + requestData.Data.Length);
|
||||
}
|
||||
|
||||
// Configure the request.
|
||||
@@ -418,8 +411,8 @@ namespace Sarand.BusinessMgr.Net.Standard.Base.WebService
|
||||
if (requestData.Debug)
|
||||
{
|
||||
if (serviceResponse.ResponseData.Length < 1024)
|
||||
SaLogger.Debug(fn + " Response: " + serviceResponse.ResponseData);
|
||||
else SaLogger.Debug(fn + " Response size: " + serviceResponse.ResponseData.Length);
|
||||
SaLogger.Debug($"{SysUtil.Fn} Response: " + serviceResponse.ResponseData);
|
||||
else SaLogger.Debug($"{SysUtil.Fn} Response size: " + serviceResponse.ResponseData.Length);
|
||||
}
|
||||
return serviceResponse;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user