BusinessMgr 3.0.0.1
This commit is contained in:
@@ -72,7 +72,7 @@ namespace Sacs.Web.Components
|
||||
get
|
||||
{
|
||||
var feature = HttpContext.Features.Get<IRequestCultureFeature>();
|
||||
return feature.RequestCulture.UICulture.TwoLetterISOLanguageName.ToLower();
|
||||
return feature.RequestCulture.UICulture.TwoLetterISOLanguageName.ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,11 +91,12 @@ namespace Sacs.Web.Components
|
||||
{
|
||||
string protocol = Request.Scheme;
|
||||
var parameters = new RouteValueDictionary();
|
||||
String baseAction = Url.Action("Index", "", parameters, protocol);
|
||||
String homeAction = Url.Action("Index", "Home", parameters, protocol);
|
||||
switch (redirectLocation)
|
||||
{
|
||||
case RedirectLocation.WebAppBase:
|
||||
return Regex.Replace(homeAction, "\\/$", "") + "/";
|
||||
return baseAction;
|
||||
case RedirectLocation.WebAppHome:
|
||||
return homeAction;
|
||||
case RedirectLocation.WebAppHome_SessionExpired:
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace Sarand.Net.Standard.Accounts.QuickBooks.Base
|
||||
// Only 1 item expected.
|
||||
if (item1 != null) item1.Dispose(); item1 = null;
|
||||
if (item2 != null) item2.Dispose(); item2 = null;
|
||||
SetErrorState("Multiple items found");
|
||||
SetErrorState(SacsItemMgr.Msg_MultipleItemsFound);
|
||||
}
|
||||
return item1;
|
||||
}
|
||||
|
||||
@@ -8665,7 +8665,7 @@ namespace Sarand.Net.Standard.Accounts.QuickBooks.Dbas
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
private static readonly HashSet<String> reservedWords = new HashSet<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Sarand.Net.Standard.Accounts.QuickBooks.Online
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -274,6 +274,17 @@ namespace Sarand.Net.Standard.Base.Bus
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void CheckChanged(Guid oldValue, Guid newValue)
|
||||
{
|
||||
CheckChangedNullable(oldValue, newValue);
|
||||
}
|
||||
protected void CheckChangedNullable(Guid? oldValue, Guid? newValue)
|
||||
{
|
||||
if (Changed) return;
|
||||
if ((oldValue == null) != (newValue == null)) Changed = true;
|
||||
else if (oldValue != null && newValue != null)
|
||||
Changed = !oldValue.Equals(newValue);
|
||||
}
|
||||
protected void CheckChanged(byte[] oldValue, byte[] newValue)
|
||||
{
|
||||
if (Changed) return;
|
||||
|
||||
@@ -16,8 +16,13 @@ namespace Sarand.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
public const String Msg_DatabaseNotAvailable = "database is not available";
|
||||
public const String Msg_DatabaseNotAvailable = "Database is not available";
|
||||
public const String Msg_DatabaseQueryException = "Database query exception";
|
||||
public const String Msg_ItemNotSpecified = "Item not specified";
|
||||
public const String Msg_ItemIdNotSpecified = "Item Id must be specified";
|
||||
public const String Msg_ItemTypeNotSpecified = "Item type must be specified";
|
||||
public const String Msg_InvalidItemSpecified = "Invalid item specified";
|
||||
public const String Msg_MultipleItemsFound = "Multiple items found";
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Static initialisation.
|
||||
|
||||
@@ -180,12 +180,22 @@ namespace Sarand.Net.Standard.Base.Bus
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Populate list.
|
||||
/// <summary>
|
||||
/// Add the Id to the list.
|
||||
/// <para>- Option to ignore invalid Id. [default: true]</para>
|
||||
/// <para>- Option to ignore duplicate Id. [default: true]</para>
|
||||
/// </summary>
|
||||
public static void AddId(this ICollection<SysId> values, SysId sysId, bool ignoreInvalid = true, bool ignoreDuplicates = true)
|
||||
{
|
||||
if (ignoreInvalid && !SysId.IsValid(sysId)) return;
|
||||
if (ignoreDuplicates && values.Contains(sysId)) return;
|
||||
values.Add(sysId);
|
||||
}
|
||||
/// <summary>
|
||||
/// Add the Ids to the list.
|
||||
/// <para>- Option to ignore invalid Ids. [default: true]</para>
|
||||
/// <para>- Option to ignore duplicate Ids. [default: true]</para>
|
||||
/// </summary>
|
||||
public static void AddIds(this ICollection<SysId> values, IEnumerable<SysId> sysIds, bool ignoreInvalid = true, bool ignoreDuplicates = true)
|
||||
{
|
||||
foreach (SysId id in sysIds)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
@@ -5,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:33
|
||||
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:21
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.Net.Standard.Base.CodeTypes
|
||||
{
|
||||
@@ -61,7 +62,7 @@ namespace Sarand.Net.Standard.Base.CodeTypes
|
||||
// Data members.
|
||||
private static readonly int tableCount = 2;
|
||||
private static readonly int columnCount = 30;
|
||||
private static ulong maxTextLen = 0;
|
||||
public static ulong MaxTextLen { get; private set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve Table details (eg. name: 'Company').
|
||||
@@ -69,14 +70,31 @@ namespace Sarand.Net.Standard.Base.CodeTypes
|
||||
{
|
||||
return tableCount;
|
||||
}
|
||||
public static String GetSchemaName (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String schemaName = tables[(int)tableIdx].Schema;
|
||||
if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); }
|
||||
return schemaName;
|
||||
}
|
||||
public static String GetTableName (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
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.
|
||||
@@ -126,8 +144,15 @@ namespace Sarand.Net.Standard.Base.CodeTypes
|
||||
}
|
||||
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;
|
||||
@@ -158,7 +183,7 @@ namespace Sarand.Net.Standard.Base.CodeTypes
|
||||
}
|
||||
public static void SetMaxTextLen (ulong maxTextLen)
|
||||
{
|
||||
SaCodeTypeDbDfn.maxTextLen = maxTextLen;
|
||||
SaCodeTypeDbDfn.MaxTextLen = maxTextLen;
|
||||
}
|
||||
public static bool IsColFmtText (ColumnIdx column)
|
||||
{
|
||||
@@ -173,7 +198,7 @@ namespace Sarand.Net.Standard.Base.CodeTypes
|
||||
if (columns[columnIdx].DataType == DbColumnDataType.VarChar)
|
||||
{
|
||||
ulong textLen = columns[columnIdx].DataLen;
|
||||
if (maxTextLen > 0 && textLen > maxTextLen) textLen = maxTextLen;
|
||||
if (MaxTextLen > 0 && textLen > MaxTextLen) textLen = MaxTextLen;
|
||||
return textLen;
|
||||
}
|
||||
return 0;
|
||||
@@ -204,15 +229,25 @@ namespace Sarand.Net.Standard.Base.CodeTypes
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table definitions.
|
||||
private static readonly String[] tables =
|
||||
private class TableDfn
|
||||
{
|
||||
"SaCode",
|
||||
"SaCodeType",
|
||||
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","SaCode"),
|
||||
new TableDfn("dbo","SaCodeType"),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table column definitions.
|
||||
internal class ColumnDfn
|
||||
private class ColumnDfn
|
||||
{
|
||||
internal TableIdx TableIdx { get; set; }
|
||||
internal String Name { get; set; }
|
||||
@@ -230,8 +265,6 @@ namespace Sarand.Net.Standard.Base.CodeTypes
|
||||
this.DataLen = dataLen;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private static readonly ColumnDfn[] columns =
|
||||
{
|
||||
new ColumnDfn(1,"Id",4,4,false,10),
|
||||
@@ -268,7 +301,7 @@ namespace Sarand.Net.Standard.Base.CodeTypes
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
private static readonly HashSet<String> reservedWords = new HashSet<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Sarand.Net.Standard.Base.Core
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Definitions.
|
||||
public enum DataType { Unknown = 0, Bool, TriState, Long, Double, Decimal, String, Date, Time, DateTime, Blob };
|
||||
public enum DataType { Unknown = 0, Bool, TriState, Long, Double, Decimal, String, Date, Time, DateTime, Guid, Blob };
|
||||
public enum TriStateType { Unknown = 0, Red, Amber, Green, Blue, Purple, Yellow };
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -74,6 +74,11 @@ namespace Sarand.Net.Standard.Base.Core
|
||||
break;
|
||||
}
|
||||
}
|
||||
public DataValue(Guid value)
|
||||
{
|
||||
this.value = value;
|
||||
this.dataType = DataType.Guid;
|
||||
}
|
||||
public DataValue(Byte[] value)
|
||||
{
|
||||
this.value = value;
|
||||
@@ -101,6 +106,7 @@ namespace Sarand.Net.Standard.Base.Core
|
||||
case DataType.Date: return "Date";
|
||||
case DataType.Time: return "Time";
|
||||
case DataType.DateTime: return "DateTime";
|
||||
case DataType.Guid: return "Guid";
|
||||
case DataType.Blob: return "Blob";
|
||||
}
|
||||
return "<Unknown>";
|
||||
@@ -129,6 +135,10 @@ namespace Sarand.Net.Standard.Base.Core
|
||||
{
|
||||
return (dataType == DataType.Date || dataType == DataType.Time || dataType == DataType.DateTime);
|
||||
}
|
||||
public bool IsGuid()
|
||||
{
|
||||
return (dataType == DataType.Guid);
|
||||
}
|
||||
public bool IsBlob()
|
||||
{
|
||||
return (dataType == DataType.Blob);
|
||||
@@ -281,6 +291,13 @@ namespace Sarand.Net.Standard.Base.Core
|
||||
if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn} Incorrect data type: {dataType.ToString()}.");
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
public Guid AsGuid()
|
||||
{
|
||||
if (dataType == DataType.Guid) return (Guid)value;
|
||||
if (dataType == DataType.Unknown) return default(Guid);
|
||||
if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn} Incorrect data type: {dataType.ToString()}.");
|
||||
return default(Guid);
|
||||
}
|
||||
public Byte[] AsBlob()
|
||||
{
|
||||
if (dataType == DataType.Blob) return (Byte[])value;
|
||||
|
||||
@@ -29,6 +29,11 @@ namespace Sarand.Net.Standard.Base.Core
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Poperties.
|
||||
|
||||
/// <summary>OK - No error state message.</summary>
|
||||
public bool OK { get { return !HasErrorState(); } }
|
||||
|
||||
// Error state.
|
||||
public SacsErrorState ErrorState { get; private set; }
|
||||
public bool HasErrorState()
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Sarand.Net.Standard.Base.Core
|
||||
public static class StringPairList
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
public static List<StringPair> CreateFrom (List<String> valuesToAdd, bool duplicateAsS2 = false)
|
||||
public static List<StringPair> CreateFrom(IEnumerable<String> valuesToAdd, bool duplicateAsS2 = false)
|
||||
{
|
||||
List<StringPair> values = new List<StringPair>();
|
||||
foreach (String valueToAdd in valuesToAdd)
|
||||
@@ -68,7 +68,7 @@ namespace Sarand.Net.Standard.Base.Core
|
||||
{
|
||||
values.Add(new StringPair(s1, s2));
|
||||
}
|
||||
public static void AddRange (this List<StringPair> values, List<String> valuesToAdd, bool duplicateAsS2 = false)
|
||||
public static void AddRange(this List<StringPair> values, IEnumerable<String> valuesToAdd, bool duplicateAsS2 = false)
|
||||
{
|
||||
values.AddRange(CreateFrom(valuesToAdd, duplicateAsS2));
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
Double, // SQL_C_DOUBLE,
|
||||
Decimal, // SQL_DECIMAL?,
|
||||
DateTime, // SQL_C_TYPE_TIMESTAMP
|
||||
Guid,
|
||||
Binary,
|
||||
};
|
||||
//[Serializable()]
|
||||
@@ -126,6 +127,8 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
return "Decimal";
|
||||
case DbColumnDataType.DateTime:
|
||||
return "DateTime";
|
||||
case DbColumnDataType.Guid:
|
||||
return "Guid";
|
||||
case DbColumnDataType.Binary:
|
||||
return "Byte[]";
|
||||
}
|
||||
@@ -159,6 +162,8 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
return "0.0m";
|
||||
case DbColumnDataType.DateTime:
|
||||
return "DateTime.MinValue";
|
||||
case DbColumnDataType.Guid:
|
||||
return "default(Guid)";
|
||||
case DbColumnDataType.Binary:
|
||||
return "null";
|
||||
}
|
||||
@@ -183,6 +188,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
case DbColumnDataType.Double:
|
||||
case DbColumnDataType.Decimal:
|
||||
case DbColumnDataType.DateTime:
|
||||
case DbColumnDataType.Guid:
|
||||
return GetVariableType();
|
||||
case DbColumnDataType.Binary:
|
||||
return "ByteArray";
|
||||
@@ -196,7 +202,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
public static class DbDfnColumnList
|
||||
{
|
||||
// List of column names.
|
||||
public static List<String> GetNames(this List<DbDfnColumn> columns)
|
||||
public static List<String> GetNames(this IEnumerable<DbDfnColumn> columns)
|
||||
{
|
||||
List<String> names = new List<String>();
|
||||
foreach (var column in columns)
|
||||
@@ -206,7 +212,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
return names;
|
||||
}
|
||||
// Identity column.
|
||||
public static String GetIdentityColumnName(this List<DbDfnColumn> columns)
|
||||
public static String GetIdentityColumnName(this IEnumerable<DbDfnColumn> columns)
|
||||
{
|
||||
List<String> names = new List<String>();
|
||||
foreach (var column in columns)
|
||||
@@ -216,7 +222,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
}
|
||||
return String.Empty;
|
||||
}
|
||||
public static String GetIdentityColumnVariableTypeName(this List<DbDfnColumn> columns)
|
||||
public static String GetIdentityColumnVariableTypeName(this IEnumerable<DbDfnColumn> columns)
|
||||
{
|
||||
List<String> names = new List<String>();
|
||||
foreach (var column in columns)
|
||||
@@ -228,7 +234,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
}
|
||||
|
||||
// Locate the column in the list:
|
||||
public static DbDfnColumn GetColumnByPos(this List<DbDfnColumn> columns, short pos)
|
||||
public static DbDfnColumn GetColumnByPos(this IEnumerable<DbDfnColumn> columns, short pos)
|
||||
{
|
||||
foreach (var column in columns)
|
||||
{
|
||||
@@ -237,7 +243,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static DbDfnColumn GetColumnByName(this List<DbDfnColumn> columns, String name)
|
||||
public static DbDfnColumn GetColumnByName(this IEnumerable<DbDfnColumn> columns, String name)
|
||||
{
|
||||
foreach (var column in columns)
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
public static class DbDfnIndexList
|
||||
{
|
||||
// List of index names.
|
||||
public static List<String> GetNames (this List<DbDfnIndex> indices)
|
||||
public static List<String> GetNames(this IEnumerable<DbDfnIndex> indices)
|
||||
{
|
||||
List<String> names = new List<String>();
|
||||
foreach (var index in indices)
|
||||
@@ -98,21 +98,21 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
return names;
|
||||
}
|
||||
// Locate the index in the list.
|
||||
public static DbDfnIndex GetIndexByName (this List<DbDfnIndex> indices, String name)
|
||||
public static DbDfnIndex GetIndexByName(this IEnumerable<DbDfnIndex> indices, String name)
|
||||
{
|
||||
return indices.Find(idx => idx.Name.EqualsCI(name));
|
||||
return indices.FirstOrDefault(idx => idx.Name.EqualsCI(name));
|
||||
}
|
||||
// Retrieve primary index.
|
||||
public static DbDfnIndex GetPrimaryIndex (this List<DbDfnIndex> indices)
|
||||
public static DbDfnIndex GetPrimaryIndex(this IEnumerable<DbDfnIndex> indices)
|
||||
{
|
||||
return indices.Find(idx => idx.Primary);
|
||||
return indices.FirstOrDefault(idx => idx.Primary);
|
||||
}
|
||||
// Retrieve clustered index.
|
||||
public static DbDfnIndex GetClusteredIndex (this List<DbDfnIndex> indices)
|
||||
public static DbDfnIndex GetClusteredIndex(this IEnumerable<DbDfnIndex> indices)
|
||||
{
|
||||
DbDfnIndex index = indices.Find(idx => idx.Clustered);
|
||||
DbDfnIndex index = indices.FirstOrDefault(idx => idx.Clustered);
|
||||
if (index == null)
|
||||
index = indices.Find(idx => idx.IndexType == DbDfnIndex.SQL_INDEX_CLUSTERED);
|
||||
index = indices.FirstOrDefault(idx => idx.IndexType == DbDfnIndex.SQL_INDEX_CLUSTERED);
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Comparison.
|
||||
public bool Matches(DbDfnTable table)
|
||||
{
|
||||
return (this.Schema.EqualsCI(table.Schema) && this.Name.EqualsCI(table.Name));
|
||||
}
|
||||
public bool MatchesSchemaName(String schema, String name)
|
||||
{
|
||||
return (this.Schema.EqualsCI(schema) && this.Name.EqualsCI(name));
|
||||
@@ -53,7 +57,8 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
}
|
||||
public bool HasColumns()
|
||||
{
|
||||
return ColumnCount > 0;
|
||||
lock (columns)
|
||||
return columns.Any();
|
||||
}
|
||||
public int ColumnCount
|
||||
{
|
||||
@@ -110,7 +115,8 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
}
|
||||
public bool HasIndices()
|
||||
{
|
||||
return IndexCount > 0;
|
||||
lock (indices)
|
||||
return indices.Any();
|
||||
}
|
||||
public int IndexCount
|
||||
{
|
||||
@@ -157,7 +163,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>List of table names.</summary>
|
||||
public static List<String> GetNames(this List<DbDfnTable> tables)
|
||||
public static List<String> GetNames(this IEnumerable<DbDfnTable> tables)
|
||||
{
|
||||
List<String> names = new List<String>();
|
||||
foreach (DbDfnTable table in tables)
|
||||
@@ -169,7 +175,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Extract the table definition by schema and table name.</summary>
|
||||
public static DbDfnTable GetTableBySchemaName(this List<DbDfnTable> tables, String schema, String name)
|
||||
public static DbDfnTable GetTableBySchemaName(this IEnumerable<DbDfnTable> tables, String schema, String name)
|
||||
{
|
||||
foreach (DbDfnTable table in tables)
|
||||
{
|
||||
@@ -179,7 +185,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
return null;
|
||||
}
|
||||
/// <summary>Extract the table definition by table name.</summary>
|
||||
public static DbDfnTable GetTableByName(this List<DbDfnTable> tables, String name)
|
||||
public static DbDfnTable GetTableByName(this IEnumerable<DbDfnTable> tables, String name)
|
||||
{
|
||||
foreach (DbDfnTable table in tables)
|
||||
{
|
||||
@@ -191,7 +197,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>Get total number of columns for all tables.</summary>
|
||||
public static int GetColumnCount(this List<DbDfnTable> tables)
|
||||
public static int GetColumnCount(this IEnumerable<DbDfnTable> tables)
|
||||
{
|
||||
int columnCount = 0;
|
||||
foreach (DbDfnTable table in tables)
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
public abstract decimal GetDecimal(int columnIdx);
|
||||
public abstract String GetString(int columnIdx);
|
||||
public abstract DateTime GetDateTime(int columnIdx);
|
||||
public abstract Guid GetGuid(int columnIdx);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Field Value.
|
||||
@@ -125,6 +126,9 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
case "SmallDateTime":
|
||||
dataValue = new DataValue(GetDateTime(columnIdx));
|
||||
break;
|
||||
case "UniqueIdentifier":
|
||||
dataValue = new DataValue(GetGuid(columnIdx));
|
||||
break;
|
||||
default:
|
||||
SaLogger.Warn(fn + " Unrecognised data type '" + columnDataType + "' for column '" + GetName(columnIdx) + "'");
|
||||
break;
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Database schema.
|
||||
List<String> GetTableNames(bool refresh = false);
|
||||
HashSet<String> GetTableNames(bool refresh = false);
|
||||
List<DbDfnTable> GetTableDfns(bool refresh = false);
|
||||
DbDfnTable GetTableDfn(String name, bool refresh = false);
|
||||
bool TableExists(String tableName);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
@@ -39,7 +40,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
/// <returns>the name of an ODBC driver for Microsoft SQL Server, if one is present; null, otherwise.</returns>
|
||||
public static string GetOdbcSqlDriverName()
|
||||
{
|
||||
List<string> driverPrecedence = new List<string>() { "ODBC Driver 17 for SQL Server", "ODBC Driver 13 for SQL Server", "ODBC Driver 11 for SQL Server", "SQL Server Native Client 11.0", "SQL Server Native Client 10.0", "SQL Server Native Client 9.0", "SQL Server" };
|
||||
List<string> driverPrecedence = new List<string>() { "ODBC Driver 18 for SQL Server", "ODBC Driver 17 for SQL Server", "ODBC Driver 13 for SQL Server", "ODBC Driver 11 for SQL Server", "SQL Server Native Client 11.0", "SQL Server Native Client 10.0", "SQL Server Native Client 9.0", "SQL Server" };
|
||||
string[] availableOdbcDrivers = GetOdbcDriverNames();
|
||||
string driverName = null;
|
||||
if (availableOdbcDrivers != null)
|
||||
@@ -69,8 +70,9 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
case "datetime": return 93; // SQL_TYPE_TIMESTAMP
|
||||
case "smalldatetime": return 93; // SQL_TYPE_TIMESTAMP
|
||||
case "varbinary": return 93; // SQL_TYPE_TIMESTAMP
|
||||
case "uniqueidentifier": return -11; // SQL_GUID
|
||||
default:
|
||||
SaLogger.Warn("OdbcUtil.GetSqlNativeDataType Unrecognised SQL data type: '" + dataTypeName + "'");
|
||||
SaLogger.Warn($"OdbcUtil.GetSqlNativeDataType Unrecognised SQL data type: '{dataTypeName}'.");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@@ -179,6 +181,10 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
type = DbColumnDataType.Binary;
|
||||
break;
|
||||
//---------------------------------------------------------------
|
||||
case -11: // SQL_GUID: // -11 GUID Fixed length Globally Unique Identifier.
|
||||
type = DbColumnDataType.Guid;
|
||||
break;
|
||||
//---------------------------------------------------------------
|
||||
case 102: // SQL_INTERVAL_MONTH: // 102 INTERVAL MONTH(p) Number of months between two dates; p is the interval leading precision.
|
||||
case 101: // SQL_INTERVAL_YEAR: // 101 INTERVAL YEAR(p) Number of years between two dates; p is the interval leading precision.
|
||||
case 107: // SQL_INTERVAL_YEAR_TO_MONTH: // 107 INTERVAL YEAR(p) TO MONTH Number of years and months between two dates; p is the interval leading precision.
|
||||
@@ -192,11 +198,10 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
case 111: // SQL_INTERVAL_HOUR_TO_MINUTE: // 111 INTERVAL HOUR(p) TO MINUTE Number of hours/minutes between two date/times; p is the interval leading precision.
|
||||
case 112: // SQL_INTERVAL_HOUR_TO_SECOND: // 112 INTERVAL HOUR(p) TO SECOND(q) Number of hours/minutes/seconds between two date/times; p is the interval leading precision and q is the interval seconds precision.
|
||||
case 113: // SQL_INTERVAL_MINUTE_TO_SECOND: // 113 INTERVAL MINUTE(p) TO SECOND(q) Number of minutes/seconds between two date/times; p is the interval leading precision and q is the interval seconds precision.
|
||||
case -11: // SQL_GUID: // -11 GUID Fixed length Globally Unique Identifier.
|
||||
// break;
|
||||
//---------------------------------------------------------------
|
||||
default:
|
||||
SaLogger.Debug("OdbcUtil.OdbcToDataType Unrecognised native data type: " + dataType);
|
||||
SaLogger.Debug($"OdbcUtil.OdbcToDataType Unrecognised native data type: {dataType}.");
|
||||
break;
|
||||
//---------------------------------------------------------------
|
||||
}
|
||||
@@ -230,6 +235,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
case -7: return "Bit"; // SQL_BIT
|
||||
case -5: return "BigInt"; // SQL_BIGINT
|
||||
case -2: return "Binary"; // SQL_BINARY
|
||||
case -11: return "UniqueIdentifier"; // SQL_GUID
|
||||
case -3: return "VarBinary"; // SQL_VARBINARY
|
||||
/*
|
||||
case SQL_LONGVARBINARY: // -4 LONG VARBINARY Variable length binary data. Maximum length is data source–dependent.[9]
|
||||
@@ -246,7 +252,6 @@ namespace Sarand.Net.Standard.Base.Dbas
|
||||
case SQL_INTERVAL_HOUR_TO_MINUTE: // 111 INTERVAL HOUR(p) TO MINUTE Number of hours/minutes between two date/times; p is the interval leading precision.
|
||||
case SQL_INTERVAL_HOUR_TO_SECOND: // 112 INTERVAL HOUR(p) TO SECOND(q) Number of hours/minutes/seconds between two date/times; p is the interval leading precision and q is the interval seconds precision.
|
||||
case SQL_INTERVAL_MINUTE_TO_SECOND: // 113 INTERVAL MINUTE(p) TO SECOND(q) Number of minutes/seconds between two date/times; p is the interval leading precision and q is the interval seconds precision.
|
||||
case SQL_GUID: // -11 GUID Fixed length Globally Unique Identifier.
|
||||
*/
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace Sarand.Net.Standard.Base.Helpers
|
||||
}
|
||||
}
|
||||
}
|
||||
SaLogger.Warn(SysUtil.Fn + " Failed to locate text resource: " + resourceNameEndsWith);
|
||||
SaLogger.Warn($"{SysUtil.Fn} Failed to locate text resource: {resourceNameEndsWith}");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -231,20 +231,20 @@ namespace Sarand.Net.Standard.Base.Helpers
|
||||
/// <summary>Retrieve resource as stream based on assembly and partial resource name.</summary>
|
||||
public static Stream GetManifestResourceStream(Assembly assembly, String partialPath, String resourceNameEndsWith)
|
||||
{
|
||||
//Logger.Debug(SysUtil.Fn + " Manifest resource names: " + new List<String>(assembly.GetManifestResourceNames()).Concat("","\n\t"));
|
||||
//SaLogger.Debug($"{SysUtil.Fn} Manifest resource names: {assembly.GetManifestResourceNames().Concat("","\n\t")}");
|
||||
foreach (String resourceName in assembly.GetManifestResourceNames())
|
||||
{
|
||||
//SaLogger.Debug(SysUtil.Fn + " Resource: " + resourceName);
|
||||
//SaLogger.Debug($"{SysUtil.Fn} Resource: '{resourceName}'.");
|
||||
|
||||
// Match the partial path.
|
||||
if (!StringUtil.IsBlank(partialPath) && !resourceName.ContainsCI(partialPath)) continue;
|
||||
// Match the resource filename to the end of the resource name - resource names start with default namespace (eg. 'Sarand').
|
||||
if (!resourceName.EndsWithCI(resourceNameEndsWith)) continue;
|
||||
|
||||
//SaLogger.Debug(SysUtil.Fn + " Resource filename: " + resourceNameEndsWith + ". Matched to resource: " + resourceName);
|
||||
//SaLogger.Debug($"{SysUtil.Fn} Resource filename: '{resourceNameEndsWith}'. Matched to resource: {resourceName}");
|
||||
return assembly.GetManifestResourceStream(resourceName);
|
||||
}
|
||||
SaLogger.Warn(SysUtil.Fn + " Resource filename not found: " + resourceNameEndsWith);
|
||||
SaLogger.Warn($"{SysUtil.Fn} Resource filename not found: {resourceNameEndsWith}.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -372,7 +372,7 @@ namespace Sarand.Net.Standard.Base.Interfaces
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
private static readonly HashSet<String> reservedWords = new HashSet<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace Sarand.Net.Standard.Base.ItemData
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
private static readonly HashSet<String> reservedWords = new HashSet<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
|
||||
@@ -66,12 +66,12 @@ namespace Sarand.Net.Standard.Base.ItemData
|
||||
if ((int)itemDataData.ItemId.Type < 1)
|
||||
{
|
||||
errField.ItemType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item type must be supplied");
|
||||
return SetErrorState(Msg_ItemTypeNotSpecified);
|
||||
}
|
||||
if (!SysId.IsValid(itemDataData.ItemId.Id))
|
||||
{
|
||||
errField.ItemId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item Id must be supplied");
|
||||
return SetErrorState(Msg_ItemIdNotSpecified);
|
||||
}
|
||||
if (!IsValidValue(itemDataData.DataType, "Data type", (long)SaItemDataDbDfn.GetColTextLen(SaItemDataDbDfn.ColumnIdx.SaItemData_DataType), true))
|
||||
{
|
||||
|
||||
@@ -64,12 +64,12 @@ namespace Sarand.Net.Standard.Base.ItemDocs
|
||||
if ((int)itemDocData.ItemId.Type < 1)
|
||||
{
|
||||
errField.ItemType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item type must be supplied");
|
||||
return SetErrorState(Msg_ItemTypeNotSpecified);
|
||||
}
|
||||
if (!SysId.IsValid(itemDocData.ItemId.Id))
|
||||
{
|
||||
errField.ItemId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item Id must be supplied");
|
||||
return SetErrorState(Msg_ItemIdNotSpecified);
|
||||
}
|
||||
if ((int)itemDocData.Category < 1)
|
||||
{
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace Sarand.Net.Standard.Base.ItemDocs
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
private static readonly HashSet<String> reservedWords = new HashSet<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using System;
|
||||
@@ -5,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:46
|
||||
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:21
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.Net.Standard.Base.ItemOptions
|
||||
{
|
||||
@@ -44,7 +45,7 @@ namespace Sarand.Net.Standard.Base.ItemOptions
|
||||
// Data members.
|
||||
private static readonly int tableCount = 1;
|
||||
private static readonly int columnCount = 14;
|
||||
private static ulong maxTextLen = 0;
|
||||
public static ulong MaxTextLen { get; private set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve Table details (eg. name: 'Company').
|
||||
@@ -52,14 +53,31 @@ namespace Sarand.Net.Standard.Base.ItemOptions
|
||||
{
|
||||
return tableCount;
|
||||
}
|
||||
public static String GetSchemaName (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String schemaName = tables[(int)tableIdx].Schema;
|
||||
if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); }
|
||||
return schemaName;
|
||||
}
|
||||
public static String GetTableName (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
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.
|
||||
@@ -109,8 +127,15 @@ namespace Sarand.Net.Standard.Base.ItemOptions
|
||||
}
|
||||
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;
|
||||
@@ -141,7 +166,7 @@ namespace Sarand.Net.Standard.Base.ItemOptions
|
||||
}
|
||||
public static void SetMaxTextLen (ulong maxTextLen)
|
||||
{
|
||||
SaItemOptionDbDfn.maxTextLen = maxTextLen;
|
||||
SaItemOptionDbDfn.MaxTextLen = maxTextLen;
|
||||
}
|
||||
public static bool IsColFmtText (ColumnIdx column)
|
||||
{
|
||||
@@ -156,7 +181,7 @@ namespace Sarand.Net.Standard.Base.ItemOptions
|
||||
if (columns[columnIdx].DataType == DbColumnDataType.VarChar)
|
||||
{
|
||||
ulong textLen = columns[columnIdx].DataLen;
|
||||
if (maxTextLen > 0 && textLen > maxTextLen) textLen = maxTextLen;
|
||||
if (MaxTextLen > 0 && textLen > MaxTextLen) textLen = MaxTextLen;
|
||||
return textLen;
|
||||
}
|
||||
return 0;
|
||||
@@ -187,14 +212,24 @@ namespace Sarand.Net.Standard.Base.ItemOptions
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table definitions.
|
||||
private static readonly String[] tables =
|
||||
private class TableDfn
|
||||
{
|
||||
"SaItemOption",
|
||||
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","SaItemOption"),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table column definitions.
|
||||
internal class ColumnDfn
|
||||
private class ColumnDfn
|
||||
{
|
||||
internal TableIdx TableIdx { get; set; }
|
||||
internal String Name { get; set; }
|
||||
@@ -212,8 +247,6 @@ namespace Sarand.Net.Standard.Base.ItemOptions
|
||||
this.DataLen = dataLen;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private static readonly ColumnDfn[] columns =
|
||||
{
|
||||
new ColumnDfn(1,"ItemType",3,5,false,5),
|
||||
@@ -234,7 +267,7 @@ namespace Sarand.Net.Standard.Base.ItemOptions
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
private static readonly HashSet<String> reservedWords = new HashSet<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
|
||||
@@ -68,12 +68,12 @@ namespace Sarand.Net.Standard.Base.ItemOptions
|
||||
if ((int)itemOptionData.ItemId.Type < 1)
|
||||
{
|
||||
errField.ItemType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item type must be supplied");
|
||||
return SetErrorState(Msg_ItemTypeNotSpecified);
|
||||
}
|
||||
if (!SysId.IsValid(itemOptionData.ItemId.Id))
|
||||
{
|
||||
errField.ItemId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item Id must be supplied");
|
||||
return SetErrorState(Msg_ItemIdNotSpecified);
|
||||
}
|
||||
if (!IsValidValue(itemOptionData.Name, "name", (long)SaItemOptionDbDfn.GetColTextLen(SaItemOptionDbDfn.ColumnIdx.SaItemOption_Name), true))
|
||||
{
|
||||
|
||||
@@ -383,7 +383,7 @@ namespace Sarand.Net.Standard.Base.ReferenceData
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
private static readonly HashSet<String> reservedWords = new HashSet<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Sarand.Net.Standard.Base.ReferenceData
|
||||
public virtual bool CurrencyCanBeDeleted (SaCurrency currency)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (currency == null) return SetErrorState("Item not specified");
|
||||
if (currency == null) return SetErrorState(Msg_ItemNotSpecified);
|
||||
if (currency.HasDependentCurrencies()) return SetErrorState("Has dependent currencies");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Sarand.Net.Standard.Base.ReferenceData
|
||||
public virtual bool LanguageCanBeDeleted (SaLanguage language)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (language == null) return SetErrorState("Item not specified");
|
||||
if (language == null) return SetErrorState(Msg_ItemNotSpecified);
|
||||
if (language.HasDependentLanguages()) return SetErrorState("Has dependent languages");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Sarand.Net.Standard.Base.ReferenceData
|
||||
public virtual bool RegionCanBeDeleted (SaRegion region)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (region == null) return SetErrorState("Item not specified");
|
||||
if (region == null) return SetErrorState(Msg_ItemNotSpecified);
|
||||
if (region.HasDependentRegions()) return SetErrorState("Has dependent regions");
|
||||
if (region.HasDependentCurrencies()) return SetErrorState("Has dependent currencies");
|
||||
if (region.HasDependentTaxCodes()) return SetErrorState("Has dependent tax codes");
|
||||
|
||||
@@ -312,7 +312,9 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
//-------------------------------------------------------------------
|
||||
// Security item updates.
|
||||
public abstract bool CreateUser(String code, String name, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool CreateGroup(String code, String name, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool AssignUserToGroup(String userCode, String groupCode, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool AssignRightToGroup(String rightCode, String groupCode, DbUpdateInfo dbUpdateInfo);
|
||||
public abstract bool UpdateSecurityItem(SaSecurityItem securityItem, DbUpdateInfo dbUpdateInfo);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:38
|
||||
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:20
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.Net.Standard.Base.Security
|
||||
{
|
||||
@@ -32,11 +32,16 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
SaSecItem_Type,
|
||||
SaSecItem_EmailAddress,
|
||||
SaSecItem_Location,
|
||||
SaSecItem_DataItemType,
|
||||
SaSecItem_EncPword,
|
||||
SaSecItem_PwordSalt,
|
||||
SaSecItem_PwordHash,
|
||||
SaSecItem_PasswordToken,
|
||||
SaSecItem_PasswordHistory,
|
||||
SaSecItem_PasswordChangedAt,
|
||||
SaSecItem_LastLogin,
|
||||
SaSecItem_DataItemType,
|
||||
SaSecItem_LastInvalidLoginAt,
|
||||
SaSecItem_InvalidLoginCount,
|
||||
SaSecItem_Notes,
|
||||
SaSecItem_Flags,
|
||||
SaSecItem_Status,
|
||||
@@ -65,8 +70,8 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static readonly int tableCount = 2;
|
||||
private static readonly int columnCount = 34;
|
||||
private static ulong maxTextLen = 0;
|
||||
private static readonly int columnCount = 39;
|
||||
public static ulong MaxTextLen { get; private set; }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Retrieve Table details (eg. name: 'Company').
|
||||
@@ -74,14 +79,31 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
{
|
||||
return tableCount;
|
||||
}
|
||||
public static String GetSchemaName (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
int tableIdx = (int)table - 1;
|
||||
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
|
||||
String schemaName = tables[(int)tableIdx].Schema;
|
||||
if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); }
|
||||
return schemaName;
|
||||
}
|
||||
public static String GetTableName (TableIdx table, bool delimitReservedWords = true)
|
||||
{
|
||||
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.
|
||||
@@ -131,8 +153,15 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
}
|
||||
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;
|
||||
@@ -163,7 +192,7 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
}
|
||||
public static void SetMaxTextLen (ulong maxTextLen)
|
||||
{
|
||||
SaSecurityDbDfn.maxTextLen = maxTextLen;
|
||||
SaSecurityDbDfn.MaxTextLen = maxTextLen;
|
||||
}
|
||||
public static bool IsColFmtText (ColumnIdx column)
|
||||
{
|
||||
@@ -178,7 +207,7 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
if (columns[columnIdx].DataType == DbColumnDataType.VarChar)
|
||||
{
|
||||
ulong textLen = columns[columnIdx].DataLen;
|
||||
if (maxTextLen > 0 && textLen > maxTextLen) textLen = maxTextLen;
|
||||
if (MaxTextLen > 0 && textLen > MaxTextLen) textLen = MaxTextLen;
|
||||
return textLen;
|
||||
}
|
||||
return 0;
|
||||
@@ -209,15 +238,25 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table definitions.
|
||||
private static readonly String[] tables =
|
||||
private class TableDfn
|
||||
{
|
||||
"SaSecItem",
|
||||
"SaSecLink",
|
||||
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","SaSecItem"),
|
||||
new TableDfn("dbo","SaSecLink"),
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Table column definitions.
|
||||
internal class ColumnDfn
|
||||
private class ColumnDfn
|
||||
{
|
||||
internal TableIdx TableIdx { get; set; }
|
||||
internal String Name { get; set; }
|
||||
@@ -235,21 +274,24 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
this.DataLen = dataLen;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private static readonly ColumnDfn[] columns =
|
||||
{
|
||||
new ColumnDfn(1,"Id",4,4,false,10),
|
||||
new ColumnDfn(1,"Code",0,-9,false,20),
|
||||
new ColumnDfn(1,"Description",0,-9,false,50),
|
||||
new ColumnDfn(1,"Code",0,-9,false,128),
|
||||
new ColumnDfn(1,"Description",0,-9,false,100),
|
||||
new ColumnDfn(1,"Type",2,-6,false,3),
|
||||
new ColumnDfn(1,"EmailAddress",0,12,false,128),
|
||||
new ColumnDfn(1,"EmailAddress",0,-9,false,128),
|
||||
new ColumnDfn(1,"Location",0,-9,false,50),
|
||||
new ColumnDfn(1,"DataItemType",3,5,false,5),
|
||||
new ColumnDfn(1,"EncPword",0,-9,false,128),
|
||||
new ColumnDfn(1,"PwordSalt",0,-9,false,16),
|
||||
new ColumnDfn(1,"PwordHash",0,-9,false,64),
|
||||
new ColumnDfn(1,"PwordHash",0,-9,false,200),
|
||||
new ColumnDfn(1,"PasswordToken",0,12,false,32),
|
||||
new ColumnDfn(1,"PasswordHistory",0,-9,false,0),
|
||||
new ColumnDfn(1,"PasswordChangedAt",9,93,false,16),
|
||||
new ColumnDfn(1,"LastLogin",9,93,false,23),
|
||||
new ColumnDfn(1,"DataItemType",3,5,false,5),
|
||||
new ColumnDfn(1,"LastInvalidLoginAt",9,93,false,16),
|
||||
new ColumnDfn(1,"InvalidLoginCount",3,5,false,5),
|
||||
new ColumnDfn(1,"Notes",0,-9,false,255),
|
||||
new ColumnDfn(1,"Flags",3,5,false,5),
|
||||
new ColumnDfn(1,"Status",0,12,false,3),
|
||||
@@ -277,7 +319,7 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
private static readonly HashSet<String> reservedWords = new HashSet<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
|
||||
@@ -58,10 +58,10 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
public String PasswordHash { get; set; } = String.Empty;
|
||||
public List<String> PasswordHistory { get; } = new List<string>();
|
||||
public String PasswordToken { get; set; } = String.Empty;
|
||||
public DateTime PasswordChangedAt { get; set; } = DateTime.MinValue;
|
||||
public DateTime? PasswordChangedAt { get; set; } = DateTime.MinValue;
|
||||
// Login.
|
||||
public DateTime LastLogin { get; set; } = DateTime.MinValue;
|
||||
public DateTime LastInvalidLoginAt { get; set; } = DateTime.MinValue;
|
||||
public DateTime? LastLogin { get; set; } = DateTime.MinValue;
|
||||
public DateTime? LastInvalidLoginAt { get; set; } = DateTime.MinValue;
|
||||
public short InvalidLoginCount { get; set; }
|
||||
}
|
||||
|
||||
@@ -138,21 +138,21 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
get { return data.PasswordToken; }
|
||||
set { CheckChanged(data.PasswordToken, value); data.PasswordToken = value; }
|
||||
}
|
||||
public DateTime PasswordChangedAt
|
||||
public DateTime? PasswordChangedAt
|
||||
{
|
||||
get { return data.PasswordChangedAt; }
|
||||
set { CheckChanged(data.PasswordChangedAt, value); data.PasswordChangedAt = value; }
|
||||
set { CheckChangedNullable(data.PasswordChangedAt, value); data.PasswordChangedAt = value; }
|
||||
}
|
||||
// Login.
|
||||
public DateTime LastLogin
|
||||
public DateTime? LastLogin
|
||||
{
|
||||
get { return data.LastLogin; }
|
||||
set { CheckChanged(data.LastLogin, value); data.LastLogin = value; }
|
||||
set { CheckChangedNullable(data.LastLogin, value); data.LastLogin = value; }
|
||||
}
|
||||
public DateTime LastInvalidLoginAt
|
||||
public DateTime? LastInvalidLoginAt
|
||||
{
|
||||
get { return data.LastInvalidLoginAt; }
|
||||
set { CheckChanged(data.LastInvalidLoginAt, value); data.LastInvalidLoginAt = value; }
|
||||
set { CheckChangedNullable(data.LastInvalidLoginAt, value); data.LastInvalidLoginAt = value; }
|
||||
}
|
||||
public short InvalidLoginCount
|
||||
{
|
||||
@@ -331,19 +331,19 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
get { return data.PasswordHistory; }
|
||||
set { data.PasswordHistory = value; }
|
||||
}
|
||||
public DateTime PasswordChangedAt
|
||||
public DateTime? PasswordChangedAt
|
||||
{
|
||||
get { return data.PasswordChangedAt; }
|
||||
set { data.PasswordChangedAt = value; }
|
||||
}
|
||||
|
||||
// Login.
|
||||
public DateTime LastLogin
|
||||
public DateTime? LastLogin
|
||||
{
|
||||
get { return data.LastLogin; }
|
||||
set { data.LastLogin = value; }
|
||||
}
|
||||
public DateTime LastInvalidLoginAt
|
||||
public DateTime? LastInvalidLoginAt
|
||||
{
|
||||
get { return data.LastInvalidLoginAt; }
|
||||
set { data.LastInvalidLoginAt = value; }
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
public SysId ItemIdTarget { get; set; } = new SysId();
|
||||
public SysId ItemIdContext { get; set; } = new SysId();
|
||||
public String DayApplicability { get; set; } = String.Empty;
|
||||
public DateTime ApplicableFrom { get; set; } = DateTime.MinValue;
|
||||
public DateTime ApplicableTo { get; set; } = DateTime.MinValue;
|
||||
public DateTime? ApplicableFrom { get; set; } = DateTime.MinValue;
|
||||
public DateTime? ApplicableTo { get; set; } = DateTime.MinValue;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -78,15 +78,15 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
get { return data.DayApplicability; }
|
||||
set { CheckChanged(data.DayApplicability, value); data.DayApplicability = value; }
|
||||
}
|
||||
public DateTime ApplicableFrom
|
||||
public DateTime? ApplicableFrom
|
||||
{
|
||||
get { return data.ApplicableFrom; }
|
||||
set { CheckChanged(data.ApplicableFrom, value); data.ApplicableFrom = value; }
|
||||
set { CheckChangedNullable(data.ApplicableFrom, value); data.ApplicableFrom = value; }
|
||||
}
|
||||
public DateTime ApplicableTo
|
||||
public DateTime? ApplicableTo
|
||||
{
|
||||
get { return data.ApplicableTo; }
|
||||
set { CheckChanged(data.ApplicableTo, value); data.ApplicableTo = value; }
|
||||
set { CheckChangedNullable(data.ApplicableTo, value); data.ApplicableTo = value; }
|
||||
}
|
||||
// Population.
|
||||
internal void PopulateFrom(Data data)
|
||||
@@ -200,12 +200,12 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
get { return data.DayApplicability; }
|
||||
set { data.DayApplicability = value; }
|
||||
}
|
||||
public DateTime ApplicableFrom
|
||||
public DateTime? ApplicableFrom
|
||||
{
|
||||
get { return data.ApplicableFrom; }
|
||||
set { data.ApplicableFrom = value; }
|
||||
}
|
||||
public DateTime ApplicableTo
|
||||
public DateTime? ApplicableTo
|
||||
{
|
||||
get { return data.ApplicableTo; }
|
||||
set { data.ApplicableTo = value; }
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Sarand.Net.Standard.Base.Security
|
||||
EmailAddress = secItem.EmailAddress;
|
||||
Description = secItem.Description;
|
||||
Location = secItem.Location;
|
||||
LastLogin = secItem.LastLogin;
|
||||
LastLogin = secItem.LastLogin ?? DateTime.MinValue;
|
||||
}
|
||||
if (profileGroups != null)
|
||||
securityGroups.AddRange(profileGroups);
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace Sarand.Net.Standard.Base.UpdateLog
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Reserved words.
|
||||
private static readonly List<String> reservedWords = new List<String>()
|
||||
private static readonly HashSet<String> reservedWords = new HashSet<String>()
|
||||
{
|
||||
"ADD",
|
||||
"ALL",
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Sarand.Net.Standard.Base.UpdateLog
|
||||
ClearErrorState();
|
||||
if (!config.UpdateLogConsole.LogUpdates(this))
|
||||
SetErrorState(config.UpdateLogConsole.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
protected virtual bool IsColumnChangeLogged (String attrName)
|
||||
{
|
||||
@@ -121,7 +121,7 @@ namespace Sarand.Net.Standard.Base.UpdateLog
|
||||
SetAttrValueAfter(attrName, value);
|
||||
else
|
||||
SetAttrValueBefore(attrName, value);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public void SetAttrValueBefore (String attrName, DataValue value)
|
||||
{
|
||||
|
||||
@@ -59,12 +59,12 @@ namespace Sarand.Net.Standard.Base.UpdateLog
|
||||
if ((int)logEntryData.ItemId.Type < 1)
|
||||
{
|
||||
errField.ItemType = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item type must be supplied");
|
||||
return SetErrorState(Msg_ItemTypeNotSpecified);
|
||||
}
|
||||
if (!SysId.IsValid(logEntryData.ItemId.Id))
|
||||
{
|
||||
errField.ItemId = SacsHierarchyItem.ValidValue.Invalid;
|
||||
return SetErrorState("Item Id must be supplied");
|
||||
return SetErrorState(Msg_ItemIdNotSpecified);
|
||||
}
|
||||
if (!IsValidValue(logEntryData.Attribute, "attribute", (long)SaUpdateLogDbDfn.GetColTextLen(SaUpdateLogDbDfn.ColumnIdx.SaAttrUpdate_Attribute), true))
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Sarand.Net.Standard.Base.Utils
|
||||
/// </summary>
|
||||
public static String GetLogMessage(this Exception exc, String message, int entries = 8, String stackEntryDelim = "\n\t")
|
||||
{
|
||||
return (exc.GetType().Name + " " + message + ": " + GetMessage(exc) + exc.GetStackEntries(entries).Concat("", stackEntryDelim)).TrimAll();
|
||||
return ($"{exc.GetType().Name} {message}: {GetMessage(exc).TrimEnd('.')}.{exc.GetStackEntries(entries).Concat("", stackEntryDelim)}").TrimAll();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -34,6 +34,12 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
ODBC,
|
||||
SQL,
|
||||
}
|
||||
public enum DefinitionOutput
|
||||
{
|
||||
DatabaseSchema,
|
||||
DatabaseDefinitionClass,
|
||||
TableInterfaceClasses
|
||||
}
|
||||
public class Config
|
||||
{
|
||||
public SarandCommonVersion SarandCommonVersion { get; set; } = SarandCommonVersion.VS2019;
|
||||
@@ -48,6 +54,9 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
// Tables to be included (all others excluded) or those to be excluded.
|
||||
public HashSet<String> Tables_Included { get; } = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
|
||||
public HashSet<String> Tables_Excluded { get; } = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
|
||||
public HashSet<String> Tables_ExcludedFromDatabaseSchema { get; } = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
|
||||
public HashSet<String> Tables_ExcludedFromDatabaseDefinitionClass { get; } = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
|
||||
public HashSet<String> Tables_ExcludedFromTableInterfaceClasses { get; } = new HashSet<String>(StringComparer.OrdinalIgnoreCase);
|
||||
// Schema capitalisation - for class name prefix etc - where capitalising first letter is insufficient.
|
||||
public Dictionary<String, String> SchemaNameCapitalisation { get; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
// Alternative table names.
|
||||
@@ -125,44 +134,41 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
}
|
||||
|
||||
// Table definitions.
|
||||
List<DbDfnTable> tableDfns = new List<DbDfnTable>();
|
||||
foreach (DbDfnTable tableDfn in config.Database.GetTableDfns())
|
||||
{
|
||||
if (!IsValidTable(tableDfn.Name)) continue;
|
||||
tableDfns.Add(tableDfn);
|
||||
}
|
||||
List<DbDfnTable> tableDfns = new List<DbDfnTable>(config.Database.GetTableDfns());
|
||||
|
||||
// Database schema XML.
|
||||
GenerateDatabaseSchemaXml(tableDfns);
|
||||
GenerateDatabaseSchemaXml(tableDfns.Where(item => IsValidTable(item.Name, DefinitionOutput.DatabaseSchema)));
|
||||
|
||||
// Database definition class.
|
||||
GenerateDatabaseDefinitionClass(tableDfns);
|
||||
GenerateDatabaseDefinitionClass(tableDfns.Where(item => IsValidTable(item.Name, DefinitionOutput.DatabaseDefinitionClass)));
|
||||
|
||||
// Database table Classes.
|
||||
foreach (DbDfnTable tableDfn in tableDfns)
|
||||
foreach (DbDfnTable tableDfn in tableDfns.Where(item => IsValidTable(item.Name, DefinitionOutput.TableInterfaceClasses)))
|
||||
GenerateTableInterfaceClass(tableDfn);
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private bool IsValidTable(String table)
|
||||
private bool IsValidTable(String table, DefinitionOutput output)
|
||||
{
|
||||
if (String.IsNullOrEmpty(table)) return false;
|
||||
if (config.Schema.Tables_Included.Count > 0 && !config.Schema.Tables_Included.ContainsCI(table)) return false;
|
||||
if (config.Schema.Tables_Excluded.Count > 0 && config.Schema.Tables_Excluded.ContainsCI(table)) return false;
|
||||
// Tables excluded from specific output.
|
||||
if (output == DefinitionOutput.DatabaseSchema && config.Schema.Tables_ExcludedFromDatabaseSchema.Contains(table)) return false;
|
||||
if (output == DefinitionOutput.DatabaseDefinitionClass && config.Schema.Tables_ExcludedFromDatabaseDefinitionClass.Contains(table)) return false;
|
||||
if (output == DefinitionOutput.TableInterfaceClasses && config.Schema.Tables_ExcludedFromTableInterfaceClasses.Contains(table)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private void GenerateDatabaseSchemaXml(List<DbDfnTable> tableDfns)
|
||||
private void GenerateDatabaseSchemaXml(IEnumerable<DbDfnTable> tableDfns)
|
||||
{
|
||||
String filePath = config.OutputDirectory + Path.DirectorySeparatorChar + config.DefinitionClass.Classname + ".xml";
|
||||
// Construct database definition.
|
||||
DbDfnDatabase databaseDfn = new DbDfnDatabase();
|
||||
foreach (DbDfnTable tableDfn in tableDfns)
|
||||
{
|
||||
databaseDfn.AddTable(tableDfn);
|
||||
}
|
||||
using (StreamWriter file = new StreamWriter(filePath))
|
||||
{
|
||||
file.Write(SerializableUtil.ToXml(databaseDfn));
|
||||
@@ -252,8 +258,10 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a b a s e D e f i n i t i o n C l a s s
|
||||
//-------------------------------------------------------------------
|
||||
private void GenerateDatabaseDefinitionClass(List<DbDfnTable> tableDfns)
|
||||
private void GenerateDatabaseDefinitionClass(IEnumerable<DbDfnTable> tableDfns)
|
||||
{
|
||||
// Remove excluded tables.
|
||||
tableDfns = tableDfns.Where(item => IsValidTable(item.Name, DefinitionOutput.DatabaseDefinitionClass)).ToList();
|
||||
String filePath = config.OutputDirectory + Path.DirectorySeparatorChar + config.DefinitionClass.Classname + ".cs";
|
||||
using (StreamWriter file = new StreamWriter(filePath))
|
||||
{
|
||||
@@ -284,7 +292,7 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a b a s e E n u m s
|
||||
//-------------------------------------------------------------------
|
||||
public static void GenerateDatabaseDefinitionTablesEnum(List<DbDfnTable> tableDfns, StreamWriter file)
|
||||
public static void GenerateDatabaseDefinitionTablesEnum(IEnumerable<DbDfnTable> tableDfns, StreamWriter file)
|
||||
{
|
||||
file.WriteLine(tab2 + "// Table identifiers.");
|
||||
file.WriteLine(tab2 + "public enum TableIdx");
|
||||
@@ -299,7 +307,7 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public static void GenerateDatabaseDefinitionColumnsEnum(List<DbDfnTable> tableDfns, StreamWriter file)
|
||||
public static void GenerateDatabaseDefinitionColumnsEnum(IEnumerable<DbDfnTable> tableDfns, StreamWriter file)
|
||||
{
|
||||
file.WriteLine(tab2 + "// Column identifiers.");
|
||||
file.WriteLine(tab2 + "public enum ColumnIdx");
|
||||
@@ -315,12 +323,12 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
public static void GenerateDatabaseDefinitionClass(List<DbDfnTable> tableDfns, String classnameDefinition, StreamWriter file)
|
||||
public static void GenerateDatabaseDefinitionClass(IEnumerable<DbDfnTable> tableDfns, String classnameDefinition, StreamWriter file)
|
||||
{
|
||||
file.WriteLine(tab2 + "// Data members.");
|
||||
file.WriteLine(tab2 + "private static readonly int tableCount = " + tableDfns.Count + ";");
|
||||
file.WriteLine(tab2 + "private static readonly int tableCount = " + tableDfns.Count() + ";");
|
||||
file.WriteLine(tab2 + "private static readonly int columnCount = " + tableDfns.GetColumnCount() + ";");
|
||||
file.WriteLine(tab2 + "private static ulong maxTextLen = 0;");
|
||||
file.WriteLine(tab2 + "public static ulong MaxTextLen { get; private set; }");
|
||||
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
|
||||
|
||||
// Table methods.
|
||||
@@ -446,7 +454,7 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
file.WriteLine(tab2 + "}");
|
||||
file.WriteLine(tab2 + "public static void SetMaxTextLen (ulong maxTextLen)");
|
||||
file.WriteLine(tab2 + "{");
|
||||
file.WriteLine(tab3 + classnameDefinition + ".maxTextLen = maxTextLen;");
|
||||
file.WriteLine(tab3 + classnameDefinition + ".MaxTextLen = maxTextLen;");
|
||||
file.WriteLine(tab2 + "}");
|
||||
file.WriteLine(tab2 + "public static bool IsColFmtText (ColumnIdx column)");
|
||||
file.WriteLine(tab2 + "{");
|
||||
@@ -461,7 +469,7 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
file.WriteLine(tab3 + "if (columns[columnIdx].DataType == DbColumnDataType.VarChar)");
|
||||
file.WriteLine(tab3 + "{");
|
||||
file.WriteLine(tab4 + "ulong textLen = columns[columnIdx].DataLen;");
|
||||
file.WriteLine(tab4 + "if (maxTextLen > 0 && textLen > maxTextLen) textLen = maxTextLen;");
|
||||
file.WriteLine(tab4 + "if (MaxTextLen > 0 && textLen > MaxTextLen) textLen = MaxTextLen;");
|
||||
file.WriteLine(tab4 + "return textLen;");
|
||||
file.WriteLine(tab3 + "}");
|
||||
file.WriteLine(tab3 + "return 0;");
|
||||
@@ -544,7 +552,7 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
|
||||
// Reserved words.
|
||||
file.WriteLine(tab2 + "// Reserved words.");
|
||||
file.WriteLine(tab2 + "private static readonly List<String> reservedWords = new List<String>()");
|
||||
file.WriteLine(tab2 + "private static readonly HashSet<String> reservedWords = new HashSet<String>()");
|
||||
file.WriteLine(tab2 + "{");
|
||||
foreach (String reservedword in reservedWords)
|
||||
file.WriteLine(tab3 + "\"" + reservedword + "\", ");
|
||||
|
||||
@@ -231,13 +231,13 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
//-------------------------------------------------------------------
|
||||
// D a t a b a s e S c h e m a
|
||||
//-------------------------------------------------------------------
|
||||
public abstract List<String> GetTableNames(bool refresh = false);
|
||||
public abstract HashSet<String> GetTableNames(bool refresh = false);
|
||||
public abstract List<DbDfnTable> GetTableDfns(bool refresh = false);
|
||||
public abstract DbDfnTable GetTableDfn(String name, bool refresh = false);
|
||||
public bool TableExists(String tableName)
|
||||
{
|
||||
if (StringUtil.IsEmpty(tableName)) return false;
|
||||
return GetTableNames().Exists(table => table.EqualsCI(tableName));
|
||||
return GetTableNames().Contains(tableName);
|
||||
}
|
||||
public bool ColumnExists(String tableName, String columnName)
|
||||
{
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
}
|
||||
}
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -295,7 +295,7 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
}
|
||||
}
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -328,7 +328,7 @@ namespace Sarand.Net.Standard.Dbas.Base
|
||||
}
|
||||
}
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
@@ -5,11 +7,10 @@ using Sarand.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using System.Linq;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:33
|
||||
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:21
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
|
||||
{
|
||||
@@ -38,7 +39,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static List<String> fields { get; } = new List<String>()
|
||||
protected static List<String> fields { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
"Code",
|
||||
@@ -56,14 +57,19 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
|
||||
"UpdateBy",
|
||||
"UpdateHost",
|
||||
};
|
||||
private static List<String> fieldsId { get; } = new List<String>()
|
||||
protected static List<String> fieldsId { get; } = new List<String>()
|
||||
{
|
||||
};
|
||||
private static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
protected static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
private static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
protected static List<String> fieldsNullable { get; } = new List<String>()
|
||||
{
|
||||
"CreateHost",
|
||||
"UpdateHost",
|
||||
};
|
||||
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
{
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
@@ -75,7 +81,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaCodeType_Db (IDatabaseInfo dbInfo = null) : base(dbInfo)
|
||||
internal SaCodeType_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -107,6 +113,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
|
||||
// Existing columns - confirmed on database if table exists.
|
||||
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
|
||||
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
|
||||
public List<String> UpdatableColumns { get { return ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList(); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
@@ -185,10 +192,15 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand, List<String> columnsToUpdate = null)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
List<String> columnNames = (columnsToUpdate?.Any() ?? false ? columnsToUpdate : UpdatableColumns).Where(col => UpdatableColumns.ContainsCI(col)).ToList();
|
||||
if (!columnNames.Any())
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} No columns to update. [{GetType().Name}]");
|
||||
return false;
|
||||
}
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:33
|
||||
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:21
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
|
||||
{
|
||||
@@ -38,7 +39,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static List<String> fields { get; } = new List<String>()
|
||||
protected static List<String> fields { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
"CodeTypeId",
|
||||
@@ -56,14 +57,19 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
|
||||
"UpdateBy",
|
||||
"UpdateHost",
|
||||
};
|
||||
private static List<String> fieldsId { get; } = new List<String>()
|
||||
protected static List<String> fieldsId { get; } = new List<String>()
|
||||
{
|
||||
};
|
||||
private static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
protected static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
private static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
protected static List<String> fieldsNullable { get; } = new List<String>()
|
||||
{
|
||||
"CreateHost",
|
||||
"UpdateHost",
|
||||
};
|
||||
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
{
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
@@ -74,7 +80,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaCode_Db (IDatabaseInfo dbInfo = null) : base(dbInfo)
|
||||
internal SaCode_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -106,6 +112,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
|
||||
// Existing columns - confirmed on database if table exists.
|
||||
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
|
||||
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
|
||||
public List<String> UpdatableColumns { get { return ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList(); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
@@ -184,10 +191,15 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand, List<String> columnsToUpdate = null)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
List<String> columnNames = (columnsToUpdate?.Any() ?? false ? columnsToUpdate : UpdatableColumns).Where(col => UpdatableColumns.ContainsCI(col)).ToList();
|
||||
if (!columnNames.Any())
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} No columns to update. [{GetType().Name}]");
|
||||
return false;
|
||||
}
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.IO;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Sarand.Net.Standard.Dbas.CodeType
|
||||
{
|
||||
@@ -14,14 +14,16 @@ namespace Sarand.Net.Standard.Dbas.CodeType
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
//private static String className = nameof(SaCodeTypeDbDfnGenerator);
|
||||
private static String className = nameof(SaCodeTypeDbDfnGenerator);
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Generate database definitions.
|
||||
/// Generate Code Type database definitions.
|
||||
/// </summary>
|
||||
public static bool Generate(String connectionString)
|
||||
{
|
||||
String fn = className + ".Generate";
|
||||
|
||||
// Locate output folder:
|
||||
String directory = GetOutputFolder();
|
||||
if (String.IsNullOrEmpty(directory) || !FileUtil.IsDirectory(directory)) return false;
|
||||
@@ -39,7 +41,7 @@ namespace Sarand.Net.Standard.Dbas.CodeType
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Error($"{SysUtil.Fn} {ExceptionUtil.GetLogMessage(exc, "generating database definition")}");
|
||||
SaLogger.Error($"{fn} {ExceptionUtil.GetLogMessage(exc, "generating Code Type database definition")}");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -69,7 +71,13 @@ namespace Sarand.Net.Standard.Dbas.CodeType
|
||||
config.DefinitionClass.Namespace = "Sarand.Net.Standard.Base.CodeTypes";
|
||||
config.DefinitionClass.Classname = "SaCodeTypeDbDfn";
|
||||
// Table class.
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.App");
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Core");
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Utils");
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Dbas");
|
||||
config.TableClass.Namespace = "Sarand.Net.Standard.Dbas.CodeTypes.Internal";
|
||||
config.TableClass.ClassName_DatabaseInfo = "IDatabaseInfo";
|
||||
config.TableClass.MandatoryConstructorDbInfo = true;
|
||||
|
||||
// Generate database definition.
|
||||
DatabaseDefinitionGenerator generator = new DatabaseDefinitionGenerator();
|
||||
@@ -79,9 +87,10 @@ namespace Sarand.Net.Standard.Dbas.CodeType
|
||||
//-------------------------------------------------------------------
|
||||
private static String GetOutputFolder()
|
||||
{
|
||||
String fn = className + ".GetOutputFolder";
|
||||
String assemblyDirectory = FileUtil.GetParentDirectory((Assembly.GetAssembly(typeof(DatabaseDefinitionGenerator)).Location));
|
||||
String directory = assemblyDirectory;
|
||||
SaLogger.Debug($"{SysUtil.Fn} Assembly folder: {directory}");
|
||||
SaLogger.Debug($"{fn} Assembly folder: {directory}");
|
||||
// Locate the parent of the 'Workspace' solution root folder.
|
||||
String projectFolder = "Workspace";
|
||||
while (!String.IsNullOrEmpty(directory))
|
||||
@@ -92,15 +101,15 @@ namespace Sarand.Net.Standard.Dbas.CodeType
|
||||
}
|
||||
if (String.IsNullOrEmpty(directory))
|
||||
{
|
||||
SaLogger.Error($"{SysUtil.Fn} Failed to find '{projectFolder}' solution root folder in assembly path: {assemblyDirectory}");
|
||||
SaLogger.Error($"{fn} Failed to find '{projectFolder}' solution root folder in assembly path: {assemblyDirectory}");
|
||||
return String.Empty;
|
||||
}
|
||||
// Code files are generated to '..\Database\Generated\CodeTypes\' folder.
|
||||
directory = Path.Combine(directory, "Database", "Generated", "CodeTypes");
|
||||
SaLogger.Debug($"{SysUtil.Fn} Output folder: {directory}");
|
||||
SaLogger.Debug($"{fn} Output folder: {directory}");
|
||||
if (!FileUtil.ValidateDirectory(directory, true))
|
||||
{
|
||||
SaLogger.Error($"{SysUtil.Fn} Output folder not found: {directory}");
|
||||
SaLogger.Error($"{fn} Output folder not found: {directory}");
|
||||
return String.Empty;
|
||||
}
|
||||
return directory;
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -195,7 +195,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -226,7 +226,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -492,7 +492,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -517,7 +517,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -649,7 +649,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -711,7 +711,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -739,7 +739,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -769,7 +769,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -1056,7 +1056,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -1082,7 +1082,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,6 +170,16 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
public ColumnDataDateTimeNullable(String name, bool identity = false) : base(name, identity) { }
|
||||
public DateTime? Value { get; set; } = null;
|
||||
}
|
||||
public class ColumnDataGuid : ColumnData
|
||||
{
|
||||
public ColumnDataGuid(String name, bool identity = false) : base(name, identity) { }
|
||||
public Guid Value { get; set; } = default(Guid);
|
||||
}
|
||||
public class ColumnDataGuidNullable : ColumnData
|
||||
{
|
||||
public ColumnDataGuidNullable(String name, bool identity = false) : base(name, identity) { }
|
||||
public Guid Value { get; set; } = default(Guid);
|
||||
}
|
||||
public class ColumnDataByteArray : ColumnData
|
||||
{
|
||||
public ColumnDataByteArray(String name, bool identity = false) : base(name, identity) { }
|
||||
@@ -527,6 +537,23 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public Guid GetFieldGuid(DbDataReader dbDataReader, String columnName, Guid defaultValue)
|
||||
{
|
||||
int columnIdx = GetColumnOrdinal(dbDataReader, columnName);
|
||||
if (columnIdx < 0) return defaultValue;
|
||||
// Check for null value (to avoid throwing exception).
|
||||
if (!dbDataReader.IsDBNull(columnIdx))
|
||||
{
|
||||
Type dataType = dbDataReader.GetFieldType(columnIdx);
|
||||
// Expected data type.
|
||||
object data = dbDataReader[columnIdx];
|
||||
if (data is Guid)
|
||||
return (Guid)data;
|
||||
LogAlternativeTypeColumn(columnName, typeof(Byte[]), dataType);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public byte[] GetFieldByteArray(DbDataReader dbDataReader, String columnName, byte[] defaultValue)
|
||||
{
|
||||
int columnIdx = GetColumnOrdinal(dbDataReader, columnName);
|
||||
|
||||
@@ -270,6 +270,12 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
return data.DbDataReader.GetDateTime(columnIdx);
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
public override Guid GetGuid(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
return data.DbDataReader.GetGuid(columnIdx);
|
||||
return default(Guid);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -194,6 +194,13 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
return dataTableReader.GetDateTime(columnIdx);
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
public override Guid GetGuid(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetGuid(columnIdx);
|
||||
return default(Guid);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
//=======================================================================
|
||||
|
||||
@@ -21,7 +21,8 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private String sqlConnectionString = "";
|
||||
private readonly List<DbDfnTable> tables = new List<DbDfnTable>();
|
||||
private readonly Dictionary<String, DbDfnTable> tableDfns = new Dictionary<String, DbDfnTable>();
|
||||
private bool tableDfnsPopulated = false;
|
||||
public static readonly String DbCol_CreateOn = "CreateOn";
|
||||
public static readonly String DbCol_CreateBy = "CreateBy";
|
||||
public static readonly String DbCol_UpdateOn = "UpdateOn";
|
||||
@@ -350,38 +351,43 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
//-------------------------------------------------------------------
|
||||
// NB Always use ODBC connection for querying schema.
|
||||
// eg. SQL Connection GetSchema('Indices') doesn't return index columns.
|
||||
public override List<String> GetTableNames(bool refresh = false)
|
||||
public override HashSet<String> GetTableNames(bool refresh = false)
|
||||
{
|
||||
lock (tables)
|
||||
lock (tableDfns)
|
||||
{
|
||||
// Only populate table names if not previously done.
|
||||
if (tables.Count < 1 || refresh)
|
||||
if (!tableDfnsPopulated || refresh)
|
||||
{
|
||||
tables.Clear();
|
||||
tableDfns.Clear();
|
||||
using (DbConnection dbConnection = CreateConnection(true))
|
||||
{
|
||||
dbConnection.Open();
|
||||
PopulateTableNames(dbConnection);
|
||||
tableDfns.AddRange(GetTableDefinitions(dbConnection).ToDictionary(table => table.Name, table => table));
|
||||
}
|
||||
}
|
||||
return tables.GetNames();
|
||||
return tableDfns.Values.GetNames().ToHashSet(StringComparer.InvariantCultureIgnoreCase);
|
||||
}
|
||||
}
|
||||
public override List<DbDfnTable> GetTableDfns(bool refresh = false)
|
||||
{
|
||||
lock (tables)
|
||||
lock (tableDfns)
|
||||
{
|
||||
if (refresh) ClearTableDfns();
|
||||
// Only populate table names and/or table schemas where not previously done.
|
||||
if (tables.Count < 1 || tables.Exists(item => !item.HasColumns()))
|
||||
if (!tableDfnsPopulated || tableDfns.Count < 1 || tableDfns.Values.Any(table => !table.HasColumns()))
|
||||
{
|
||||
// Use a single connection for table and schema population.
|
||||
using (DbConnection dbConnection = CreateConnection(true))
|
||||
{
|
||||
dbConnection.Open();
|
||||
if (tables.Count < 1)
|
||||
PopulateTableNames(dbConnection);
|
||||
foreach (DbDfnTable table in tables.ToList())
|
||||
if (!tableDfnsPopulated || tableDfns.Count < 1)
|
||||
{
|
||||
tableDfns.Clear();
|
||||
tableDfns.AddRange(GetTableDefinitions(dbConnection).ToDictionary(table => table.Name, table => table));
|
||||
}
|
||||
tableDfnsPopulated = true;
|
||||
// Populate details for each table.
|
||||
foreach (DbDfnTable table in tableDfns.Values)
|
||||
{
|
||||
if (!table.HasColumns())
|
||||
{
|
||||
@@ -391,32 +397,36 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
}
|
||||
}
|
||||
}
|
||||
return tables.ToList();
|
||||
return new List<DbDfnTable>(tableDfns.Values);
|
||||
}
|
||||
}
|
||||
public void ClearTableDfns()
|
||||
{
|
||||
lock (tables)
|
||||
tables.Clear();
|
||||
lock (tableDfns)
|
||||
{
|
||||
tableDfns.Clear();
|
||||
tableDfnsPopulated = false;
|
||||
}
|
||||
}
|
||||
public override DbDfnTable GetTableDfn(String tableName, bool refresh = false)
|
||||
{
|
||||
lock (tables)
|
||||
lock (tableDfns)
|
||||
{
|
||||
if (!tables.GetNames().Contains(tableName) || refresh)
|
||||
if (!tableDfns.Keys.Contains(tableName) || refresh)
|
||||
{
|
||||
// Remove current table definition.
|
||||
tables.RemoveAll(item => item.Name.EqualsCI(tableName));
|
||||
tableDfns.Remove(tableName);
|
||||
}
|
||||
// Only populate the specified table if required.
|
||||
if (!tables.Exists(item => item.Name.EqualsCI(tableName) && item.Columns.Count > 0))
|
||||
DbDfnTable table = tableDfns.GetValueOrDefault(tableName);
|
||||
if (table == null || !table.HasColumns())
|
||||
{
|
||||
using (DbConnection dbConnection = CreateConnection(true))
|
||||
{
|
||||
dbConnection.Open();
|
||||
if (!tables.Exists(item => item.Name.EqualsCI(tableName)))
|
||||
PopulateTableNames(dbConnection, tableName);
|
||||
DbDfnTable table = tables.GetTableByName(tableName);
|
||||
if (!tableDfns.ContainsKey(tableName))
|
||||
tableDfns.AddRange(GetTableDefinitions(dbConnection, tableName).ToDictionary(table => table.Name, table => table));
|
||||
table = tableDfns.GetValueOrDefault(tableName);
|
||||
if (table != null && (!table.HasColumns() || refresh))
|
||||
{
|
||||
PopulateTableColumns(dbConnection, table);
|
||||
@@ -424,17 +434,14 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
}
|
||||
}
|
||||
}
|
||||
return tables.GetTableByName(tableName);
|
||||
return tableDfns.GetValueOrDefault(tableName);
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
private void PopulateTableNames(DbConnection dbConnection, String tableNameRestriction = null)
|
||||
private static List<DbDfnTable> GetTableDefinitions(DbConnection dbConnection, String tableNameRestriction = null)
|
||||
{
|
||||
lock (tables)
|
||||
{
|
||||
if (StringUtil.IsEmpty(tableNameRestriction) && tables.Count > 0) return;
|
||||
if (!StringUtil.IsEmpty(tableNameRestriction) && tables.Exists(item => item.Name.Equals(tableNameRestriction))) return;
|
||||
List<DbDfnTable> tables = new List<DbDfnTable>();
|
||||
if (SacsSystem.DebugMode) SaLogger.Debug(SysUtil.Fn + (!StringUtil.IsEmpty(tableNameRestriction) ? " Table: " + tableNameRestriction : " "));
|
||||
String[] restrictions = new String[] { null, null, tableNameRestriction }; // database, owner, table name, type
|
||||
using (DataTable tableSchema = dbConnection.GetSchema(OdbcMetaDataCollectionNames.Tables, restrictions))
|
||||
@@ -478,7 +485,7 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
SaLogger.Warn($"{SysUtil.Fn} Unrecognised column name: '{colName}'");
|
||||
}
|
||||
// TODO Why is Type sometimes "BASE TABLE"?
|
||||
if (!StringUtil.IsEmpty(tableName) && (type.EqualsCI("Table") || type.EqualsCI("Base Table")) && (!schema.EqualsCI("sys") || !tableName.Left(9).EqualsCI("trace_xe_")))
|
||||
if (!StringUtil.IsEmpty(tableName) && (type.EqualsCI("Table") || type.EqualsCI("Base Table")) && (!schema.EqualsCI("sys") || !tableName.StartsWithCI("trace_xe_")))
|
||||
{
|
||||
#if DEBUG
|
||||
//SaLogger.Trace($"{SysUtil.Fn} Database={database}, Schema={schema}, Table={tableName}, Type={type}");
|
||||
@@ -487,12 +494,9 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
}
|
||||
}
|
||||
}
|
||||
List<DbDfnTable> tablesUnsorted = tables.ToList();
|
||||
if (SacsSystem.DebugMode && tablesUnsorted.Exists(item => item == null))
|
||||
if (SacsSystem.DebugMode && tables.Exists(item => item == null))
|
||||
Debugger.Break();
|
||||
tables.Clear();
|
||||
tables.AddRange(tablesUnsorted.OrderBy(item => item.Name).ToList());
|
||||
}
|
||||
return tables.OrderBy(item => item.Name).ToList();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
{
|
||||
ClearErrorState();
|
||||
throw new NotImplementedException();
|
||||
//return !HasErrorState();
|
||||
//return OK;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
@@ -215,7 +215,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
if (!interfaceMgr.UpdateInterfaceProcess(interfaceProcess, dbUpdateInfo))
|
||||
return SetErrorState("Failed to update process - " + interfaceMgr.ErrorStateMessage);
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
@@ -237,7 +237,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
if (!interfaceMgr.InsertInterfaceProcessMessage(interfaceProcessMessage, dbUpdateInfo))
|
||||
return SetErrorState(interfaceMgr.ErrorStateMessage);
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -143,7 +143,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -174,7 +174,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -533,7 +533,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -144,7 +144,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -175,7 +175,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -419,7 +419,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -165,7 +165,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -200,7 +200,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearInterfaceProcessDataItems(List<SysId> interfaceProcessIdsToClear, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
@@ -226,7 +226,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool DeleteInterfaceProcess(SaInterfaceProcess interfaceProcess, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
@@ -248,7 +248,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -657,7 +657,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -182,7 +182,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -213,7 +213,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -492,7 +492,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,28 +100,28 @@ namespace Sarand.Net.Standard.Dbas.ItemData
|
||||
if (!itemDataMgr.UpdateItemData(itemData, dbUpdateInfo))
|
||||
return SetErrorState(itemDataMgr.ErrorStateMessage);
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool Remove (SaItemData itemData, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!itemDataMgr.DeleteItemData(itemData, dbUpdateInfo))
|
||||
return SetErrorState(itemDataMgr.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearItemData (ItemId itemId, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!itemDataMgr.ClearItemData(itemId, dbUpdateInfo))
|
||||
return SetErrorState(itemDataMgr.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearItemData (ItemId itemId, String dataType, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!itemDataMgr.ClearItemData(itemId, dataType, dbUpdateInfo))
|
||||
return SetErrorState(itemDataMgr.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace Sarand.Net.Standard.Dbas.ItemData
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -199,7 +199,7 @@ namespace Sarand.Net.Standard.Dbas.ItemData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -224,7 +224,7 @@ namespace Sarand.Net.Standard.Dbas.ItemData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -255,24 +255,24 @@ namespace Sarand.Net.Standard.Dbas.ItemData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearItemData(ItemId itemId, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!ItemId.IsValid(itemId)) return SetErrorState("Item Id must be specified");
|
||||
if (!ItemId.IsValid(itemId)) return SetErrorState(Msg_ItemIdNotSpecified);
|
||||
String colItemType = SaItemDataDbDfn.GetColumnName(SaItemDataDbDfn.ColumnIdx.SaItemData_ItemType);
|
||||
String colItemId = SaItemDataDbDfn.GetColumnName(SaItemDataDbDfn.ColumnIdx.SaItemData_ItemId);
|
||||
String query = "Delete From " + TableName_ItemData + " WHERE " + colItemType + "=" + itemId.Type.ToString() + " AND " + colItemId + "=" + SysId.ToString(itemId.Id);
|
||||
Database.ExecuteNonQuery(query);
|
||||
if (Database.HasErrorState())
|
||||
SetErrorState("Failed to clear Item Data - " + Database.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearItemData(ItemId itemId, String dataType, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!ItemId.IsValid(itemId)) return SetErrorState("Item Id must be specified");
|
||||
if (!ItemId.IsValid(itemId)) return SetErrorState(Msg_ItemIdNotSpecified);
|
||||
if (StringUtil.IsEmpty(dataType)) return SetErrorState("Data type must be specified");
|
||||
String colItemType = SaItemDataDbDfn.GetColumnName(SaItemDataDbDfn.ColumnIdx.SaItemData_ItemType);
|
||||
String colItemId = SaItemDataDbDfn.GetColumnName(SaItemDataDbDfn.ColumnIdx.SaItemData_ItemId);
|
||||
@@ -281,7 +281,7 @@ namespace Sarand.Net.Standard.Dbas.ItemData
|
||||
Database.ExecuteNonQuery(query);
|
||||
if (Database.HasErrorState())
|
||||
SetErrorState("Failed to clear Item Data - " + Database.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -522,7 +522,7 @@ namespace Sarand.Net.Standard.Dbas.ItemData
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Sarand.Net.Standard.Dbas.ItemDocs
|
||||
while (recentFolders.Count > GetMaxRecentFolderCount())
|
||||
recentFolders.RemoveAt(recentFolders.Count - 1);
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool StoreItemDocs(List<SaItemDoc> itemDocs, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
@@ -150,21 +150,21 @@ namespace Sarand.Net.Standard.Dbas.ItemDocs
|
||||
ClearErrorState();
|
||||
if (!itemDocMgr.DeleteItemDoc(itemDoc, dbUpdateInfo))
|
||||
return SetErrorState(itemDocMgr.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearItemDocs(ItemId itemId, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!itemDocMgr.ClearItemDocs(itemId, dbUpdateInfo))
|
||||
return SetErrorState(itemDocMgr.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearItemDocs(ItemId itemId, Category category, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!itemDocMgr.ClearItemDocs(itemId, category, dbUpdateInfo))
|
||||
return SetErrorState(itemDocMgr.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -227,7 +227,7 @@ namespace Sarand.Net.Standard.Dbas.ItemDocs
|
||||
itemDocs.Add(itemDoc);
|
||||
if (!StoreItemDoc(itemDoc, dbUpdateInfo)) return false;
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Sarand.Net.Standard.Dbas.ItemDocs
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ namespace Sarand.Net.Standard.Dbas.ItemDocs
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -202,7 +202,7 @@ namespace Sarand.Net.Standard.Dbas.ItemDocs
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -233,24 +233,24 @@ namespace Sarand.Net.Standard.Dbas.ItemDocs
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearItemDocs (ItemId itemId, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!ItemId.IsValid(itemId)) return SetErrorState("Item Id must be specified");
|
||||
if (!ItemId.IsValid(itemId)) return SetErrorState(Msg_ItemIdNotSpecified);
|
||||
String colItemType = SaItemDocsDbDfn.GetColumnName(SaItemDocsDbDfn.ColumnIdx.SaItemDoc_ItemType);
|
||||
String colItemId = SaItemDocsDbDfn.GetColumnName(SaItemDocsDbDfn.ColumnIdx.SaItemDoc_ItemId);
|
||||
String query = "Delete From "+TableName_ItemDoc+" WHERE "+colItemType+"="+itemId.Type.ToString()+" AND "+colItemId+"="+SysId.ToString(itemId.Id);
|
||||
Database.ExecuteNonQuery(query);
|
||||
if (Database.HasErrorState())
|
||||
SetErrorState("Failed to clear Items - " + Database.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearItemDocs (ItemId itemId, SaItemDocConsole.Category category, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!ItemId.IsValid(itemId)) return SetErrorState("Item Id must be specified");
|
||||
if (!ItemId.IsValid(itemId)) return SetErrorState(Msg_ItemIdNotSpecified);
|
||||
if ((int)category < 1) return SetErrorState("Category must be specified");
|
||||
String colItemType = SaItemDocsDbDfn.GetColumnName(SaItemDocsDbDfn.ColumnIdx.SaItemDoc_ItemType);
|
||||
String colItemId = SaItemDocsDbDfn.GetColumnName(SaItemDocsDbDfn.ColumnIdx.SaItemDoc_ItemId);
|
||||
@@ -259,7 +259,7 @@ namespace Sarand.Net.Standard.Dbas.ItemDocs
|
||||
Database.ExecuteNonQuery(query);
|
||||
if (Database.HasErrorState())
|
||||
SetErrorState("Failed to clear Items - " + Database.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -558,7 +558,7 @@ namespace Sarand.Net.Standard.Dbas.ItemDocs
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:46
|
||||
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:21
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.Net.Standard.Dbas.ItemOptions.Internal
|
||||
{
|
||||
@@ -37,7 +38,7 @@ namespace Sarand.Net.Standard.Dbas.ItemOptions.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static List<String> fields { get; } = new List<String>()
|
||||
protected static List<String> fields { get; } = new List<String>()
|
||||
{
|
||||
"ItemType",
|
||||
"ItemId",
|
||||
@@ -54,17 +55,22 @@ namespace Sarand.Net.Standard.Dbas.ItemOptions.Internal
|
||||
"UpdateBy",
|
||||
"UpdateHost",
|
||||
};
|
||||
private static List<String> fieldsId { get; } = new List<String>()
|
||||
protected static List<String> fieldsId { get; } = new List<String>()
|
||||
{
|
||||
};
|
||||
private static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
protected static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
{
|
||||
"ItemType",
|
||||
"ItemId",
|
||||
"Name",
|
||||
"Context",
|
||||
};
|
||||
private static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
protected static List<String> fieldsNullable { get; } = new List<String>()
|
||||
{
|
||||
"CreateHost",
|
||||
"UpdateHost",
|
||||
};
|
||||
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
{
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
@@ -77,7 +83,7 @@ namespace Sarand.Net.Standard.Dbas.ItemOptions.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
internal SaItemOption_Db (IDatabaseInfo dbInfo = null) : base(dbInfo)
|
||||
internal SaItemOption_Db (IDatabaseInfo dbInfo) : base(dbInfo)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -108,6 +114,7 @@ namespace Sarand.Net.Standard.Dbas.ItemOptions.Internal
|
||||
// Existing columns - confirmed on database if table exists.
|
||||
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
|
||||
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
|
||||
public List<String> UpdatableColumns { get { return ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList(); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
@@ -184,10 +191,15 @@ namespace Sarand.Net.Standard.Dbas.ItemOptions.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand, List<String> columnsToUpdate = null)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
List<String> columnNames = (columnsToUpdate?.Any() ?? false ? columnsToUpdate : UpdatableColumns).Where(col => UpdatableColumns.ContainsCI(col)).ToList();
|
||||
if (!columnNames.Any())
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} No columns to update. [{GetType().Name}]");
|
||||
return false;
|
||||
}
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Sarand.Net.Standard.Dbas.ItemOptions
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -179,7 +179,7 @@ namespace Sarand.Net.Standard.Dbas.ItemOptions
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -204,7 +204,7 @@ namespace Sarand.Net.Standard.Dbas.ItemOptions
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -235,19 +235,19 @@ namespace Sarand.Net.Standard.Dbas.ItemOptions
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearItemOptionsForItem (ItemId itemId, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!ItemId.IsValid(itemId)) return SetErrorState("Item Id must be specified");
|
||||
if (!ItemId.IsValid(itemId)) return SetErrorState(Msg_ItemIdNotSpecified);
|
||||
String colItemType = SaItemOptionDbDfn.GetColumnName(SaItemOptionDbDfn.ColumnIdx.SaItemOption_ItemType);
|
||||
String colItemId = SaItemOptionDbDfn.GetColumnName(SaItemOptionDbDfn.ColumnIdx.SaItemOption_ItemId);
|
||||
String query = "Delete From "+TableName_ItemOption+" WHERE "+colItemType+"="+itemId.Type.ToString()+" AND "+colItemId+"="+SysId.ToString(itemId.Id);
|
||||
Database.ExecuteNonQuery(query);
|
||||
if (Database.HasErrorState())
|
||||
SetErrorState("Failed to clear item options - " + Database.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -510,7 +510,7 @@ namespace Sarand.Net.Standard.Dbas.ItemOptions
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,13 @@ namespace Sarand.Net.Standard.Dbas.ItemOptions
|
||||
config.DefinitionClass.Namespace = "Sarand.Net.Standard.Base.ItemOptions";
|
||||
config.DefinitionClass.Classname = "SaItemOptionDbDfn";
|
||||
// Table class.
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.App");
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Core");
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Utils");
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Dbas");
|
||||
config.TableClass.Namespace = "Sarand.Net.Standard.Dbas.ItemOptions.Internal";
|
||||
config.TableClass.ClassName_DatabaseInfo = "IDatabaseInfo";
|
||||
config.TableClass.MandatoryConstructorDbInfo = true;
|
||||
|
||||
// Generate database definition.
|
||||
DatabaseDefinitionGenerator generator = new DatabaseDefinitionGenerator();
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Sarand.LogisticsMgr.Win.Dbas.UpdateLog
|
||||
RecordAttrValue(SaItemOptionDbDfn.GetColumnName(SaItemOptionDbDfn.ColumnIdx.SaItemOption_Notes, false), new DataValue(itemOption.Notes), newValues);
|
||||
RecordAttrValue(SaItemOptionDbDfn.GetColumnName(SaItemOptionDbDfn.ColumnIdx.SaItemOption_Status, false), new DataValue(SacsSystem.GetStatusCode(itemOption.Status)), newValues);
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -125,14 +125,14 @@ namespace Sarand.Net.Standard.Dbas.Proc
|
||||
private void CompareTables()
|
||||
{
|
||||
// Database schemas.
|
||||
List<String> sourceTables = (config.SourceDatabase?.GetTableNames(true) ?? config.SourceTables.Select(item => item.Name)).OrderBy(item => item).ToList();
|
||||
List<String> targetTables = config.TargetDatabase.GetTableNames(true).OrderBy(item => item).ToList();
|
||||
HashSet<String> sourceTables = (config.SourceDatabase?.GetTableNames(true) ?? config.SourceTables.Select(item => item.Name)).OrderBy(item => item).ToHashSet();
|
||||
HashSet<String> targetTables = config.TargetDatabase.GetTableNames(true).OrderBy(item => item).ToHashSet();
|
||||
|
||||
for (int sourceTableIdx = 0, targetTableIdx = 0; sourceTableIdx < sourceTables.Count || targetTableIdx < targetTables.Count;)
|
||||
{
|
||||
// Next tables in sequence.
|
||||
String sourceTableName = (sourceTableIdx < sourceTables.Count ? sourceTables[sourceTableIdx] : "");
|
||||
String targetTableName = (targetTableIdx < targetTables.Count ? targetTables[targetTableIdx] : "");
|
||||
String sourceTableName = (sourceTableIdx < sourceTables.Count ? sourceTables.ElementAt(sourceTableIdx) : "");
|
||||
String targetTableName = (targetTableIdx < targetTables.Count ? targetTables.ElementAt(targetTableIdx) : "");
|
||||
|
||||
// Retrieve table definition from each database.
|
||||
DbDfnTable sourceTableDfn = !StringUtil.IsBlank(sourceTableName) ? config.SourceDatabase?.GetTableDfn(sourceTableName, true) ?? config.SourceTables.GetTableByName(sourceTableName) : null;
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple currencys found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SaCurrency currency = null;
|
||||
@@ -85,7 +85,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -167,7 +167,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -198,7 +198,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -450,7 +450,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple languages found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SaLanguage language = null;
|
||||
@@ -85,7 +85,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -167,7 +167,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -198,7 +198,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -459,7 +459,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple regions found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SaRegion region = null;
|
||||
@@ -85,7 +85,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -167,7 +167,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -198,7 +198,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -436,7 +436,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple taxCodes found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SaTaxCode taxCode = null;
|
||||
@@ -85,7 +85,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -167,7 +167,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -198,7 +198,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -478,7 +478,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
if (count == 0) return null;
|
||||
if (count != 1)
|
||||
{
|
||||
SetErrorState("Multiple unitMeasures found");
|
||||
SetErrorState(Msg_MultipleItemsFound);
|
||||
return null;
|
||||
}
|
||||
SaUnitMeasure unitMeasure = null;
|
||||
@@ -85,7 +85,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -138,7 +138,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -167,7 +167,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -198,7 +198,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -479,7 +479,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData.UpdateLog
|
||||
RecordAttrValue(SaReferenceDataDbDfn.ColumnIdx.Currency_Status, SacsSystem.GetStatusCode(currency.Status), newValues);
|
||||
*/
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData.UpdateLog
|
||||
RecordAttrValue(SaReferenceDataDbDfn.ColumnIdx.Language_Status, SacsSystem.GetStatusCode(language.Status), newValues);
|
||||
*/
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData.UpdateLog
|
||||
RecordAttrValue(SaReferenceDataDbDfn.ColumnIdx.Region_Status, SacsSystem.GetStatusCode(region.Status), newValues);
|
||||
*/
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData.UpdateLog
|
||||
RecordAttrValue(SaReferenceDataDbDfn.ColumnIdx.TaxCode_Status, SacsSystem.GetStatusCode(taxcode.Status), newValues);
|
||||
*/
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData.UpdateLog
|
||||
RecordAttrValue(SaReferenceDataDbDfn.ColumnIdx.UnitMeasure_Status, SacsSystem.GetStatusCode(unitMeasure.Status), newValues);
|
||||
*/
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:38
|
||||
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:20
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
{
|
||||
@@ -25,11 +26,16 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
public ColumnDataByte _Type { get; } = new ColumnDataByte("Type");
|
||||
public ColumnDataString _EmailAddress { get; } = new ColumnDataString("EmailAddress");
|
||||
public ColumnDataString _Location { get; } = new ColumnDataString("Location");
|
||||
public ColumnDataInt16 _DataItemType { get; } = new ColumnDataInt16("DataItemType");
|
||||
public ColumnDataString _EncPword { get; } = new ColumnDataString("EncPword");
|
||||
public ColumnDataString _PwordSalt { get; } = new ColumnDataString("PwordSalt");
|
||||
public ColumnDataString _PwordHash { get; } = new ColumnDataString("PwordHash");
|
||||
public ColumnDataDateTime _LastLogin { get; } = new ColumnDataDateTime("LastLogin");
|
||||
public ColumnDataInt16 _DataItemType { get; } = new ColumnDataInt16("DataItemType");
|
||||
public ColumnDataString _PasswordToken { get; } = new ColumnDataString("PasswordToken");
|
||||
public ColumnDataString _PasswordHistory { get; } = new ColumnDataString("PasswordHistory");
|
||||
public ColumnDataDateTimeNullable _PasswordChangedAt { get; } = new ColumnDataDateTimeNullable("PasswordChangedAt");
|
||||
public ColumnDataDateTimeNullable _LastLogin { get; } = new ColumnDataDateTimeNullable("LastLogin");
|
||||
public ColumnDataDateTimeNullable _LastInvalidLoginAt { get; } = new ColumnDataDateTimeNullable("LastInvalidLoginAt");
|
||||
public ColumnDataInt16 _InvalidLoginCount { get; } = new ColumnDataInt16("InvalidLoginCount");
|
||||
public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
|
||||
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
|
||||
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
|
||||
@@ -43,7 +49,7 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static List<String> fields { get; } = new List<String>()
|
||||
protected static List<String> fields { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
"Code",
|
||||
@@ -51,11 +57,16 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
"Type",
|
||||
"EmailAddress",
|
||||
"Location",
|
||||
"DataItemType",
|
||||
"EncPword",
|
||||
"PwordSalt",
|
||||
"PwordHash",
|
||||
"PasswordToken",
|
||||
"PasswordHistory",
|
||||
"PasswordChangedAt",
|
||||
"LastLogin",
|
||||
"DataItemType",
|
||||
"LastInvalidLoginAt",
|
||||
"InvalidLoginCount",
|
||||
"Notes",
|
||||
"Flags",
|
||||
"Status",
|
||||
@@ -66,14 +77,25 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
"UpdateBy",
|
||||
"UpdateHost",
|
||||
};
|
||||
private static List<String> fieldsId { get; } = new List<String>()
|
||||
protected static List<String> fieldsId { get; } = new List<String>()
|
||||
{
|
||||
};
|
||||
private static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
protected static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
{
|
||||
"Id",
|
||||
};
|
||||
private static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
protected static List<String> fieldsNullable { get; } = new List<String>()
|
||||
{
|
||||
"EncPword",
|
||||
"PwordSalt",
|
||||
"PwordHash",
|
||||
"PasswordToken",
|
||||
"PasswordHistory",
|
||||
"PasswordChangedAt",
|
||||
"LastLogin",
|
||||
"LastInvalidLoginAt",
|
||||
};
|
||||
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
{
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
@@ -104,11 +126,16 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
public Byte _Type { get { return Cols._Type.Value; } set { Cols._Type.Value = value; } }
|
||||
public String _EmailAddress { get { return Cols._EmailAddress.Value; } set { Cols._EmailAddress.Value = value; } }
|
||||
public String _Location { get { return Cols._Location.Value; } set { Cols._Location.Value = value; } }
|
||||
public Int16 _DataItemType { get { return Cols._DataItemType.Value; } set { Cols._DataItemType.Value = value; } }
|
||||
public String _EncPword { get { return Cols._EncPword.Value; } set { Cols._EncPword.Value = value; } }
|
||||
public String _PwordSalt { get { return Cols._PwordSalt.Value; } set { Cols._PwordSalt.Value = value; } }
|
||||
public String _PwordHash { get { return Cols._PwordHash.Value; } set { Cols._PwordHash.Value = value; } }
|
||||
public DateTime _LastLogin { get { return Cols._LastLogin.Value; } set { Cols._LastLogin.Value = value; } }
|
||||
public Int16 _DataItemType { get { return Cols._DataItemType.Value; } set { Cols._DataItemType.Value = value; } }
|
||||
public String _PasswordToken { get { return Cols._PasswordToken.Value; } set { Cols._PasswordToken.Value = value; } }
|
||||
public String _PasswordHistory { get { return Cols._PasswordHistory.Value; } set { Cols._PasswordHistory.Value = value; } }
|
||||
public DateTime? _PasswordChangedAt { get { return Cols._PasswordChangedAt.Value; } set { Cols._PasswordChangedAt.Value = value; } }
|
||||
public DateTime? _LastLogin { get { return Cols._LastLogin.Value; } set { Cols._LastLogin.Value = value; } }
|
||||
public DateTime? _LastInvalidLoginAt { get { return Cols._LastInvalidLoginAt.Value; } set { Cols._LastInvalidLoginAt.Value = value; } }
|
||||
public Int16 _InvalidLoginCount { get { return Cols._InvalidLoginCount.Value; } set { Cols._InvalidLoginCount.Value = value; } }
|
||||
public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
|
||||
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
|
||||
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
|
||||
@@ -121,6 +148,7 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
// Existing columns - confirmed on database if table exists.
|
||||
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
|
||||
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
|
||||
public List<String> UpdatableColumns { get { return ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList(); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
@@ -145,11 +173,16 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
_Type = GetFieldByte(dbDataReader, "Type", _Type);
|
||||
_EmailAddress = GetFieldString(dbDataReader, "EmailAddress", _EmailAddress);
|
||||
_Location = GetFieldString(dbDataReader, "Location", _Location);
|
||||
_DataItemType = GetFieldInt16(dbDataReader, "DataItemType", _DataItemType);
|
||||
_EncPword = GetFieldString(dbDataReader, "EncPword", _EncPword);
|
||||
_PwordSalt = GetFieldString(dbDataReader, "PwordSalt", _PwordSalt);
|
||||
_PwordHash = GetFieldString(dbDataReader, "PwordHash", _PwordHash);
|
||||
_LastLogin = GetFieldDateTime(dbDataReader, "LastLogin", _LastLogin);
|
||||
_DataItemType = GetFieldInt16(dbDataReader, "DataItemType", _DataItemType);
|
||||
_PasswordToken = GetFieldString(dbDataReader, "PasswordToken", _PasswordToken);
|
||||
_PasswordHistory = GetFieldString(dbDataReader, "PasswordHistory", _PasswordHistory);
|
||||
_PasswordChangedAt = GetFieldDateTimeNullable(dbDataReader, "PasswordChangedAt", _PasswordChangedAt);
|
||||
_LastLogin = GetFieldDateTimeNullable(dbDataReader, "LastLogin", _LastLogin);
|
||||
_LastInvalidLoginAt = GetFieldDateTimeNullable(dbDataReader, "LastInvalidLoginAt", _LastInvalidLoginAt);
|
||||
_InvalidLoginCount = GetFieldInt16(dbDataReader, "InvalidLoginCount", _InvalidLoginCount);
|
||||
_Notes = GetFieldString(dbDataReader, "Notes", _Notes);
|
||||
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
|
||||
_Status = GetFieldString(dbDataReader, "Status", _Status);
|
||||
@@ -183,11 +216,16 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
if (columnNames.ContainsCI("Type")) AddCommandParameter(dbCommand, "@Type", _Type);
|
||||
if (columnNames.ContainsCI("EmailAddress")) AddCommandParameter(dbCommand, "@EmailAddress", _EmailAddress);
|
||||
if (columnNames.ContainsCI("Location")) AddCommandParameter(dbCommand, "@Location", _Location);
|
||||
if (columnNames.ContainsCI("DataItemType")) AddCommandParameter(dbCommand, "@DataItemType", _DataItemType);
|
||||
if (columnNames.ContainsCI("EncPword")) AddCommandParameter(dbCommand, "@EncPword", _EncPword);
|
||||
if (columnNames.ContainsCI("PwordSalt")) AddCommandParameter(dbCommand, "@PwordSalt", _PwordSalt);
|
||||
if (columnNames.ContainsCI("PwordHash")) AddCommandParameter(dbCommand, "@PwordHash", _PwordHash);
|
||||
if (columnNames.ContainsCI("PasswordToken")) AddCommandParameter(dbCommand, "@PasswordToken", _PasswordToken);
|
||||
if (columnNames.ContainsCI("PasswordHistory")) AddCommandParameter(dbCommand, "@PasswordHistory", _PasswordHistory);
|
||||
if (columnNames.ContainsCI("PasswordChangedAt")) AddCommandParameter(dbCommand, "@PasswordChangedAt", _PasswordChangedAt);
|
||||
if (columnNames.ContainsCI("LastLogin")) AddCommandParameter(dbCommand, "@LastLogin", _LastLogin);
|
||||
if (columnNames.ContainsCI("DataItemType")) AddCommandParameter(dbCommand, "@DataItemType", _DataItemType);
|
||||
if (columnNames.ContainsCI("LastInvalidLoginAt")) AddCommandParameter(dbCommand, "@LastInvalidLoginAt", _LastInvalidLoginAt);
|
||||
if (columnNames.ContainsCI("InvalidLoginCount")) AddCommandParameter(dbCommand, "@InvalidLoginCount", _InvalidLoginCount);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
@@ -209,10 +247,15 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand, List<String> columnsToUpdate = null)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
List<String> columnNames = (columnsToUpdate?.Any() ?? false ? columnsToUpdate : UpdatableColumns).Where(col => UpdatableColumns.ContainsCI(col)).ToList();
|
||||
if (!columnNames.Any())
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} No columns to update. [{GetType().Name}]");
|
||||
return false;
|
||||
}
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
@@ -233,11 +276,16 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
if (columnNames.ContainsCI("Type")) AddCommandParameter(dbCommand, "@Type", _Type);
|
||||
if (columnNames.ContainsCI("EmailAddress")) AddCommandParameter(dbCommand, "@EmailAddress", _EmailAddress);
|
||||
if (columnNames.ContainsCI("Location")) AddCommandParameter(dbCommand, "@Location", _Location);
|
||||
if (columnNames.ContainsCI("DataItemType")) AddCommandParameter(dbCommand, "@DataItemType", _DataItemType);
|
||||
if (columnNames.ContainsCI("EncPword")) AddCommandParameter(dbCommand, "@EncPword", _EncPword);
|
||||
if (columnNames.ContainsCI("PwordSalt")) AddCommandParameter(dbCommand, "@PwordSalt", _PwordSalt);
|
||||
if (columnNames.ContainsCI("PwordHash")) AddCommandParameter(dbCommand, "@PwordHash", _PwordHash);
|
||||
if (columnNames.ContainsCI("PasswordToken")) AddCommandParameter(dbCommand, "@PasswordToken", _PasswordToken);
|
||||
if (columnNames.ContainsCI("PasswordHistory")) AddCommandParameter(dbCommand, "@PasswordHistory", _PasswordHistory);
|
||||
if (columnNames.ContainsCI("PasswordChangedAt")) AddCommandParameter(dbCommand, "@PasswordChangedAt", _PasswordChangedAt);
|
||||
if (columnNames.ContainsCI("LastLogin")) AddCommandParameter(dbCommand, "@LastLogin", _LastLogin);
|
||||
if (columnNames.ContainsCI("DataItemType")) AddCommandParameter(dbCommand, "@DataItemType", _DataItemType);
|
||||
if (columnNames.ContainsCI("LastInvalidLoginAt")) AddCommandParameter(dbCommand, "@LastInvalidLoginAt", _LastInvalidLoginAt);
|
||||
if (columnNames.ContainsCI("InvalidLoginCount")) AddCommandParameter(dbCommand, "@InvalidLoginCount", _InvalidLoginCount);
|
||||
if (columnNames.ContainsCI("Notes")) AddCommandParameter(dbCommand, "@Notes", _Notes);
|
||||
if (columnNames.ContainsCI("Flags")) AddCommandParameter(dbCommand, "@Flags", _Flags);
|
||||
if (columnNames.ContainsCI("Status")) AddCommandParameter(dbCommand, "@Status", _Status);
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using Sarand.Net.Standard.Base.Dbas;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:38
|
||||
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:20
|
||||
//---------------------------------------------------------------------------
|
||||
namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
{
|
||||
@@ -23,21 +24,21 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
public ColumnDataInt32 _ItemTarget { get; } = new ColumnDataInt32("ItemTarget");
|
||||
public ColumnDataInt32 _ItemContext { get; } = new ColumnDataInt32("ItemContext");
|
||||
public ColumnDataString _DayApplic { get; } = new ColumnDataString("DayApplic");
|
||||
public ColumnDataInt32 _DateApplicFrom { get; } = new ColumnDataInt32("DateApplicFrom");
|
||||
public ColumnDataInt32 _DateApplicTo { get; } = new ColumnDataInt32("DateApplicTo");
|
||||
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
|
||||
public ColumnDataInt32Nullable _DateApplicFrom { get; } = new ColumnDataInt32Nullable("DateApplicFrom");
|
||||
public ColumnDataInt32Nullable _DateApplicTo { get; } = new ColumnDataInt32Nullable("DateApplicTo");
|
||||
public ColumnDataInt16Nullable _Flags { get; } = new ColumnDataInt16Nullable("Flags");
|
||||
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
|
||||
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
|
||||
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
|
||||
public ColumnDataDateTimeNullable _CreateOn { get; } = new ColumnDataDateTimeNullable("CreateOn");
|
||||
public ColumnDataInt32Nullable _CreateBy { get; } = new ColumnDataInt32Nullable("CreateBy");
|
||||
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
|
||||
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
|
||||
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
|
||||
public ColumnDataDateTimeNullable _UpdateOn { get; } = new ColumnDataDateTimeNullable("UpdateOn");
|
||||
public ColumnDataInt32Nullable _UpdateBy { get; } = new ColumnDataInt32Nullable("UpdateBy");
|
||||
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Data members.
|
||||
private static List<String> fields { get; } = new List<String>()
|
||||
protected static List<String> fields { get; } = new List<String>()
|
||||
{
|
||||
"ItemOwner",
|
||||
"ItemTarget",
|
||||
@@ -54,16 +55,30 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
"UpdateBy",
|
||||
"UpdateHost",
|
||||
};
|
||||
private static List<String> fieldsId { get; } = new List<String>()
|
||||
protected static List<String> fieldsId { get; } = new List<String>()
|
||||
{
|
||||
};
|
||||
private static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
protected static List<String> fieldsPrimary { get; } = new List<String>()
|
||||
{
|
||||
"ItemOwner",
|
||||
"ItemTarget",
|
||||
"ItemContext",
|
||||
};
|
||||
private static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
protected static List<String> fieldsNullable { get; } = new List<String>()
|
||||
{
|
||||
"DayApplic",
|
||||
"DateApplicFrom",
|
||||
"DateApplicTo",
|
||||
"Flags",
|
||||
"Status",
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
"CreateHost",
|
||||
"UpdateOn",
|
||||
"UpdateBy",
|
||||
"UpdateHost",
|
||||
};
|
||||
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
|
||||
{
|
||||
"CreateOn",
|
||||
"CreateBy",
|
||||
@@ -91,19 +106,20 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
public Int32 _ItemTarget { get { return Cols._ItemTarget.Value; } set { Cols._ItemTarget.Value = value; } }
|
||||
public Int32 _ItemContext { get { return Cols._ItemContext.Value; } set { Cols._ItemContext.Value = value; } }
|
||||
public String _DayApplic { get { return Cols._DayApplic.Value; } set { Cols._DayApplic.Value = value; } }
|
||||
public Int32 _DateApplicFrom { get { return Cols._DateApplicFrom.Value; } set { Cols._DateApplicFrom.Value = value; } }
|
||||
public Int32 _DateApplicTo { get { return Cols._DateApplicTo.Value; } set { Cols._DateApplicTo.Value = value; } }
|
||||
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
|
||||
public Int32? _DateApplicFrom { get { return Cols._DateApplicFrom.Value; } set { Cols._DateApplicFrom.Value = value; } }
|
||||
public Int32? _DateApplicTo { get { return Cols._DateApplicTo.Value; } set { Cols._DateApplicTo.Value = value; } }
|
||||
public Int16? _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
|
||||
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
|
||||
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
|
||||
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
|
||||
public DateTime? _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
|
||||
public Int32? _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
|
||||
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
|
||||
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
|
||||
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
|
||||
public DateTime? _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
|
||||
public Int32? _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
|
||||
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
|
||||
// Existing columns - confirmed on database if table exists.
|
||||
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
|
||||
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
|
||||
public List<String> UpdatableColumns { get { return ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList(); } }
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Population.
|
||||
@@ -126,15 +142,15 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
_ItemTarget = GetFieldInt32(dbDataReader, "ItemTarget", _ItemTarget);
|
||||
_ItemContext = GetFieldInt32(dbDataReader, "ItemContext", _ItemContext);
|
||||
_DayApplic = GetFieldString(dbDataReader, "DayApplic", _DayApplic);
|
||||
_DateApplicFrom = GetFieldInt32(dbDataReader, "DateApplicFrom", _DateApplicFrom);
|
||||
_DateApplicTo = GetFieldInt32(dbDataReader, "DateApplicTo", _DateApplicTo);
|
||||
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
|
||||
_DateApplicFrom = GetFieldInt32Nullable(dbDataReader, "DateApplicFrom", _DateApplicFrom);
|
||||
_DateApplicTo = GetFieldInt32Nullable(dbDataReader, "DateApplicTo", _DateApplicTo);
|
||||
_Flags = GetFieldInt16Nullable(dbDataReader, "Flags", _Flags);
|
||||
_Status = GetFieldString(dbDataReader, "Status", _Status);
|
||||
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
|
||||
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
|
||||
_CreateOn = GetFieldDateTimeNullable(dbDataReader, "CreateOn", _CreateOn);
|
||||
_CreateBy = GetFieldInt32Nullable(dbDataReader, "CreateBy", _CreateBy);
|
||||
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
|
||||
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
|
||||
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
|
||||
_UpdateOn = GetFieldDateTimeNullable(dbDataReader, "UpdateOn", _UpdateOn);
|
||||
_UpdateBy = GetFieldInt32Nullable(dbDataReader, "UpdateBy", _UpdateBy);
|
||||
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
|
||||
}
|
||||
|
||||
@@ -180,10 +196,15 @@ namespace Sarand.Net.Standard.Dbas.Security.Internal
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update command.
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
|
||||
public override bool ExecuteUpdateCommand (DbCommand dbCommand, List<String> columnsToUpdate = null)
|
||||
{
|
||||
// Columns to update.
|
||||
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
|
||||
List<String> columnNames = (columnsToUpdate?.Any() ?? false ? columnsToUpdate : UpdatableColumns).Where(col => UpdatableColumns.ContainsCI(col)).ToList();
|
||||
if (!columnNames.Any())
|
||||
{
|
||||
SaLogger.Warn($"{SysUtil.Fn} No columns to update. [{GetType().Name}]");
|
||||
return false;
|
||||
}
|
||||
// Construct query.
|
||||
String query = "UPDATE " + TableNameFmt + " SET ";
|
||||
if (dbCommand is SqlCommand)
|
||||
|
||||
@@ -460,7 +460,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(itemId))
|
||||
{
|
||||
SetErrorState("Item id nust be specified");
|
||||
SetErrorState(SacsItemMgr.Msg_ItemIdNotSpecified);
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -492,7 +492,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
ClearErrorState();
|
||||
if (!SysId.IsValid(itemId))
|
||||
{
|
||||
SetErrorState("Item id nust be specified");
|
||||
SetErrorState(SacsItemMgr.Msg_ItemIdNotSpecified);
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -551,16 +551,16 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security item updates.
|
||||
public override bool CreateUser(string code, string name, DbUpdateInfo dbUpdateInfo)
|
||||
private bool CreateSecurityItem(SaSecurity.ItemType securityItemType, String itemTypeCaption, string code, string name, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (StringUtil.IsEmpty(code) || StringUtil.IsEmpty(name))
|
||||
return SetErrorState("User code and name must be supplied");
|
||||
if (SecurityItemCodeExists(SaSecurity.ItemType.User, code))
|
||||
return SetErrorState("User code already exists");
|
||||
if (StringUtil.IsBlank(code) || StringUtil.IsBlank(name))
|
||||
return SetErrorState($"{itemTypeCaption} code and name must be supplied");
|
||||
if (SecurityItemCodeExists(securityItemType, code))
|
||||
return SetErrorState($"{itemTypeCaption} code already exists");
|
||||
|
||||
// Create User.
|
||||
SaSecurityItem secItem = securityMgr.CreateSecurityItem(SaSecurity.ItemType.User);
|
||||
// Create Security Item.
|
||||
SaSecurityItem secItem = securityMgr.CreateSecurityItem(securityItemType);
|
||||
secItem.Code = code;
|
||||
secItem.Description = name;
|
||||
|
||||
@@ -570,6 +570,14 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
|
||||
return OK;
|
||||
}
|
||||
public override bool CreateUser(string code, string name, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
return CreateSecurityItem(SaSecurity.ItemType.User, "User", code, name, dbUpdateInfo);
|
||||
}
|
||||
public override bool CreateGroup(string code, string name, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
return CreateSecurityItem(SaSecurity.ItemType.Group, "Group", code, name, dbUpdateInfo);
|
||||
}
|
||||
public override bool AssignUserToGroup(string userCode, string groupCode, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
@@ -585,12 +593,33 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
if (!ItemsAreLinked(securityItemUser.Id, securityGroupId))
|
||||
{
|
||||
SaSecurityLink securityLinkUserGroup = securityMgr.CreateSecurityLink(securityItemUser.Id, securityGroupId, new SysId());
|
||||
if (securityLinkUserGroup == null) return SetErrorState($"failed to create user-group ({securityMgr.ErrorStateMessage})");
|
||||
if (securityLinkUserGroup == null) return SetErrorState($"failed to create group-user ({securityMgr.ErrorStateMessage})");
|
||||
if (!securityMgr.InsertSecurityLink(securityLinkUserGroup, dbUpdateInfo))
|
||||
return SetErrorState($"failed to add user to group ({securityMgr.ErrorStateMessage})");
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
public override bool AssignRightToGroup(string rightCode, string groupCode, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
// Validate environment.
|
||||
if (securityMgr == null) return SetErrorState("security manager is not available");
|
||||
if (!securityMgr.DatabaseIsValid) return SetErrorState("database has an invalid security profile");
|
||||
// Right security item.
|
||||
SaSecurityItem securityItemRight = securityMgr.GetSecurityItemByTypeCode(SaSecurity.ItemType.Right, rightCode);
|
||||
if (securityItemRight == null) return SetErrorState(("right does not exist"));
|
||||
// Group security item.
|
||||
SysId securityGroupId = GetIdForItemCode(SaSecurity.ItemType.Group, groupCode);
|
||||
if (!SysId.IsValid(securityGroupId)) return SetErrorState(("invalid group code"));
|
||||
if (!ItemsAreLinked(securityItemRight.Id, securityGroupId))
|
||||
{
|
||||
SaSecurityLink securityLinkRightGroup = securityMgr.CreateSecurityLink(securityItemRight.Id, securityGroupId, new SysId());
|
||||
if (securityLinkRightGroup == null) return SetErrorState($"failed to create group-right ({securityMgr.ErrorStateMessage})");
|
||||
if (!securityMgr.InsertSecurityLink(securityLinkRightGroup, dbUpdateInfo))
|
||||
return SetErrorState($"failed to add right to group ({securityMgr.ErrorStateMessage})");
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
public override bool UpdateSecurityItem(SaSecurityItem securityItem, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.App;
|
||||
using Sarand.Net.Standard.Base.Core;
|
||||
using Sarand.Net.Standard.Base.IO;
|
||||
using Sarand.Net.Standard.Base.Utils;
|
||||
using Sarand.Net.Standard.Dbas.Base;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Sarand.Net.Standard.Dbas.Security
|
||||
{
|
||||
@@ -18,7 +18,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Generate database definitions.
|
||||
/// Generate Security database definitions.
|
||||
/// </summary>
|
||||
public static bool Generate(String connectionString)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SaLogger.Error($"{fn} {ExceptionUtil.GetLogMessage(exc, "generating database definition")}");
|
||||
SaLogger.Error($"{fn} {ExceptionUtil.GetLogMessage(exc, "generating Security database definition")}");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -73,7 +73,12 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
config.DefinitionClass.Namespace = "Sarand.Net.Standard.Base.Security";
|
||||
config.DefinitionClass.Classname = "SaSecurityDbDfn";
|
||||
// Table class.
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.App");
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Core");
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Utils");
|
||||
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Dbas");
|
||||
config.TableClass.Namespace = "Sarand.Net.Standard.Dbas.Security.Internal";
|
||||
config.TableClass.ClassName_DatabaseInfo = "IDatabaseInfo";
|
||||
config.TableClass.MandatoryConstructorDbInfo = true;
|
||||
|
||||
// Generate database definition.
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -233,7 +233,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -265,7 +265,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -274,17 +274,24 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
{
|
||||
dbSecurityItem._Id = securityItem.Id.ToInt();
|
||||
dbSecurityItem._Type = (byte)securityItem.ItemType;
|
||||
dbSecurityItem._EmailAddress = securityItem.EmailAddress;
|
||||
dbSecurityItem._Code = securityItem.Code;
|
||||
dbSecurityItem._EmailAddress = securityItem.EmailAddress;
|
||||
dbSecurityItem._Description = securityItem.Description;
|
||||
dbSecurityItem._Location = securityItem.Location;
|
||||
dbSecurityItem._DataItemType = (short)securityItem.DataItemType;
|
||||
// Security.
|
||||
dbSecurityItem._PwordSalt = securityItem.PasswordSalt;
|
||||
dbSecurityItem._PwordHash = securityItem.PasswordHash;
|
||||
#pragma warning disable CS0618 // Deprecated property
|
||||
dbSecurityItem._EncPword = securityItem.PasswordEncrypted;
|
||||
#pragma warning restore CS0618 // Deprecated property
|
||||
//dbSecurityItem._PasswordHistory = securityItem.PasswordHistory;
|
||||
dbSecurityItem._PasswordToken = securityItem.PasswordToken;
|
||||
dbSecurityItem._PasswordChangedAt = securityItem.PasswordChangedAt;
|
||||
// Login.
|
||||
dbSecurityItem._LastLogin = securityItem.LastLogin;
|
||||
dbSecurityItem._DataItemType = (short)securityItem.DataItemType;
|
||||
dbSecurityItem._LastInvalidLoginAt = securityItem.LastInvalidLoginAt;
|
||||
dbSecurityItem._InvalidLoginCount = securityItem.InvalidLoginCount;
|
||||
// Common properties.
|
||||
dbSecurityItem._Notes = securityItem.Notes;
|
||||
dbSecurityItem._Status = SacsSystem.GetStatusCode(securityItem.Status);
|
||||
@@ -306,13 +313,20 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
securityItem.EmailAddress = dbSecurityItem._EmailAddress;
|
||||
securityItem.Description = dbSecurityItem._Description;
|
||||
securityItem.Location = dbSecurityItem._Location;
|
||||
securityItem.DataItemType = dbSecurityItem._DataItemType;
|
||||
// Security.
|
||||
securityItem.SetPasswordSalt(dbSecurityItem._PwordSalt);
|
||||
securityItem.SetPasswordHash(dbSecurityItem._PwordHash);
|
||||
#pragma warning disable CS0618 // Deprecated property
|
||||
securityItem.SetPasswordEncrypted(dbSecurityItem._EncPword);
|
||||
#pragma warning restore CS0618 // Deprecated property
|
||||
//securityItem.PasswordHistory = dbSecurityItem._PasswordHistory;
|
||||
securityItem.PasswordToken = dbSecurityItem._PasswordToken;
|
||||
securityItem.PasswordChangedAt = dbSecurityItem._PasswordChangedAt;
|
||||
// Login.
|
||||
securityItem.LastLogin = dbSecurityItem._LastLogin;
|
||||
securityItem.DataItemType = dbSecurityItem._DataItemType;
|
||||
securityItem.LastInvalidLoginAt = dbSecurityItem._LastInvalidLoginAt;
|
||||
securityItem.InvalidLoginCount = dbSecurityItem._InvalidLoginCount;
|
||||
// Common properties.
|
||||
securityItem.Notes = dbSecurityItem._Notes;
|
||||
securityItem.Status = SacsSystem.GetStatusForCode(dbSecurityItem._Status);
|
||||
@@ -556,7 +570,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -136,7 +136,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -168,7 +168,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -179,8 +179,8 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
dbSecurityLink._ItemTarget = SysId.ToInt(securityLink.ItemIdTarget);
|
||||
dbSecurityLink._ItemContext = SysId.ToInt(securityLink.ItemIdContext);
|
||||
dbSecurityLink._DayApplic = securityLink.DayApplicability;
|
||||
dbSecurityLink._DateApplicFrom = DateUtil.DateToInt32(securityLink.ApplicableFrom);
|
||||
dbSecurityLink._DateApplicTo = DateUtil.DateToInt32(securityLink.ApplicableTo);
|
||||
dbSecurityLink._DateApplicFrom = DateUtil.DateToInt32(securityLink.ApplicableFrom ?? DateTime.MinValue);
|
||||
dbSecurityLink._DateApplicTo = DateUtil.DateToInt32(securityLink.ApplicableTo ?? DateTime.MinValue);
|
||||
dbSecurityLink._Status = SacsSystem.GetStatusCode(securityLink.Status);
|
||||
dbSecurityLink._Flags = (short)securityLink.Flags;
|
||||
if (dbSecurityLink._CreateOn == DateTime.MinValue)
|
||||
@@ -200,11 +200,11 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
//securityLink.ItemIdTarget = new SysId(dbSecurityLink._ItemTarget);
|
||||
//securityLink.ItemIdContext = new SysId(dbSecurityLink._ItemContext);
|
||||
securityLink.DayApplicability = dbSecurityLink._DayApplic;
|
||||
securityLink.ApplicableFrom = DateUtil.Int32ToDate(dbSecurityLink._DateApplicFrom);
|
||||
securityLink.ApplicableTo = DateUtil.Int32ToDate(dbSecurityLink._DateApplicTo);
|
||||
securityLink.ApplicableFrom = DateUtil.Int32ToDate(dbSecurityLink._DateApplicFrom ?? 0);
|
||||
securityLink.ApplicableTo = DateUtil.Int32ToDate(dbSecurityLink._DateApplicTo ?? 0);
|
||||
securityLink.Status = SacsSystem.GetStatusForCode(dbSecurityLink._Status);
|
||||
securityLink.SetCreateStamp(dbSecurityLink._CreateOn, new SysId(dbSecurityLink._CreateBy), dbSecurityLink._CreateHost);
|
||||
securityLink.SetUpdateStamp(dbSecurityLink._UpdateOn, new SysId(dbSecurityLink._UpdateBy), dbSecurityLink._UpdateHost);
|
||||
securityLink.SetCreateStamp(dbSecurityLink._CreateOn ?? DateTime.MinValue, new SysId(dbSecurityLink._CreateBy ?? 0), dbSecurityLink._CreateHost);
|
||||
securityLink.SetUpdateStamp(dbSecurityLink._UpdateOn ?? DateTime.MinValue, new SysId(dbSecurityLink._UpdateBy ?? 0), dbSecurityLink._UpdateHost);
|
||||
securityLink.AcceptChanges();
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
RecordAttrValue(SaSecurityDbDfn.GetColumnName(SaSecurityDbDfn.ColumnIdx.SaSecItem_Notes, false), securityItem.Notes, newValues);
|
||||
RecordAttrValue(SaSecurityDbDfn.GetColumnName(SaSecurityDbDfn.ColumnIdx.SaSecItem_Status, false), securityItem.StatusCode, newValues);
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
// Common properties.
|
||||
RecordAttrValue(SaSecurityDbDfn.GetColumnName(SaSecurityDbDfn.ColumnIdx.SaSecLink_Status, false), securityLink.StatusCode, newValues);
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Sarand.Net.Standard.Dbas.UpdateLog
|
||||
ClearErrorState();
|
||||
if (!updateLogMgr.LogUpdates(updateLogItemMonitor, updateLogItemMonitor.DbUpdateInfo))
|
||||
SetErrorState(updateLogMgr.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -119,7 +119,7 @@ namespace Sarand.Net.Standard.Dbas.UpdateLog
|
||||
if (!updateLogMgr.UpdateLogEntry(logEntry, dbUpdateInfo))
|
||||
SetErrorState(updateLogMgr.ErrorStateMessage);
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool RemoveLogEntry (SaUpdateLogEntry logEntry, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Sarand.Net.Standard.Dbas.UpdateLog
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
@@ -232,7 +232,7 @@ namespace Sarand.Net.Standard.Dbas.UpdateLog
|
||||
}
|
||||
Database.DisplayErrors = ddDisplayErrorsPrev;
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -260,7 +260,7 @@ namespace Sarand.Net.Standard.Dbas.UpdateLog
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -285,7 +285,7 @@ namespace Sarand.Net.Standard.Dbas.UpdateLog
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -316,19 +316,19 @@ namespace Sarand.Net.Standard.Dbas.UpdateLog
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool ClearLogEntriesForItem (ItemId itemId, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!ItemId.IsValid(itemId)) return SetErrorState("Item Id must be specified");
|
||||
if (!ItemId.IsValid(itemId)) return SetErrorState(Msg_ItemIdNotSpecified);
|
||||
String colItemType = SaUpdateLogDbDfn.GetColumnName(SaUpdateLogDbDfn.ColumnIdx.SaAttrUpdate_ItemType);
|
||||
String colItemId = SaUpdateLogDbDfn.GetColumnName(SaUpdateLogDbDfn.ColumnIdx.SaAttrUpdate_ItemId);
|
||||
String query = "Delete From "+TableName_UpdateLog+" WHERE "+colItemType+"="+itemId.Type.ToString()+" AND "+colItemId+"="+SysId.ToString(itemId.Id);
|
||||
Database.ExecuteNonQuery(query);
|
||||
if (Database.HasErrorState())
|
||||
SetErrorState("Failed to clear update log entries - " + Database.ErrorStateMessage);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -591,7 +591,7 @@ namespace Sarand.Net.Standard.Dbas.UpdateLog
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
SetErrorState("Database query exception");
|
||||
SetErrorState(Msg_DatabaseQueryException);
|
||||
SaLogger.Warn($"{SysUtil.Fn}\n\tQuery: {dbCommand.CommandText}\n\t{ExceptionUtil.GetErrorStateMessage(exc)}");
|
||||
}
|
||||
}
|
||||
|
||||
+44
-44
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<DbDfnDatabase xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DbDfnDatabase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Tables>
|
||||
<DbDfnTable>
|
||||
<Schema>dbo</Schema>
|
||||
@@ -70,8 +70,8 @@
|
||||
<Size>128</Size>
|
||||
<BufferLen>256</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -87,8 +87,8 @@
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -104,8 +104,8 @@
|
||||
<Size>255</Size>
|
||||
<BufferLen>510</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -121,8 +121,8 @@
|
||||
<Size>255</Size>
|
||||
<BufferLen>510</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -138,8 +138,8 @@
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -172,8 +172,8 @@
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -189,8 +189,8 @@
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -223,8 +223,8 @@
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -240,8 +240,8 @@
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -272,8 +272,8 @@
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>20</Pages>
|
||||
<UniqueValues>990</UniqueValues>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
@@ -427,8 +427,8 @@
|
||||
<Size>128</Size>
|
||||
<BufferLen>256</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -444,8 +444,8 @@
|
||||
<Size>3</Size>
|
||||
<BufferLen>1</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -461,8 +461,8 @@
|
||||
<Size>32</Size>
|
||||
<BufferLen>64</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -478,8 +478,8 @@
|
||||
<Size>32</Size>
|
||||
<BufferLen>64</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -495,8 +495,8 @@
|
||||
<Size>255</Size>
|
||||
<BufferLen>510</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -512,8 +512,8 @@
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -546,8 +546,8 @@
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -563,8 +563,8 @@
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -597,8 +597,8 @@
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -614,8 +614,8 @@
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -646,8 +646,8 @@
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>12</UniqueValues>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
+18
-18
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<DbDfnDatabase xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DbDfnDatabase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Tables>
|
||||
<DbDfnTable>
|
||||
<Schema>dbo</Schema>
|
||||
@@ -87,8 +87,8 @@
|
||||
<Size>255</Size>
|
||||
<BufferLen>510</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -104,8 +104,8 @@
|
||||
<Size>255</Size>
|
||||
<BufferLen>510</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -121,8 +121,8 @@
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -138,8 +138,8 @@
|
||||
<Size>3</Size>
|
||||
<BufferLen>6</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -172,8 +172,8 @@
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -206,8 +206,8 @@
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -223,8 +223,8 @@
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -255,8 +255,8 @@
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>11</UniqueValues>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
+150
-65
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<DbDfnDatabase xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<DbDfnDatabase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<Tables>
|
||||
<DbDfnTable>
|
||||
<Schema>dbo</Schema>
|
||||
@@ -33,11 +33,11 @@
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>20</Size>
|
||||
<BufferLen>40</BufferLen>
|
||||
<Size>128</Size>
|
||||
<BufferLen>256</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -50,11 +50,11 @@
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>50</Size>
|
||||
<BufferLen>100</BufferLen>
|
||||
<Size>100</Size>
|
||||
<BufferLen>200</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -70,8 +70,8 @@
|
||||
<Size>3</Size>
|
||||
<BufferLen>1</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -81,14 +81,14 @@
|
||||
<Name>EmailAddress</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>12</DataTypeNative>
|
||||
<DataTypeNameNative>varchar</DataTypeNameNative>
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>128</Size>
|
||||
<BufferLen>128</BufferLen>
|
||||
<BufferLen>256</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
@@ -104,14 +104,31 @@
|
||||
<Size>50</Size>
|
||||
<BufferLen>100</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>7</Pos>
|
||||
<Name>DataItemType</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>5</DataTypeNative>
|
||||
<DataTypeNameNative>smallint</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>8</Pos>
|
||||
<Name>EncPword</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -128,7 +145,7 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>8</Pos>
|
||||
<Pos>9</Pos>
|
||||
<Name>PwordSalt</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -145,15 +162,15 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>9</Pos>
|
||||
<Pos>10</Pos>
|
||||
<Name>PwordHash</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>64</Size>
|
||||
<BufferLen>128</BufferLen>
|
||||
<Size>200</Size>
|
||||
<BufferLen>400</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
@@ -162,7 +179,58 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>10</Pos>
|
||||
<Pos>11</Pos>
|
||||
<Name>PasswordToken</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>12</DataTypeNative>
|
||||
<DataTypeNameNative>varchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>32</Size>
|
||||
<BufferLen>32</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>12</Pos>
|
||||
<Name>PasswordHistory</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>-9</DataTypeNative>
|
||||
<DataTypeNameNative>nvarchar</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>0</Size>
|
||||
<BufferLen>0</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>13</Pos>
|
||||
<Name>PasswordChangedAt</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>93</DataTypeNative>
|
||||
<DataTypeNameNative>smalldatetime</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>16</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>14</Pos>
|
||||
<Name>LastLogin</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
@@ -179,15 +247,15 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>11</Pos>
|
||||
<Name>DataItemType</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<Pos>15</Pos>
|
||||
<Name>LastInvalidLoginAt</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>5</DataTypeNative>
|
||||
<DataTypeNameNative>smallint</DataTypeNameNative>
|
||||
<DataTypeNative>93</DataTypeNative>
|
||||
<DataTypeNameNative>smalldatetime</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<Size>16</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
@@ -196,7 +264,24 @@
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>12</Pos>
|
||||
<Pos>16</Pos>
|
||||
<Name>InvalidLoginCount</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
<DataTypeNative>5</DataTypeNative>
|
||||
<DataTypeNameNative>smallint</DataTypeNameNative>
|
||||
<IsIdentity>false</IsIdentity>
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>17</Pos>
|
||||
<Name>Notes</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -206,14 +291,14 @@
|
||||
<Size>255</Size>
|
||||
<BufferLen>510</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>13</Pos>
|
||||
<Pos>18</Pos>
|
||||
<Name>Flags</Name>
|
||||
<DataType>SmallInt</DataType>
|
||||
<DataTypeName />
|
||||
@@ -223,14 +308,14 @@
|
||||
<Size>5</Size>
|
||||
<BufferLen>2</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>14</Pos>
|
||||
<Pos>19</Pos>
|
||||
<Name>Status</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -240,14 +325,14 @@
|
||||
<Size>3</Size>
|
||||
<BufferLen>3</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>15</Pos>
|
||||
<Pos>20</Pos>
|
||||
<Name>CreateOn</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
@@ -257,14 +342,14 @@
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>16</Pos>
|
||||
<Pos>21</Pos>
|
||||
<Name>CreateBy</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
@@ -274,14 +359,14 @@
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>17</Pos>
|
||||
<Pos>22</Pos>
|
||||
<Name>CreateHost</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -291,14 +376,14 @@
|
||||
<Size>64</Size>
|
||||
<BufferLen>64</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>18</Pos>
|
||||
<Pos>23</Pos>
|
||||
<Name>UpdateOn</Name>
|
||||
<DataType>DateTime</DataType>
|
||||
<DataTypeName />
|
||||
@@ -308,14 +393,14 @@
|
||||
<Size>23</Size>
|
||||
<BufferLen>16</BufferLen>
|
||||
<DecimalDigits>3</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>19</Pos>
|
||||
<Pos>24</Pos>
|
||||
<Name>UpdateBy</Name>
|
||||
<DataType>Int</DataType>
|
||||
<DataTypeName />
|
||||
@@ -325,14 +410,14 @@
|
||||
<Size>10</Size>
|
||||
<BufferLen>4</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
<DbDfnColumn>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecItem</Table>
|
||||
<Pos>20</Pos>
|
||||
<Pos>25</Pos>
|
||||
<Name>UpdateHost</Name>
|
||||
<DataType>VarChar</DataType>
|
||||
<DataTypeName />
|
||||
@@ -342,8 +427,8 @@
|
||||
<Size>64</Size>
|
||||
<BufferLen>64</BufferLen>
|
||||
<DecimalDigits>0</DecimalDigits>
|
||||
<Nullable>Nullable</Nullable>
|
||||
<IsNullable>true</IsNullable>
|
||||
<Nullable>NoNulls</Nullable>
|
||||
<IsNullable>false</IsNullable>
|
||||
<Remarks />
|
||||
</DbDfnColumn>
|
||||
</Columns>
|
||||
@@ -357,8 +442,8 @@
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>26</UniqueValues>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
@@ -689,8 +774,8 @@
|
||||
<Primary>false</Primary>
|
||||
<Clustered>false</Clustered>
|
||||
<Nullable>false</Nullable>
|
||||
<Pages>1</Pages>
|
||||
<UniqueValues>28</UniqueValues>
|
||||
<Pages>0</Pages>
|
||||
<UniqueValues>0</UniqueValues>
|
||||
<HasColumns>false</HasColumns>
|
||||
<Columns>
|
||||
<DbDfnIndexColumn>
|
||||
@@ -713,7 +798,7 @@
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecLink</Table>
|
||||
<Name>IDX_SaSecLink_Context</Name>
|
||||
<Name>IDX_SaSecLink_ItemContext</Name>
|
||||
<IndexType>3</IndexType>
|
||||
<Unique>false</Unique>
|
||||
<Primary>false</Primary>
|
||||
@@ -733,7 +818,7 @@
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecLink</Table>
|
||||
<Name>IDX_SaSecLink_Owner</Name>
|
||||
<Name>IDX_SaSecLink_ItemOwner</Name>
|
||||
<IndexType>3</IndexType>
|
||||
<Unique>false</Unique>
|
||||
<Primary>false</Primary>
|
||||
@@ -753,7 +838,7 @@
|
||||
<DbDfnIndex>
|
||||
<Schema>dbo</Schema>
|
||||
<Table>SaSecLink</Table>
|
||||
<Name>IDX_SaSecLink_Target</Name>
|
||||
<Name>IDX_SaSecLink_ItemTarget</Name>
|
||||
<IndexType>3</IndexType>
|
||||
<Unique>false</Unique>
|
||||
<Primary>false</Primary>
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Dbas\Bus\" />
|
||||
<Folder Include="Resources\Database\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -15,6 +16,10 @@
|
||||
<PackageReference Include="System.Data.Odbc" Version="6.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\**\*.*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SacsStandardBase\SacsStandardBase.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -364,14 +364,14 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
{
|
||||
for (uint colPos = Math.Max(1, colPosStart); colPos <= values.Count; colPos++)
|
||||
SetCellFormula(colPos, rowPos, values[(int)(colPos - 1)]);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
/// <summary>Set cell values across a row - override if more efficient method available.</summary>
|
||||
public virtual bool SetRowValues(uint colPosStart, uint rowPos, List<DataValue> values)
|
||||
{
|
||||
for (uint colPos = Math.Max(1, colPosStart); colPos <= values.Count; colPos++)
|
||||
SetCellValue(colPos, rowPos, values[(int)(colPos - 1)]);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -391,7 +391,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
SetCellFormula(colPos, rowPos, values[valueIdx++]);
|
||||
}
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
/// <summary>
|
||||
/// Set cell values across a range of cells - override if more efficient logic available.
|
||||
@@ -410,7 +410,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
SetCellValue(colPos, rowPos, values[valueIdx++]);
|
||||
}
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -531,7 +531,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
AutoFitRows(rangeHeadings);
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
else return SetErrorState("Failed to open document: " + workbook.WorkbookArchive.ErrorStateMessage);
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public bool OpenWorkbook(byte[] workbookData)
|
||||
{
|
||||
@@ -150,7 +150,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
}
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public bool OpenWorkbook(Stream workbookStream)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
else return SetErrorState("Failed to open document: " + workbook.WorkbookArchive.ErrorStateMessage);
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
private bool ExtractWorkbookElementsFromArchive()
|
||||
{
|
||||
@@ -212,7 +212,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
}
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool CleanseWorkbook()
|
||||
{
|
||||
@@ -227,7 +227,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
return SetErrorState("Unsupported file format: " + ((XlFileFormat)fileFormat).ToString());
|
||||
if (!IsWorkbookValid()) SetErrorState(Msg_WorkbookNotOpen);
|
||||
SetErrorState("Saving workbook not supported");
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool CloseWorkbook()
|
||||
{
|
||||
@@ -247,7 +247,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
catch (Exception exc) { SetErrorState(ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
workbook = null;
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
/// <summary>Extract the document as a byte array.</summary>
|
||||
@@ -350,7 +350,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
if (worksheet.WorksheetDoc == null) return SetErrorState("Unable to load worksheet " + worksheetPos.ToString());
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -408,7 +408,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
if (worksheet.WorksheetDoc == null) return SetErrorState("Unable to load worksheet " + worksheetPos.ToString());
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -430,7 +430,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
worksheet = null;
|
||||
}
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
|
||||
// ToDo Save OpenXML Excel document.
|
||||
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool CloseWorkbook()
|
||||
{
|
||||
@@ -155,7 +155,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
}
|
||||
catch (Exception exc) { SaLogger.Warn(exc.GetType().Name + ".CloseWorkbook " + ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
workbook = null;
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
/// <summary>Extract the document as a byte array.</summary>
|
||||
@@ -196,7 +196,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
OpenWorksheet(1);
|
||||
}
|
||||
else SetErrorState("SetWorksheetCount - Requested number of worksheets (" + worksheetCount.ToString() + ") must be between 1 and 10");
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -345,7 +345,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
worksheet = null;
|
||||
activeWorksheetPos = 0;
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -371,7 +371,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
// ToDo OpenXml SetWorksheetAttr
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -494,7 +494,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
*/
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public override bool SetPageBreak(uint colPos, uint rowPos)
|
||||
{
|
||||
@@ -511,7 +511,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
*/
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -564,7 +564,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
// ToDo OpenXML SetColWidth.
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -609,7 +609,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
// ToDo OpenXML SetRowHeight.
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -658,7 +658,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
// ToDo OpenXML SetRangeAttr.
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
private bool SetRangeAttr(Range oRange, SaMsExcelStyleAttr attr)
|
||||
{
|
||||
@@ -668,7 +668,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
// ToDo OpenXML SetRangeAttr.
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -684,7 +684,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
// ToDo OpenXML InsertImage.
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -696,7 +696,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
// ToDo OpenXML FreezePanes.
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -708,7 +708,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
// ToDo OpenXML AutoFit.
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -720,7 +720,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
// ToDo OpenXML SelectRange.
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
}
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public bool OpenWorkbook(byte[] workbookData)
|
||||
{
|
||||
@@ -109,7 +109,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
}
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public bool OpenWorkbook(Stream workbookStream)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
}
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -152,7 +152,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
}
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(SysUtil.Fn + " " + ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -181,7 +181,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -192,7 +192,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
// Clear workbook.
|
||||
if (workbook != null)
|
||||
workbook = null;
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -253,7 +253,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
OpenWorksheet(1);
|
||||
}
|
||||
else SetErrorState(SysUtil.Fn + " - Requested number of worksheets (" + worksheetCount.ToString() + ") must be between 1 and 10");
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -367,7 +367,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
worksheet = workbook.GetSheetAt(worksheetIdx);
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -393,7 +393,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
SetErrorState("Worksheet not found.");
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -405,7 +405,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
return SetErrorState(Msg_WorkbookNotOpen);
|
||||
if (worksheet != null)
|
||||
worksheet = null;
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -550,7 +550,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
}
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -572,7 +572,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
{
|
||||
HandleException(SysUtil.Fn, exc);
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -616,7 +616,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
worksheet.SetColumnWidth((int)(colPos - 1), (int)Math.Ceiling(widthPixels * 256 / DEFAULT_CHARACTER_WIDTH));
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -681,7 +681,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
row.Height = (short)height;
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -875,7 +875,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
SetRangeAttr(range, attr);
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
public override bool SetCellValue(uint colPos, uint rowPos, DataValue value, SaMsExcelStyleAttr attr)
|
||||
@@ -889,7 +889,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
SetRangeAttr(range, attr);
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -963,7 +963,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
}
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
public override bool SetRowValues(uint colPosStart, uint rowPos, List<DataValue> values)
|
||||
@@ -980,7 +980,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
}
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -1139,7 +1139,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
||||
}
|
||||
}
|
||||
catch (Exception exc) { HandleException(SysUtil.Fn, exc); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Sarand.Net.Standard.Proc.Xml
|
||||
document = new XmlDocument();
|
||||
if (!StringUtil.IsEmpty(rootElementName))
|
||||
document.AppendElement(rootElementName);
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public bool LoadXml (String xml)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ namespace Sarand.Net.Standard.Proc.Xml
|
||||
document.LoadXml(xml);
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public bool LoadXml (Stream xml)
|
||||
{
|
||||
@@ -64,7 +64,7 @@ namespace Sarand.Net.Standard.Proc.Xml
|
||||
document.Load(xml);
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(ExceptionUtil.GetErrorStateMessage(exc)); }
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace Sarand.Net.Standard.Proc.Zip
|
||||
SaLogger.Warn($"{SysUtil.Fn} {ExceptionUtil.GetLogMessage(exc)}");
|
||||
return SetErrorState(ExceptionUtil.GetErrorStateMessage(exc));
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
/// <summary>Open ZIP archive from data stream.</summary>
|
||||
public bool OpenArchive (Stream stream, ZipArchiveMode mode = ZipArchiveMode.Read, bool leaveOpen = true, Encoding entryNameEncoding = null)
|
||||
@@ -72,7 +72,7 @@ namespace Sarand.Net.Standard.Proc.Zip
|
||||
SaLogger.Warn($"{SysUtil.Fn} {ExceptionUtil.GetLogMessage(exc)}");
|
||||
return SetErrorState(ExceptionUtil.GetErrorStateMessage(exc));
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
public bool IsArchiveOpen ()
|
||||
{
|
||||
@@ -92,7 +92,7 @@ namespace Sarand.Net.Standard.Proc.Zip
|
||||
SaLogger.Warn($"{SysUtil.Fn} {ExceptionUtil.GetLogMessage(exc)}");
|
||||
}
|
||||
zipArchive = null;
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user