BusinessMgr 3.0.0.1
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
private class DataMembers
|
||||
{
|
||||
// Construction.
|
||||
public DataMembers (ISacsDatabase database, String query)
|
||||
public DataMembers(ISacsDatabase database, String query)
|
||||
{
|
||||
Database = database;
|
||||
Query = query;
|
||||
@@ -31,7 +31,7 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
// Result set schema - to avoid keeping connection open.
|
||||
public String[] ColumnNames { get; set; }
|
||||
public String[] ColumnTypeNames { get; set; }
|
||||
public void PopulateColumns ()
|
||||
public void PopulateColumns()
|
||||
{
|
||||
int fieldCount = DbDataReader.FieldCount;
|
||||
ColumnNames = new String[fieldCount];
|
||||
@@ -48,7 +48,7 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
[Obsolete("Constructor is deprecated. Use ExecuteQuery[Async] instead.")]
|
||||
public DbResultSet_DataReader (SacsDatabase database, String query)
|
||||
public DbResultSet_DataReader(SacsDatabase database, String query)
|
||||
{
|
||||
data = new DataMembers(database, query);
|
||||
String fn = GetType().Name + ".CTR";
|
||||
@@ -64,18 +64,18 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
}
|
||||
}
|
||||
/// <summary>Private construction - created from ExecuteQuery{Async].</summary>
|
||||
private DbResultSet_DataReader (DataMembers data)
|
||||
private DbResultSet_DataReader(DataMembers data)
|
||||
{
|
||||
this.data = data;
|
||||
}
|
||||
protected override void Dispose (bool disposing)
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing) Close();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Execute query.
|
||||
public static DbResultSet_DataReader ExecuteQuery (ISacsDatabase database, String query)
|
||||
public static DbResultSet_DataReader ExecuteQuery(ISacsDatabase database, String query)
|
||||
{
|
||||
DataMembers data = new DataMembers(database, query);
|
||||
String errorState = "";
|
||||
@@ -89,11 +89,11 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
errorState = ExceptionUtil.GetErrorStateMessage(exc);
|
||||
SaLogger.Warn(SysUtil.Fn + " " + ExceptionUtil.GetLogMessage(exc, 6) + "\n\t Query: " + query, true);
|
||||
}
|
||||
DbResultSet_DataReader resultSet = new DbResultSet_DataReader (data);
|
||||
DbResultSet_DataReader resultSet = new DbResultSet_DataReader(data);
|
||||
resultSet.SetErrorState(errorState);
|
||||
return resultSet;
|
||||
}
|
||||
public static async Task<DbResultSet_DataReader> ExecuteQueryAsync (ISacsDatabase database, String query)
|
||||
public static async Task<DbResultSet_DataReader> ExecuteQueryAsync(ISacsDatabase database, String query)
|
||||
{
|
||||
DataMembers data = new DataMembers(database, query);
|
||||
String errorState = "";
|
||||
@@ -112,14 +112,14 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
errorState = ExceptionUtil.GetErrorStateMessage(exc);
|
||||
SaLogger.Warn(SysUtil.Fn + " " + ExceptionUtil.GetLogMessage(exc, 6) + "\n\t Query: " + query, true);
|
||||
}
|
||||
DbResultSet_DataReader resultSet = new DbResultSet_DataReader (data);
|
||||
DbResultSet_DataReader resultSet = new DbResultSet_DataReader(data);
|
||||
resultSet.SetErrorState(errorState);
|
||||
return resultSet;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Close.
|
||||
public override void Close ()
|
||||
public override void Close()
|
||||
{
|
||||
// Dispose of database objects.
|
||||
if (data.DbDataReader != null && !data.DbDataReader.IsClosed) data.DbDataReader.Close();
|
||||
@@ -132,7 +132,7 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Execute query.
|
||||
private static void ExecuteQuery_Internal (DataMembers data)
|
||||
private static void ExecuteQuery_Internal(DataMembers data)
|
||||
{
|
||||
data.DbConnection = data.Database.CreateConnection();
|
||||
data.DbCommand = data.DbConnection.CreateCommand();
|
||||
@@ -144,7 +144,7 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Navigation.
|
||||
public override bool NextRecord ()
|
||||
public override bool NextRecord()
|
||||
{
|
||||
// Move to next result.
|
||||
bool nextRecord = false;
|
||||
@@ -179,97 +179,103 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public override int GetOrdinal (String columnName)
|
||||
public override int GetOrdinal(String columnName)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
return data.DbDataReader.GetOrdinal(columnName);
|
||||
return -1;
|
||||
}
|
||||
public override String GetDataTypeName (int columnIdx)
|
||||
public override String GetDataTypeName(int columnIdx)
|
||||
{
|
||||
if (data.ColumnTypeNames != null)
|
||||
return data.ColumnTypeNames[columnIdx];
|
||||
return String.Empty;
|
||||
}
|
||||
public override String GetName (int columnIdx)
|
||||
public override String GetName(int columnIdx)
|
||||
{
|
||||
if (data.ColumnNames != null)
|
||||
return data.ColumnNames[columnIdx];
|
||||
return String.Empty;
|
||||
}
|
||||
public override bool IsDbNull (int columnIdx)
|
||||
public override bool IsDbNull(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null && data.DbDataReader.IsDBNull(columnIdx))
|
||||
return true;
|
||||
object value = GetValue(columnIdx);
|
||||
return (value is System.DBNull);
|
||||
}
|
||||
public override object GetValue (int columnIdx)
|
||||
public override object GetValue(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
return data.DbDataReader.GetValue(columnIdx);
|
||||
return false;
|
||||
}
|
||||
public override bool GetBoolean (int columnIdx)
|
||||
public override bool GetBoolean(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
return data.DbDataReader.GetBoolean(columnIdx);
|
||||
return false;
|
||||
}
|
||||
public override byte GetByte (int columnIdx)
|
||||
public override byte GetByte(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
return data.DbDataReader.GetByte(columnIdx);
|
||||
return 0;
|
||||
}
|
||||
public override short GetInt16 (int columnIdx)
|
||||
public override short GetInt16(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
return data.DbDataReader.GetInt16(columnIdx);
|
||||
return 0;
|
||||
}
|
||||
public override int GetInt32 (int columnIdx)
|
||||
public override int GetInt32(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
return data.DbDataReader.GetInt32(columnIdx);
|
||||
return 0;
|
||||
}
|
||||
public override long GetInt64 (int columnIdx)
|
||||
public override long GetInt64(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
return data.DbDataReader.GetInt64(columnIdx);
|
||||
return 0;
|
||||
}
|
||||
public override float GetFloat (int columnIdx)
|
||||
public override float GetFloat(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
return data.DbDataReader.GetFloat(columnIdx);
|
||||
return 0.0f;
|
||||
}
|
||||
public override double GetDouble (int columnIdx)
|
||||
public override double GetDouble(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
return data.DbDataReader.GetDouble(columnIdx);
|
||||
return 0.0;
|
||||
}
|
||||
public override decimal GetDecimal (int columnIdx)
|
||||
public override decimal GetDecimal(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
return data.DbDataReader.GetDecimal(columnIdx);
|
||||
return 0.0m;
|
||||
}
|
||||
public override String GetString (int columnIdx)
|
||||
public override String GetString(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
return data.DbDataReader.GetString(columnIdx);
|
||||
return String.Empty;
|
||||
}
|
||||
public override DateTime GetDateTime (int columnIdx)
|
||||
public override DateTime GetDateTime(int columnIdx)
|
||||
{
|
||||
if (data.DbDataReader != null)
|
||||
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);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
private DataTableReader dataTableReader = null;
|
||||
//-------------------------------------------------------------------
|
||||
// Construction.
|
||||
public DbResultSet_DataTableReader (SacsDatabase database, String query)
|
||||
public DbResultSet_DataTableReader(SacsDatabase database, String query)
|
||||
{
|
||||
this.database = database;
|
||||
this.query = query;
|
||||
@@ -30,7 +30,7 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Execute query.
|
||||
private void ExecuteQuery ()
|
||||
private void ExecuteQuery()
|
||||
{
|
||||
ClearErrorState();
|
||||
Close();
|
||||
@@ -53,11 +53,11 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
protected override void Dispose (bool disposing)
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
public override void Close ()
|
||||
public override void Close()
|
||||
{
|
||||
// Dispose of database objects.
|
||||
if (dataTableReader != null) dataTableReader.Close();
|
||||
@@ -72,7 +72,7 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
}
|
||||
//-------------------------------------------------------------------
|
||||
// Navigation.
|
||||
public override bool NextRecord ()
|
||||
public override bool NextRecord()
|
||||
{
|
||||
// Move to next result.
|
||||
bool nextRecord = false;
|
||||
@@ -106,94 +106,101 @@ namespace Sarand.Net.Standard.Dbas.Data
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public override int GetOrdinal (String columnName)
|
||||
public override int GetOrdinal(String columnName)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetOrdinal(columnName);
|
||||
return -1;
|
||||
}
|
||||
public override String GetDataTypeName (int columnIdx)
|
||||
public override String GetDataTypeName(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetDataTypeName(columnIdx);
|
||||
return String.Empty;
|
||||
}
|
||||
public override String GetName (int columnIdx)
|
||||
public override String GetName(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetName(columnIdx);
|
||||
return String.Empty;
|
||||
}
|
||||
public override bool IsDbNull (int columnIdx)
|
||||
public override bool IsDbNull(int columnIdx)
|
||||
{
|
||||
return (GetValue(columnIdx) is System.DBNull);
|
||||
}
|
||||
public override object GetValue (int columnIdx)
|
||||
public override object GetValue(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetValue(columnIdx);
|
||||
return false;
|
||||
}
|
||||
public override bool GetBoolean (int columnIdx)
|
||||
public override bool GetBoolean(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetBoolean(columnIdx);
|
||||
return false;
|
||||
}
|
||||
public override byte GetByte (int columnIdx)
|
||||
public override byte GetByte(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetByte(columnIdx);
|
||||
return 0;
|
||||
}
|
||||
public override short GetInt16 (int columnIdx)
|
||||
public override short GetInt16(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetInt16(columnIdx);
|
||||
return 0;
|
||||
}
|
||||
public override int GetInt32 (int columnIdx)
|
||||
public override int GetInt32(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetInt32(columnIdx);
|
||||
return 0;
|
||||
}
|
||||
public override long GetInt64 (int columnIdx)
|
||||
public override long GetInt64(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetInt64(columnIdx);
|
||||
return 0;
|
||||
}
|
||||
public override float GetFloat (int columnIdx)
|
||||
public override float GetFloat(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetFloat(columnIdx);
|
||||
return 0.0f;
|
||||
}
|
||||
public override double GetDouble (int columnIdx)
|
||||
public override double GetDouble(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetDouble(columnIdx);
|
||||
return 0.0;
|
||||
}
|
||||
public override decimal GetDecimal (int columnIdx)
|
||||
public override decimal GetDecimal(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetDecimal(columnIdx);
|
||||
return 0.0m;
|
||||
}
|
||||
public override String GetString (int columnIdx)
|
||||
public override String GetString(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
return dataTableReader.GetString(columnIdx);
|
||||
return String.Empty;
|
||||
}
|
||||
public override DateTime GetDateTime (int columnIdx)
|
||||
public override DateTime GetDateTime(int columnIdx)
|
||||
{
|
||||
if (dataTableReader != null)
|
||||
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,75 +434,69 @@ 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)
|
||||
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))
|
||||
{
|
||||
if (StringUtil.IsEmpty(tableNameRestriction) && tables.Count > 0) return;
|
||||
if (!StringUtil.IsEmpty(tableNameRestriction) && tables.Exists(item => item.Name.Equals(tableNameRestriction))) return;
|
||||
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))
|
||||
//DataSet set = tableSchema.DataSet;
|
||||
foreach (DataRow row in tableSchema.Rows)
|
||||
{
|
||||
//DataSet set = tableSchema.DataSet;
|
||||
foreach (DataRow row in tableSchema.Rows)
|
||||
//-----------------------------------------------------------
|
||||
// Columns are: Name Size Data Type Values
|
||||
// 1. TABLE_CAT 255 12 VarChar
|
||||
// 2. TABLE_SCHEM 128 12 VarChar
|
||||
// 3. TABLE_NAME 128 12 VarChar
|
||||
// 4. TABLE_TYPE 128 12 VarChar 'SYSTEM TABLE' 'TABLE' 'VIEW'
|
||||
// 'GLOBAL TEMPORARY' 'LOCAL TEMPORARY'
|
||||
// 'ALIAS' 'SYNONYM'
|
||||
// 5. REMARKS 254 12 VarChar
|
||||
// TABLE_CATALOG is the SQL alternative to TABLE_CAT
|
||||
// TABLE_QUALIFIER is the ODBC 2.0 alternative to TABLE_CAT (ODBC 3.0).
|
||||
// TABLE_SCHEMA is the SQL alternative to TABLE_SCHEM
|
||||
// TABLE_OWNER is the ODBC 2.0 alternative to TABLE_SCHEM (ODBC 3.0).
|
||||
// Variations:
|
||||
// Sage Line 50: TABLE_QUALIFIER, TABLE_OWNER, TABLE_NAME, TABLE_TYPE, REMARKS.
|
||||
// Sybase Advantage: QUALIFIERNAME, OWNERNAME, TABLENAME, TYPENAME, REMARKS
|
||||
//-----------------------------------------------------------
|
||||
String database = String.Empty, schema = String.Empty, tableName = String.Empty, type = String.Empty, remarks = String.Empty;
|
||||
foreach (DataColumn column in tableSchema.Columns)
|
||||
{
|
||||
String colName = column.ColumnName;
|
||||
String value = row[colName].ToString();
|
||||
if (colName.EqualsCI("TABLE_CAT") || colName.EqualsCI("TABLE_CATALOG") || colName.EqualsCI("TABLE_QUALIFIER") || colName.EqualsCI("QualifierName"))
|
||||
database = value;
|
||||
else if (colName.EqualsCI("TABLE_SCHEM") || colName.EqualsCI("TABLE_SCHEMA") || colName.EqualsCI("TABLE_OWNER") || colName.EqualsCI("OwnerName"))
|
||||
schema = value;
|
||||
else if (colName.EqualsCI("TABLE_NAME") || colName.EqualsCI("TableName"))
|
||||
tableName = value;
|
||||
else if (colName.EqualsCI("TABLE_TYPE") || colName.EqualsCI("TypeName"))
|
||||
type = value;
|
||||
else if (colName.EqualsCI("REMARKS"))
|
||||
remarks = value;
|
||||
else
|
||||
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.StartsWithCI("trace_xe_")))
|
||||
{
|
||||
//-----------------------------------------------------------
|
||||
// Columns are: Name Size Data Type Values
|
||||
// 1. TABLE_CAT 255 12 VarChar
|
||||
// 2. TABLE_SCHEM 128 12 VarChar
|
||||
// 3. TABLE_NAME 128 12 VarChar
|
||||
// 4. TABLE_TYPE 128 12 VarChar 'SYSTEM TABLE' 'TABLE' 'VIEW'
|
||||
// 'GLOBAL TEMPORARY' 'LOCAL TEMPORARY'
|
||||
// 'ALIAS' 'SYNONYM'
|
||||
// 5. REMARKS 254 12 VarChar
|
||||
// TABLE_CATALOG is the SQL alternative to TABLE_CAT
|
||||
// TABLE_QUALIFIER is the ODBC 2.0 alternative to TABLE_CAT (ODBC 3.0).
|
||||
// TABLE_SCHEMA is the SQL alternative to TABLE_SCHEM
|
||||
// TABLE_OWNER is the ODBC 2.0 alternative to TABLE_SCHEM (ODBC 3.0).
|
||||
// Variations:
|
||||
// Sage Line 50: TABLE_QUALIFIER, TABLE_OWNER, TABLE_NAME, TABLE_TYPE, REMARKS.
|
||||
// Sybase Advantage: QUALIFIERNAME, OWNERNAME, TABLENAME, TYPENAME, REMARKS
|
||||
//-----------------------------------------------------------
|
||||
String database = String.Empty, schema = String.Empty, tableName = String.Empty, type = String.Empty, remarks = String.Empty;
|
||||
foreach (DataColumn column in tableSchema.Columns)
|
||||
{
|
||||
String colName = column.ColumnName;
|
||||
String value = row[colName].ToString();
|
||||
if (colName.EqualsCI("TABLE_CAT") || colName.EqualsCI("TABLE_CATALOG") || colName.EqualsCI("TABLE_QUALIFIER") || colName.EqualsCI("QualifierName"))
|
||||
database = value;
|
||||
else if (colName.EqualsCI("TABLE_SCHEM") || colName.EqualsCI("TABLE_SCHEMA") || colName.EqualsCI("TABLE_OWNER") || colName.EqualsCI("OwnerName"))
|
||||
schema = value;
|
||||
else if (colName.EqualsCI("TABLE_NAME") || colName.EqualsCI("TableName"))
|
||||
tableName = value;
|
||||
else if (colName.EqualsCI("TABLE_TYPE") || colName.EqualsCI("TypeName"))
|
||||
type = value;
|
||||
else if (colName.EqualsCI("REMARKS"))
|
||||
remarks = value;
|
||||
else
|
||||
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 DEBUG
|
||||
//SaLogger.Trace($"{SysUtil.Fn} Database={database}, Schema={schema}, Table={tableName}, Type={type}");
|
||||
//SaLogger.Trace($"{SysUtil.Fn} Database={database}, Schema={schema}, Table={tableName}, Type={type}");
|
||||
#endif
|
||||
tables.Add(new DbDfnTable(schema, tableName, remarks));
|
||||
}
|
||||
tables.Add(new DbDfnTable(schema, tableName, remarks));
|
||||
}
|
||||
}
|
||||
List<DbDfnTable> tablesUnsorted = tables.ToList();
|
||||
if (SacsSystem.DebugMode && tablesUnsorted.Exists(item => item == null))
|
||||
Debugger.Break();
|
||||
tables.Clear();
|
||||
tables.AddRange(tablesUnsorted.OrderBy(item => item.Name).ToList());
|
||||
}
|
||||
if (SacsSystem.DebugMode && tables.Exists(item => item == null))
|
||||
Debugger.Break();
|
||||
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)}");
|
||||
}
|
||||
}
|
||||
@@ -193,11 +193,11 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
dbSecurityItem.ExecuteInsertCommand(dbCommand);
|
||||
securityItem.Id = new SysId(dbSecurityItem._Id);
|
||||
securityItem.Changed = false;
|
||||
if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn}Inserted. {GetLogProperties(securityItem).Concat(": ").Concat("", "\n\t")}");
|
||||
if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn} Inserted. {GetLogProperties(securityItem).Concat(": ").Concat("", "\n\t")}");
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -209,7 +209,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
if (!SysId.IsValid(securityItem.Id)) return SetErrorState(ErrorMessage.InvalidItemId);
|
||||
if (!securityItem.Changed)
|
||||
{
|
||||
if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn}Data not changed. {GetLogProperties(securityItem).Concat(": ").Concat("", "\n\t")}");
|
||||
if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn} Data not changed. {GetLogProperties(securityItem).Concat(": ").Concat("", "\n\t")}");
|
||||
return true;
|
||||
}
|
||||
using (var dbConnection = Database.CreateConnection())
|
||||
@@ -226,14 +226,14 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
PopulateTo(dbSecurityItem, securityItem, dbUpdateInfo);
|
||||
dbSecurityItem.ExecuteUpdateCommand(dbCommand);
|
||||
securityItem.Changed = false;
|
||||
if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn}Updated. {GetLogProperties(securityItem).Concat(": ").Concat("", "\n\t")}");
|
||||
if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn} Updated. {GetLogProperties(securityItem).Concat(": ").Concat("", "\n\t")}");
|
||||
// Record updates.
|
||||
updateLogMonitor.RecordUpdatedValues(securityItem);
|
||||
updateLogMonitor.LogUpdates();
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@@ -261,11 +261,11 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
dbCommand.CommandType = System.Data.CommandType.Text;
|
||||
dbCommand.CommandText = "DELETE FROM " + TableName_SecItem + " WHERE Id=" + SysId.ToString(securityItem.Id) + ";";
|
||||
dbCommand.ExecuteNonQuery();
|
||||
if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn}Deleted. {GetLogProperties(securityItem).Concat(": ").Concat("", "\n\t")}");
|
||||
if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn} Deleted. {GetLogProperties(securityItem).Concat(": ").Concat("", "\n\t")}");
|
||||
}
|
||||
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)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
// S e c u r i t y L i n k s
|
||||
//*******************************************************************
|
||||
// Security Link exists.
|
||||
private String GetSecurityLinkFilter (SysId itemIdOwner, SysId itemIdTarget, SysId itemIdContext)
|
||||
private String GetSecurityLinkFilter(SysId itemIdOwner, SysId itemIdTarget, SysId itemIdContext)
|
||||
{
|
||||
ClearErrorState();
|
||||
SaSecurityLink.Params prm = new SaSecurityLink.Params();
|
||||
@@ -30,7 +30,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
prm.StatusCat = SaSecurityLink.StatusCat.Any;
|
||||
return GetSecurityLinkQueryFilter(prm).Concat(" AND ", "(", ")");
|
||||
}
|
||||
public override bool SecurityLinkExistsByItemsIds (SysId itemIdOwner, SysId itemIdTarget, SysId itemIdContext)
|
||||
public override bool SecurityLinkExistsByItemsIds(SysId itemIdOwner, SysId itemIdTarget, SysId itemIdContext)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetSecurityItemCount(GetSecurityLinkFilter(itemIdOwner, itemIdTarget, itemIdContext)) == 1;
|
||||
@@ -38,7 +38,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Get Security Link.
|
||||
private SaSecurityLink GetSecurityLink (String filter)
|
||||
private SaSecurityLink GetSecurityLink(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (GetSecurityLinkCount(filter) != 1) return null;
|
||||
@@ -57,13 +57,13 @@ 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)}");
|
||||
}
|
||||
}
|
||||
return securityLink;
|
||||
}
|
||||
public override SaSecurityLink GetSecurityLinkByItemsIds (SysId itemIdOwner, SysId itemIdTarget, SysId itemIdContext)
|
||||
public override SaSecurityLink GetSecurityLinkByItemsIds(SysId itemIdOwner, SysId itemIdTarget, SysId itemIdContext)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetSecurityLink(GetSecurityLinkFilter(itemIdOwner, itemIdTarget, itemIdContext));
|
||||
@@ -71,12 +71,12 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Create item.
|
||||
public override SaSecurityLink CreateSecurityLink (SysId itemIdOwner, SysId itemIdTarget, SysId itemIdContext)
|
||||
public override SaSecurityLink CreateSecurityLink(SysId itemIdOwner, SysId itemIdTarget, SysId itemIdContext)
|
||||
{
|
||||
ClearErrorState();
|
||||
return new SaSecurityLink_Dbas(itemIdOwner, itemIdTarget, itemIdContext, 0);
|
||||
}
|
||||
private SaSecurityLink CreateSecurityLink (SaSecLink_Db dbSecLink)
|
||||
private SaSecurityLink CreateSecurityLink(SaSecLink_Db dbSecLink)
|
||||
{
|
||||
ClearErrorState();
|
||||
return new SaSecurityLink_Dbas(new SysId(dbSecLink._ItemOwner), new SysId(dbSecLink._ItemTarget), new SysId(dbSecLink._ItemContext), (ushort)dbSecLink._Flags);
|
||||
@@ -84,7 +84,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Validate item.
|
||||
public override bool IsValidSecurityLinkData (SaSecurityLink.Data securityLinkData, SaSecurityLink.ErrField errField)
|
||||
public override bool IsValidSecurityLinkData(SaSecurityLink.Data securityLinkData, SaSecurityLink.ErrField errField)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.IsValidSecurityLinkData(securityLinkData, errField)) return false;
|
||||
@@ -93,7 +93,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Insert item.
|
||||
public override bool InsertSecurityLink (SaSecurityLink securityLink, DbUpdateInfo dbUpdateInfo)
|
||||
public override bool InsertSecurityLink(SaSecurityLink securityLink, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!IsValidSecurityLink(securityLink)) return false;
|
||||
@@ -109,12 +109,12 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Update item.
|
||||
public override bool UpdateSecurityLink (SaSecurityLink securityLink, DbUpdateInfo dbUpdateInfo)
|
||||
public override bool UpdateSecurityLink(SaSecurityLink securityLink, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!IsValidSecurityLink(securityLink)) return false;
|
||||
@@ -136,18 +136,18 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Delete item.
|
||||
public override bool SecurityLinkCanBeDeleted (SaSecurityLink securityLink)
|
||||
public override bool SecurityLinkCanBeDeleted(SaSecurityLink securityLink)
|
||||
{
|
||||
ClearErrorState();
|
||||
if (!base.SecurityLinkCanBeDeleted(securityLink)) return false;
|
||||
return true;
|
||||
}
|
||||
public override bool DeleteSecurityLink (SaSecurityLink securityLink, DbUpdateInfo dbUpdateInfo)
|
||||
public override bool DeleteSecurityLink(SaSecurityLink securityLink, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
ClearErrorState();
|
||||
using (var dbConnection = Database.CreateConnection())
|
||||
@@ -168,19 +168,19 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
}
|
||||
catch (Exception exc) { SetErrorState(exc.Message); }
|
||||
}
|
||||
return !HasErrorState();
|
||||
return OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Copy data properties to and from database.
|
||||
private void PopulateTo (SaSecLink_Db dbSecurityLink, SaSecurityLink securityLink, DbUpdateInfo dbUpdateInfo)
|
||||
private void PopulateTo(SaSecLink_Db dbSecurityLink, SaSecurityLink securityLink, DbUpdateInfo dbUpdateInfo)
|
||||
{
|
||||
dbSecurityLink._ItemOwner = SysId.ToInt(securityLink.ItemIdOwner);
|
||||
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)
|
||||
@@ -193,18 +193,18 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
dbSecurityLink._UpdateBy = dbUpdateInfo.UserId.ToInt();
|
||||
dbSecurityLink._UpdateHost = dbUpdateInfo.Host;
|
||||
}
|
||||
private void PopulateFrom (SaSecLink_Db dbSecurityLink, SaSecurityLink securityLink)
|
||||
private void PopulateFrom(SaSecLink_Db dbSecurityLink, SaSecurityLink securityLink)
|
||||
{
|
||||
//securityLink.Id = new SysId(dbSecurityLink._Id);
|
||||
//securityLink.ItemIdOwner = new SysId(dbSecurityLink._ItemOwner);
|
||||
//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();
|
||||
}
|
||||
|
||||
@@ -224,9 +224,9 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
alias = aliasSecurityLink;
|
||||
col.Set(caption, width, (int)dbCol, prefix + SaSecurityDbDfn.GetColumnName(dbCol, false), SaSecurityDbDfn.GetColumnNameQual(dbCol, alias), dataType, align);
|
||||
}
|
||||
public override ColumnDfn GetSecurityLinkColumnDfn (SaSecurityLink.Column columnId, string caption = "", int width = 0)
|
||||
public override ColumnDfn GetSecurityLinkColumnDfn(SaSecurityLink.Column columnId, string caption = "", int width = 0)
|
||||
{
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)columnId,caption,width);
|
||||
ColumnDfn columnDfn = new ColumnDfn((int)columnId, caption, width);
|
||||
switch (columnId)
|
||||
{
|
||||
case SaSecurityLink.Column.Pos:
|
||||
@@ -305,7 +305,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// SecurityLink query filter.
|
||||
public override List<string> GetSecurityLinkQueryFilter (SaSecurityLink.Params prm)
|
||||
public override List<string> GetSecurityLinkQueryFilter(SaSecurityLink.Params prm)
|
||||
{
|
||||
List<String> filter = new List<String>();
|
||||
|
||||
@@ -348,7 +348,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
return filter;
|
||||
}
|
||||
// Security Link sort columns.
|
||||
public List<String> GetSecurityLinkSortColumns (SaSecurityLink.Params prm)
|
||||
public List<String> GetSecurityLinkSortColumns(SaSecurityLink.Params prm)
|
||||
{
|
||||
// Sort sequence:
|
||||
List<String> sortColumnNames = new List<String>();
|
||||
@@ -386,12 +386,12 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// SecurityLink count.
|
||||
private long GetSecurityLinkCount (String filter)
|
||||
private long GetSecurityLinkCount(String filter)
|
||||
{
|
||||
ClearErrorState();
|
||||
return Database.GetRowCount(TableName_SecLink + " As " + aliasSecurityLink, filter);
|
||||
}
|
||||
public override long GetSecurityLinkCount (SaSecurityLink.Params prm)
|
||||
public override long GetSecurityLinkCount(SaSecurityLink.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
return GetSecurityLinkCount(GetSecurityLinkQueryFilter(prm).Concat(" AND ", "(", ")"));
|
||||
@@ -399,7 +399,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security Link list.
|
||||
public override List<SaSecurityLink> GetSecurityLinkList (SaSecurityLink.Params prm)
|
||||
public override List<SaSecurityLink> GetSecurityLinkList(SaSecurityLink.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
List<SaSecurityLink> secLinks = new List<SaSecurityLink>();
|
||||
@@ -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)}");
|
||||
}
|
||||
}
|
||||
@@ -440,7 +440,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Security Link query.
|
||||
public override DbResultSet ExecuteSecurityLinkQuery (List<ColumnDfn> columns, SaSecurityLink.Params prm)
|
||||
public override DbResultSet ExecuteSecurityLinkQuery(List<ColumnDfn> columns, SaSecurityLink.Params prm)
|
||||
{
|
||||
ClearErrorState();
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -1,22 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>Sarand.Net.Standard</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>Sarand.Net.Standard</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Dbas\Bus\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Dbas\Bus\" />
|
||||
<Folder Include="Resources\Database\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
|
||||
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
|
||||
<PackageReference Include="System.Data.Odbc" Version="6.0.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
|
||||
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
|
||||
<PackageReference Include="System.Data.Odbc" Version="6.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SacsStandardBase\SacsStandardBase.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\**\*.*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SacsStandardBase\SacsStandardBase.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user