diff --git a/SacsCoreWeb/Web/Components/SaController.cs b/SacsCoreWeb/Web/Components/SaController.cs
index 4448b02..68394ea 100644
--- a/SacsCoreWeb/Web/Components/SaController.cs
+++ b/SacsCoreWeb/Web/Components/SaController.cs
@@ -319,6 +319,18 @@ namespace Sacs.Web.Components
public String Code { get; set; }
public String Desc { get; set; }
}
+ /// Statistics Caption/Value pair.
+ public class StatData : AjaxResponse_Base
+ {
+ public String Caption { get; set; }
+ public String Value { get; set; }
+ }
+ /// Statistics Group.
+ public class StatsGroupData : AjaxResponse_Base
+ {
+ public String Caption { get; set; }
+ public List Stats { get; } = new List();
+ }
//---------------------------------------------------------------
// Form data.
diff --git a/SacsStandardBase/Base/Bus/SacsHierarchyItem.cs b/SacsStandardBase/Base/Bus/SacsHierarchyItem.cs
index 0b2dc0b..c2727b1 100644
--- a/SacsStandardBase/Base/Bus/SacsHierarchyItem.cs
+++ b/SacsStandardBase/Base/Bus/SacsHierarchyItem.cs
@@ -439,15 +439,14 @@ namespace Sarand.Net.Standard.Base.Bus
// Populate data item - only once on construction.
protected void SetData(Data data)
{
- String fn = GetType().Name + ".SetData";
// Can only be replaced if currently internal class.
if (this.data.GetType() != typeof(Data))
- throw new NotSupportedException(fn + " Data object has already been specified");
+ throw new NotSupportedException($"{SysUtil.Fn} Data object has already been specified");
// If Id has already been specified (on construction) and supplied Id is not valid, set it to the existing value.
if (ItemHasId && SysId.IsValid(Id) && !SysId.IsValid(data.Id)) data.Id = Id;
// Properties that cannot be changed if previously specified.
if (ItemHasId && 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");
this.data.PopulateTo(data);
this.data = data;
}
diff --git a/SacsStandardBase/Base/Bus/SysId.cs b/SacsStandardBase/Base/Bus/SysId.cs
index 936333f..0826166 100644
--- a/SacsStandardBase/Base/Bus/SysId.cs
+++ b/SacsStandardBase/Base/Bus/SysId.cs
@@ -209,10 +209,10 @@ namespace Sarand.Net.Standard.Base.Bus
///
///
///
- public static String Concat(this List values, String delimiter, bool ignoreInvalid = true)
+ public static String Concat(this ICollection values, String delimiter, bool ignoreInvalid = true)
{
List ids = new List();
- foreach (SysId id in values.FindAll(id => !ignoreInvalid || SysId.IsValid(id)))
+ foreach (SysId id in values.Where(id => !ignoreInvalid || SysId.IsValid(id)))
ids.Add(id.ToString());
return ids.Concat(delimiter);
}
diff --git a/SacsStandardBase/Base/CodeTypes/SaCode.cs b/SacsStandardBase/Base/CodeTypes/SaCode.cs
index 84cadc0..5fa9dd0 100644
--- a/SacsStandardBase/Base/CodeTypes/SaCode.cs
+++ b/SacsStandardBase/Base/CodeTypes/SaCode.cs
@@ -162,12 +162,11 @@ namespace Sarand.Net.Standard.Base.CodeTypes
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");
if (!StringUtil.IsEmpty(Code) && !Code.Equals(data.Code))
- throw new NotSupportedException(fn + " Code cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Code cannot be changed");
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
this.data.PopulateFrom(data);
}
diff --git a/SacsStandardBase/Base/CodeTypes/SaCodeType.cs b/SacsStandardBase/Base/CodeTypes/SaCodeType.cs
index a84c87b..9256457 100644
--- a/SacsStandardBase/Base/CodeTypes/SaCodeType.cs
+++ b/SacsStandardBase/Base/CodeTypes/SaCodeType.cs
@@ -154,12 +154,11 @@ namespace Sarand.Net.Standard.Base.CodeTypes
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");
if (!StringUtil.IsEmpty(Code) && !Code.Equals(data.Code))
- throw new NotSupportedException(fn + " Code cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Code cannot be changed");
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
this.data.PopulateFrom(data);
}
diff --git a/SacsStandardBase/Base/Core/SacsDfn.cs b/SacsStandardBase/Base/Core/SacsDfn.cs
index add4020..66a16b6 100644
--- a/SacsStandardBase/Base/Core/SacsDfn.cs
+++ b/SacsStandardBase/Base/Core/SacsDfn.cs
@@ -149,6 +149,7 @@ namespace Sarand.Net.Standard.Base.Core
Bmp,
Gif,
Tif,
+ Svg,
// Documents.
Pdf,
// Text documents.
diff --git a/SacsStandardBase/Base/Email/SaEmailConsole.cs b/SacsStandardBase/Base/Email/SaEmailConsole.cs
index 8783966..880dfc1 100644
--- a/SacsStandardBase/Base/Email/SaEmailConsole.cs
+++ b/SacsStandardBase/Base/Email/SaEmailConsole.cs
@@ -26,12 +26,10 @@ namespace Sarand.Net.Standard.Base.Email
//-------------------------------------------------------------------
public bool SendEmail(SaEmailData emailData)
{
- String fn = GetType().Name + ".SendEmail";
-
// Validate email data.
if (emailData.AddressesTo.IsEmpty())
{
- SaLogger.Error(fn + " Unable to send email - To address not specified.");
+ SaLogger.Error($"{SysUtil.Fn} Unable to send email - To address not specified.");
return false;
}
@@ -54,10 +52,10 @@ namespace Sarand.Net.Standard.Base.Email
}
catch (Exception exc)
{
- SaLogger.Error(fn + " " + ExceptionUtil.GetLogMessage(exc));
+ SaLogger.Error($"{SysUtil.Fn} {ExceptionUtil.GetLogMessage(exc)}");
return false;
}
- SaLogger.Info(fn + " Email sent to " + emailData.AddressesTo[0] + ". Subject: " + emailData.Subject);
+ SaLogger.Info($"{SysUtil.Fn} Email sent to {emailData.AddressesTo[0]}. Subject: {emailData.Subject}");
return true;
}
diff --git a/SacsStandardBase/Base/Helpers/SacsContentTypeHelper.cs b/SacsStandardBase/Base/Helpers/SacsContentTypeHelper.cs
index 109d0b6..b47efa8 100644
--- a/SacsStandardBase/Base/Helpers/SacsContentTypeHelper.cs
+++ b/SacsStandardBase/Base/Helpers/SacsContentTypeHelper.cs
@@ -90,6 +90,7 @@ namespace Sarand.Net.Standard.Base.Helpers
new ContentTypeData_Internal("bmp", "Windows OS/2 Bitmap Graphics", "image/bmp", Sacs.MimeType.Bmp),
new ContentTypeData_Internal("gif", "Graphics Interchange Format (GIF)", "image/gif", Sacs.MimeType.Gif),
new ContentTypeData_Internal("tif,tiff", "Tagged Image File Format (TIFF)", "image/tiff", Sacs.MimeType.Tif),
+ new ContentTypeData_Internal("svg", "Scalable Vector Graphics (SVG)", "image/svg+xml", Sacs.MimeType.Svg),
// Documents.
new ContentTypeData_Internal("pdf", "Adobe Portable Document Format (PDF)", "application/pdf", Sacs.MimeType.Pdf),
// Text documents.
@@ -140,7 +141,6 @@ namespace Sarand.Net.Standard.Base.Helpers
new ContentTypeData_Internal("rar", "RAR archive", "application/vnd.rar"),
new ContentTypeData_Internal("rtf", "Rich Text Format (RTF)", "application/rtf"),
new ContentTypeData_Internal("sh", "Bourne shell script", "application/x-sh"),
- new ContentTypeData_Internal("svg", "Scalable Vector Graphics (SVG)", "image/svg+xml"),
new ContentTypeData_Internal("swf", "Small web format (SWF) or Adobe Flash document", "application/x-shockwave-flash"),
new ContentTypeData_Internal("tar", "Tape Archive (TAR)", "application/x-tar"),
new ContentTypeData_Internal("ts", "MPEG transport stream", "video/vnd.dlna.mpeg-tts"),
diff --git a/SacsStandardBase/Base/Interfaces/SaInterface.cs b/SacsStandardBase/Base/Interfaces/SaInterface.cs
index f8fda81..756c6b1 100644
--- a/SacsStandardBase/Base/Interfaces/SaInterface.cs
+++ b/SacsStandardBase/Base/Interfaces/SaInterface.cs
@@ -166,16 +166,15 @@ namespace Sarand.Net.Standard.Base.Interfaces
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");
if (!StringUtil.IsEmpty(Context) && !Context.Equals(data.Context))
- throw new NotSupportedException(fn + " Context cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Context cannot be changed");
if ((int)Category >= 0 && (int)Category != (int)data.Category)
- throw new NotSupportedException(fn + " Category cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Category cannot be changed");
if (Type >= 0 && Type != data.Type)
- throw new NotSupportedException(fn + " Type cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Type cannot be changed");
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
this.data.PopulateFrom(data);
}
diff --git a/SacsStandardBase/Base/Interfaces/SaInterfaceDataItem.cs b/SacsStandardBase/Base/Interfaces/SaInterfaceDataItem.cs
index 1752565..bed02c2 100644
--- a/SacsStandardBase/Base/Interfaces/SaInterfaceDataItem.cs
+++ b/SacsStandardBase/Base/Interfaces/SaInterfaceDataItem.cs
@@ -253,20 +253,19 @@ namespace Sarand.Net.Standard.Base.Interfaces
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");
if (SysId.IsValid(InterfaceId) && SysId.ToInt(InterfaceId) != SysId.ToInt(data.InterfaceId))
- throw new NotSupportedException(fn + " Interface cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Interface cannot be changed");
if ((int)Direction > 0 && (int)Direction != (int)data.Direction)
- throw new NotSupportedException(fn + " Direction cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Direction cannot be changed");
if (ItemId.Type >= 0 && ItemId.Type != data.ItemId.Type)
- throw new NotSupportedException(fn + " Item type cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Item type cannot be changed");
if (SysId.IsValid(ItemId.Id) && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
- throw new NotSupportedException(fn + " Item Id cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Item Id cannot be changed");
if (!StringUtil.IsEmpty(ExternalReference) && !ExternalReference.Equals(data.ExternalReference))
- throw new NotSupportedException(fn + " External reference cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} External reference cannot be changed");
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
this.data.PopulateFrom(data);
}
diff --git a/SacsStandardBase/Base/Interfaces/SaInterfaceProcess.cs b/SacsStandardBase/Base/Interfaces/SaInterfaceProcess.cs
index f7ec594..e79e03f 100644
--- a/SacsStandardBase/Base/Interfaces/SaInterfaceProcess.cs
+++ b/SacsStandardBase/Base/Interfaces/SaInterfaceProcess.cs
@@ -203,18 +203,17 @@ namespace Sarand.Net.Standard.Base.Interfaces
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");
if (SysId.IsValid(InterfaceId) && SysId.ToInt(InterfaceId) != SysId.ToInt(data.InterfaceId))
- throw new NotSupportedException(fn + " Interface cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Interface cannot be changed");
if ((int)Direction > 0 && (int)Direction != (int)data.Direction)
- throw new NotSupportedException(fn + " Direction cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Direction cannot be changed");
if (!StringUtil.IsEmpty(Reference) && !Reference.Equals(data.Reference))
- throw new NotSupportedException(fn + " Reference cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Reference cannot be changed");
if (Sequence > 0 && Sequence != data.Sequence)
- throw new NotSupportedException(fn + " Sequence cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Sequence cannot be changed");
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
this.data.PopulateFrom(data);
}
diff --git a/SacsStandardBase/Base/Interfaces/SaInterfaceProcessDataItem.cs b/SacsStandardBase/Base/Interfaces/SaInterfaceProcessDataItem.cs
index 63466b6..0b8488f 100644
--- a/SacsStandardBase/Base/Interfaces/SaInterfaceProcessDataItem.cs
+++ b/SacsStandardBase/Base/Interfaces/SaInterfaceProcessDataItem.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
+using Sarand.Net.Standard.Base.Utils;
namespace Sarand.Net.Standard.Base.Interfaces
{
@@ -137,16 +138,15 @@ namespace Sarand.Net.Standard.Base.Interfaces
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");
if (SysId.IsValid(InterfaceProcessId) && SysId.ToInt(InterfaceProcessId) != SysId.ToInt(data.InterfaceProcessId))
- throw new NotSupportedException(fn + " Interface Process cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Interface Process cannot be changed");
if (ItemId.Type >= 0 && ItemId.Type != data.ItemId.Type)
- throw new NotSupportedException(fn + " Item type cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Item type cannot be changed");
if (SysId.IsValid(ItemId.Id) && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
- 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);
}
diff --git a/SacsStandardBase/Base/Interfaces/SaInterfaceProcessMessage.cs b/SacsStandardBase/Base/Interfaces/SaInterfaceProcessMessage.cs
index 5623a7f..efdc767 100644
--- a/SacsStandardBase/Base/Interfaces/SaInterfaceProcessMessage.cs
+++ b/SacsStandardBase/Base/Interfaces/SaInterfaceProcessMessage.cs
@@ -1,5 +1,6 @@
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
+using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
@@ -163,12 +164,11 @@ namespace Sarand.Net.Standard.Base.Interfaces
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");
if (SysId.IsValid(InterfaceProcessId) && SysId.ToInt(InterfaceProcessId) != SysId.ToInt(data.InterfaceProcessId))
- 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);
}
diff --git a/SacsStandardBase/Base/ItemData/SaItemData.cs b/SacsStandardBase/Base/ItemData/SaItemData.cs
index 24bcec3..f667791 100644
--- a/SacsStandardBase/Base/ItemData/SaItemData.cs
+++ b/SacsStandardBase/Base/ItemData/SaItemData.cs
@@ -132,12 +132,11 @@ namespace Sarand.Net.Standard.Base.ItemData
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 (ItemId.Type >= 0 && ItemId.Type != data.ItemId.Type)
- throw new NotSupportedException(fn + " Item type cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Item type cannot be changed");
if (SysId.IsValid(ItemId.Id) && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
- 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);
}
diff --git a/SacsStandardBase/Base/ItemDocs/SaItemDoc.cs b/SacsStandardBase/Base/ItemDocs/SaItemDoc.cs
index a621a88..eb866d2 100644
--- a/SacsStandardBase/Base/ItemDocs/SaItemDoc.cs
+++ b/SacsStandardBase/Base/ItemDocs/SaItemDoc.cs
@@ -180,17 +180,16 @@ namespace Sarand.Net.Standard.Base.ItemDocs
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 (ItemId.Type >= 0 && ItemId.Type != data.ItemId.Type)
- throw new NotSupportedException(fn + " Item type cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Item type cannot be changed");
if (SysId.IsValid(ItemId.Id) && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
- throw new NotSupportedException(fn + " Item Id cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Item Id cannot be changed");
// Category.
if ((int)data.Category < 1)
data.Category = Category;
if ((int)Category != 0 && Category != data.Category)
- throw new NotSupportedException(fn + " Category cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Category cannot be changed");
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
this.data.PopulateFrom(data);
}
diff --git a/SacsStandardBase/Base/ItemOptions/SaItemOption.cs b/SacsStandardBase/Base/ItemOptions/SaItemOption.cs
index 0647008..b427741 100644
--- a/SacsStandardBase/Base/ItemOptions/SaItemOption.cs
+++ b/SacsStandardBase/Base/ItemOptions/SaItemOption.cs
@@ -153,16 +153,15 @@ namespace Sarand.Net.Standard.Base.ItemOptions
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 (ItemId.Type >= 0 && ItemId.Type != data.ItemId.Type)
- throw new NotSupportedException(fn + " Item type cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Item type cannot be changed");
if (SysId.IsValid(ItemId.Id) && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
- throw new NotSupportedException(fn + " Item Id cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Item Id cannot be changed");
if (!StringUtil.IsEmpty(Name) && !Name.Equals(data.Name))
- throw new NotSupportedException(fn + " Name cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Name cannot be changed");
if (!StringUtil.IsEmpty(Context) && !Context.Equals(data.Context))
- throw new NotSupportedException(fn + " Context cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Context cannot be changed");
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
this.data.PopulateFrom(data);
}
diff --git a/SacsStandardBase/Base/Procs/SaProcess_Base.cs b/SacsStandardBase/Base/Procs/SaProcess_Base.cs
index 0d2f073..391d5da 100644
--- a/SacsStandardBase/Base/Procs/SaProcess_Base.cs
+++ b/SacsStandardBase/Base/Procs/SaProcess_Base.cs
@@ -294,7 +294,6 @@ namespace Sarand.Net.Standard.Base.Procs
// Run process inline.
public bool RunProcess()
{
- String fn = GetType().Name + ".RunProcess";
// Prepare process.
bool runProcess = false;
Reset();
@@ -313,7 +312,7 @@ namespace Sarand.Net.Standard.Base.Procs
{
String msg = exc.GetType().Name + ": " + exc.Message;
AddErrorMessage(msg);
- SaLogger.Error(fn + " ProcessStarting: " + msg + exc.GetStackEntries(6).Concat("", "\n\tat "), true);
+ SaLogger.Error($"{SysUtil.Fn} ProcessStarting: {msg}{exc.GetStackEntries(6).Concat("", "\n\tat ")}", true);
}
// Process running.
@@ -326,7 +325,7 @@ namespace Sarand.Net.Standard.Base.Procs
{
String msg = exc.GetType().Name + ": " + exc.Message;
AddErrorMessage(msg);
- SaLogger.Error(fn + " " + msg + exc.GetStackEntries(6).Concat("", "\n\tat "), true);
+ SaLogger.Error($"{SysUtil.Fn} " + msg + exc.GetStackEntries(6).Concat("", "\n\tat "), true);
}
finally
{
@@ -347,7 +346,7 @@ namespace Sarand.Net.Standard.Base.Procs
{
String msg = exc.GetType().Name + ": " + exc.Message;
AddErrorMessage(msg);
- SaLogger.Error(fn + " ProcessCompleted: " + msg + exc.GetStackEntries(6).Concat("", "\n\tat "), true);
+ SaLogger.Error($"{SysUtil.Fn} ProcessCompleted: {msg}{exc.GetStackEntries(6).Concat("", "\n\tat ")}", true);
}
return runProcess;
}
diff --git a/SacsStandardBase/Base/ReferenceData/SaCurrency.cs b/SacsStandardBase/Base/ReferenceData/SaCurrency.cs
index cd5e7ec..ab88476 100644
--- a/SacsStandardBase/Base/ReferenceData/SaCurrency.cs
+++ b/SacsStandardBase/Base/ReferenceData/SaCurrency.cs
@@ -186,10 +186,9 @@ namespace Sarand.Net.Standard.Base.ReferenceData
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);
}
diff --git a/SacsStandardBase/Base/ReferenceData/SaLanguage.cs b/SacsStandardBase/Base/ReferenceData/SaLanguage.cs
index 568ca83..bcf8dba 100644
--- a/SacsStandardBase/Base/ReferenceData/SaLanguage.cs
+++ b/SacsStandardBase/Base/ReferenceData/SaLanguage.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Sarand.Net.Standard.Base.Bus;
+using Sarand.Net.Standard.Base.Utils;
namespace Sarand.Net.Standard.Base.ReferenceData
{
@@ -130,10 +131,9 @@ namespace Sarand.Net.Standard.Base.ReferenceData
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);
}
diff --git a/SacsStandardBase/Base/ReferenceData/SaRegion.cs b/SacsStandardBase/Base/ReferenceData/SaRegion.cs
index e93b81a..3cdd93d 100644
--- a/SacsStandardBase/Base/ReferenceData/SaRegion.cs
+++ b/SacsStandardBase/Base/ReferenceData/SaRegion.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Bus;
+using Sarand.Net.Standard.Base.Utils;
namespace Sarand.Net.Standard.Base.ReferenceData
{
@@ -131,10 +132,9 @@ namespace Sarand.Net.Standard.Base.ReferenceData
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");
this.data.PopulateFrom(data);
}
diff --git a/SacsStandardBase/Base/ReferenceData/SaTaxCode.cs b/SacsStandardBase/Base/ReferenceData/SaTaxCode.cs
index 6ce4aac..dd48cd2 100644
--- a/SacsStandardBase/Base/ReferenceData/SaTaxCode.cs
+++ b/SacsStandardBase/Base/ReferenceData/SaTaxCode.cs
@@ -197,12 +197,11 @@ namespace Sarand.Net.Standard.Base.ReferenceData
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");
if (!StringUtil.IsEmpty(Code) && !Code.EqualsCI(data.Code))
- throw new NotSupportedException(fn + " Code cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Code cannot be changed");
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
this.data.PopulateFrom(data);
}
diff --git a/SacsStandardBase/Base/ReferenceData/SaUnitMeasure.cs b/SacsStandardBase/Base/ReferenceData/SaUnitMeasure.cs
index b41e731..16156ea 100644
--- a/SacsStandardBase/Base/ReferenceData/SaUnitMeasure.cs
+++ b/SacsStandardBase/Base/ReferenceData/SaUnitMeasure.cs
@@ -214,12 +214,11 @@ namespace Sarand.Net.Standard.Base.ReferenceData
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");
if (!StringUtil.IsEmpty(Code) && !Code.EqualsCI(data.Code))
- throw new NotSupportedException(fn + " Codecannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Codecannot be changed");
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
this.data.PopulateFrom(data);
}
diff --git a/SacsStandardBase/Base/Security/SaSecurityItem.cs b/SacsStandardBase/Base/Security/SaSecurityItem.cs
index 86cfb9b..02da350 100644
--- a/SacsStandardBase/Base/Security/SaSecurityItem.cs
+++ b/SacsStandardBase/Base/Security/SaSecurityItem.cs
@@ -257,12 +257,11 @@ namespace Sarand.Net.Standard.Base.Security
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");
if ((int)data.ItemType > 0 && data.ItemType != ItemType)
- throw new NotSupportedException(fn + " Item Type cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Item Type cannot be changed");
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
this.data.PopulateFrom(data);
}
@@ -371,8 +370,6 @@ namespace Sarand.Net.Standard.Base.Security
}
public static String EncryptPassword (String password)
{
- //String fn = "SaSecurityItem.EncryptPassword";
-
// We know this is not very water-tight, but it at least
// hides the contents of the password from prying eyes.
String toBeEncrypted = password;
diff --git a/SacsStandardBase/Base/Security/SaSecurityLink.cs b/SacsStandardBase/Base/Security/SaSecurityLink.cs
index e27fb2a..06514b9 100644
--- a/SacsStandardBase/Base/Security/SaSecurityLink.cs
+++ b/SacsStandardBase/Base/Security/SaSecurityLink.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Bus;
+using Sarand.Net.Standard.Base.Utils;
namespace Sarand.Net.Standard.Base.Security
{
@@ -165,14 +166,13 @@ namespace Sarand.Net.Standard.Base.Security
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(data.Id))
- throw new NotSupportedException(fn + " Id is not applicable for security links");
+ throw new NotSupportedException($"{SysUtil.Fn} Id is not applicable for security links");
if (SysId.IsValid(data.ItemIdOwner) && SysId.ToInt(data.ItemIdOwner) != SysId.ToInt(ItemIdOwner))
- throw new NotSupportedException(fn + " Owner Item cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Owner Item cannot be changed");
if (SysId.IsValid(data.ItemIdTarget) && SysId.ToInt(data.ItemIdTarget) != SysId.ToInt(ItemIdTarget))
- throw new NotSupportedException(fn + " Target Item cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Target Item cannot be changed");
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
this.data.PopulateFrom(data);
}
diff --git a/SacsStandardBase/Base/UpdateLog/SaUpdateLogEntry.cs b/SacsStandardBase/Base/UpdateLog/SaUpdateLogEntry.cs
index 6f86301..1443681 100644
--- a/SacsStandardBase/Base/UpdateLog/SaUpdateLogEntry.cs
+++ b/SacsStandardBase/Base/UpdateLog/SaUpdateLogEntry.cs
@@ -159,16 +159,15 @@ namespace Sarand.Net.Standard.Base.UpdateLog
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 (ItemId.Type >= 0 && ItemId.Type != data.ItemId.Type)
- throw new NotSupportedException(fn + " Item type cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Item type cannot be changed");
if (SysId.IsValid(ItemId.Id) && SysId.ToInt(ItemId.Id) != SysId.ToInt(data.ItemId.Id))
- throw new NotSupportedException(fn + " Item Id cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Item Id cannot be changed");
if (!StringUtil.IsEmpty(Attribute) && !Attribute.Equals(data.Attribute))
- throw new NotSupportedException(fn + " Attribute cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Attribute cannot be changed");
if (Logged != DateTime.MinValue && !Logged.Equals(data.Logged))
- throw new NotSupportedException(fn + " Logged date/time cannot be changed");
+ throw new NotSupportedException($"{SysUtil.Fn} Logged date/time cannot be changed");
// Populate individual properties to ensure that 'Changed' indicator is kept up to date.
this.data.PopulateFrom(data);
}
diff --git a/SacsStandardBase/Base/Utils/DictionaryUtil.cs b/SacsStandardBase/Base/Utils/DictionaryUtil.cs
index fc1cf9a..83a9ac1 100644
--- a/SacsStandardBase/Base/Utils/DictionaryUtil.cs
+++ b/SacsStandardBase/Base/Utils/DictionaryUtil.cs
@@ -79,7 +79,7 @@ namespace Sarand.Net.Standard.Base.Utils
/// Add entries from another dictionary.
public static void AddRange(this Dictionary dict, Dictionary dictToAdd)
{
- dictToAdd.ForEach(x => dict.Add(x.Key, x.Value));
+ dictToAdd.ForEach(x => dict[x.Key] = x.Value);
}
//-------------------------------------------------------------------
diff --git a/SacsStandardBase/Base/Utils/ImageUtils.cs b/SacsStandardBase/Base/Utils/ImageUtils.cs
index 8c4772d..1e51524 100644
--- a/SacsStandardBase/Base/Utils/ImageUtils.cs
+++ b/SacsStandardBase/Base/Utils/ImageUtils.cs
@@ -9,6 +9,7 @@ using SixLabors.ImageSharp.Processing;
using System;
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using System.Text;
namespace Sarand.Net.Standard.Base.Utils
@@ -33,6 +34,21 @@ namespace Sarand.Net.Standard.Base.Utils
public int Height { get; set; }
}
+ //-------------------------------------------------------------------
+ public static bool IsSvg(byte[] imageData)
+ {
+ try
+ {
+ if (!imageData.Contains((byte)'<')) return false;
+ String imageText = Encoding.UTF8.GetString(imageData);
+ if (!imageText.ContainsCI("