BusinessMgr 3.0.1.6
This commit is contained in:
@@ -13,6 +13,9 @@ namespace Sarand.Net.Standard.Accounts.QuickBooks.Online
|
|||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// D e f i n i t i o n s
|
// D e f i n i t i o n s
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
|
||||||
|
#pragma warning disable 0414
|
||||||
|
|
||||||
// Keys.
|
// Keys.
|
||||||
// Sarand Sandbox company:
|
// Sarand Sandbox company:
|
||||||
// CompanyId 193514292338962
|
// CompanyId 193514292338962
|
||||||
@@ -75,6 +78,8 @@ namespace Sarand.Net.Standard.Accounts.QuickBooks.Online
|
|||||||
private static String kpcACCEPTENCODING = "Accept-Encoding"; // The Compression format of the response data.
|
private static String kpcACCEPTENCODING = "Accept-Encoding"; // The Compression format of the response data.
|
||||||
private static String kpcUSERAGENT = "V3PHPSDK2.4.1"; // The Request source header value.
|
private static String kpcUSERAGENT = "V3PHPSDK2.4.1"; // The Request source header value.
|
||||||
|
|
||||||
|
#pragma warning restore 0414
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Data members.
|
// Data members.
|
||||||
|
|
||||||
|
|||||||
@@ -164,8 +164,8 @@ namespace Sarand.Net.Standard.Base.CodeTypes
|
|||||||
public abstract int GetCodeCount(SaCode.Params prmCode);
|
public abstract int GetCodeCount(SaCode.Params prmCode);
|
||||||
public abstract SaCode GetCode(SaCode.Params prmCode);
|
public abstract SaCode GetCode(SaCode.Params prmCode);
|
||||||
/// <summary>Get filtered code type codes, indexed by Code Type code.</summary>
|
/// <summary>Get filtered code type codes, indexed by Code Type code.</summary>
|
||||||
public abstract Dictionary<String, List<SaCode>> GetCodesByCodeType(SaCode.Params prmCode);
|
public abstract Dictionary<String, List<SaCode>> GetCodes(SaCode.Params prmCode);
|
||||||
public abstract Task<Dictionary<String, List<SaCode>>> GetCodesByCodeTypeAsync(SaCode.Params prmCode);
|
public abstract Task<Dictionary<String, List<SaCode>>> GetCodesAsync(SaCode.Params prmCode);
|
||||||
/// <summary>Get filtered codes and descriptions, indexed by Code Type code.</summary>
|
/// <summary>Get filtered codes and descriptions, indexed by Code Type code.</summary>
|
||||||
public abstract Dictionary<String, List<CodeDesc>> GetCodeDescsByCodeType(SaCode.Params prmCode);
|
public abstract Dictionary<String, List<CodeDesc>> GetCodeDescsByCodeType(SaCode.Params prmCode);
|
||||||
// Code updates.
|
// Code updates.
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
LeftOuter,
|
LeftOuter,
|
||||||
RightOuter,
|
RightOuter,
|
||||||
FullOuter,
|
FullOuter,
|
||||||
|
OuterApply,
|
||||||
Cross,
|
Cross,
|
||||||
}
|
}
|
||||||
public enum DbOrderByNullMode
|
public enum DbOrderByNullMode
|
||||||
@@ -87,6 +88,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
case DbJoinType.LeftOuter: return (DbGlobalDbms.Type == DbmsType.Sage ? "LEFT JOIN" : "LEFT OUTER JOIN");
|
case DbJoinType.LeftOuter: return (DbGlobalDbms.Type == DbmsType.Sage ? "LEFT JOIN" : "LEFT OUTER JOIN");
|
||||||
case DbJoinType.RightOuter: return (DbGlobalDbms.Type == DbmsType.Sage ? "RIGHT JOIN" : "RIGHT OUTER JOIN");
|
case DbJoinType.RightOuter: return (DbGlobalDbms.Type == DbmsType.Sage ? "RIGHT JOIN" : "RIGHT OUTER JOIN");
|
||||||
case DbJoinType.FullOuter: return (DbGlobalDbms.Type == DbmsType.Sage ? "FULL JOIN" : "FULL OUTER JOIN");
|
case DbJoinType.FullOuter: return (DbGlobalDbms.Type == DbmsType.Sage ? "FULL JOIN" : "FULL OUTER JOIN");
|
||||||
|
case DbJoinType.OuterApply: return ("OUTER APPLY");
|
||||||
case DbJoinType.Cross: return "CROSS JOIN";
|
case DbJoinType.Cross: return "CROSS JOIN";
|
||||||
case DbJoinType.Inner:
|
case DbJoinType.Inner:
|
||||||
default: return "INNER JOIN";
|
default: return "INNER JOIN";
|
||||||
@@ -134,10 +136,11 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
foreach (var subJoin in SubJoins)
|
foreach (var subJoin in SubJoins)
|
||||||
{
|
{
|
||||||
// Add another bracket in front of the table:
|
// Add another bracket in front of the table:
|
||||||
joinTable = "(" + joinTable;
|
joinTable = $"({joinTable}";
|
||||||
// Add the sub join.
|
// Add the sub join.
|
||||||
subJoinData += subJoin.BuildJoin("") + ")";
|
subJoinData += $"{subJoin.BuildJoin("")})";
|
||||||
}
|
}
|
||||||
|
//---------------------------------------------------------------
|
||||||
// Build this join's list of filter conditions.
|
// Build this join's list of filter conditions.
|
||||||
// Take care not to add too many embedded brackets - confuses Access etc.
|
// Take care not to add too many embedded brackets - confuses Access etc.
|
||||||
// [Original version: lFilter.Concat (" AND ", "(", ")", true, true)].
|
// [Original version: lFilter.Concat (" AND ", "(", ")", true, true)].
|
||||||
@@ -149,36 +152,39 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
if (filterClause.IsEmpty()) continue;
|
if (filterClause.IsEmpty()) continue;
|
||||||
// Embed the clause in brackets if it contains at least one 'OR' operator.
|
// Embed the clause in brackets if it contains at least one 'OR' operator.
|
||||||
if (filterClause.IndexOf(" OR ", StringComparison.OrdinalIgnoreCase) >= 0)
|
if (filterClause.IndexOf(" OR ", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||||
filterClause = "(" + filterClause + ")";
|
filterClause = $"({filterClause})";
|
||||||
filter += (!filter.IsEmpty() ? " AND " : "") + filterClause;
|
filter += (!filter.IsEmpty() ? " AND " : "") + filterClause;
|
||||||
}
|
}
|
||||||
// Surround the entire filter in brackets (if not already done).
|
// Surround the entire filter in brackets (if not already done).
|
||||||
if (filter.FindMatchingBrace(0) != filter.Length)
|
if (!StringUtil.IsBlank(filter) && filter.FindMatchingBrace(0) != filter.Length)
|
||||||
filter = "(" + filter + ")";
|
filter = $"({filter})";
|
||||||
|
//---------------------------------------------------------------
|
||||||
// Build the join.
|
// Build the join.
|
||||||
if (enclosedJoin.IsEmpty() && subJoinData.IsEmpty())
|
if (enclosedJoin.IsEmpty() && subJoinData.IsEmpty())
|
||||||
{
|
{
|
||||||
//-----------------------------------------------------------
|
|
||||||
// Simple join syntax.
|
// Simple join syntax.
|
||||||
// <Join-Type> <Join-Table> ON <Join-Filter>
|
// <Join-Type> <Join-Table> ON <Join-Filter>
|
||||||
joinData = joinType + " " + joinTable + " ON " + filter;
|
joinData = $"{joinType} {joinTable}";
|
||||||
//-----------------------------------------------------------
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//-----------------------------------------------------------
|
|
||||||
// More complex join syntax - nested joins.
|
// More complex join syntax - nested joins.
|
||||||
// <Join-Type> (<Join-Table> <NestedJoin>) ON <Join-Filter>
|
// <Join-Type> (<Join-Table> <NestedJoin>) ON <Join-Filter>
|
||||||
//-----------------------------------------------------------
|
|
||||||
// Bracket the table, enclosing any enclosed or subordinate joins.
|
// Bracket the table, enclosing any enclosed or subordinate joins.
|
||||||
joinData = joinType + " (" + joinTable;
|
joinData = $"{joinType} ({joinTable}";
|
||||||
if (!subJoinData.IsEmpty())
|
if (!subJoinData.IsEmpty())
|
||||||
joinData += " " + subJoinData;
|
joinData += $" {subJoinData}";
|
||||||
if (!enclosedJoin.IsEmpty())
|
if (!enclosedJoin.IsEmpty())
|
||||||
joinData += " " + enclosedJoin;
|
joinData += $" {enclosedJoin}";
|
||||||
joinData += ") ON " + filter;
|
joinData += ")";
|
||||||
//-----------------------------------------------------------
|
|
||||||
}
|
}
|
||||||
|
//---------------------------------------------------------------
|
||||||
|
// Add the join filter.
|
||||||
|
if (Type != DbJoinType.OuterApply)
|
||||||
|
joinData += $" ON {filter}";
|
||||||
|
else if (!StringUtil.IsBlank(filter))
|
||||||
|
SaLogger.Warn($"{SysUtil.Fn} Filter found on 'Outer Apply' join: '{filter}'.");
|
||||||
|
//---------------------------------------------------------------
|
||||||
return joinData;
|
return joinData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,13 +193,13 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
public void Dump()
|
public void Dump()
|
||||||
{
|
{
|
||||||
SaLogger.Debug($"{SysUtil.Fn}");
|
SaLogger.Debug($"{SysUtil.Fn}");
|
||||||
SaLogger.Debug("\tType = " + GetJoinType(Type));
|
SaLogger.Debug($"\tType = {GetJoinType(Type)}");
|
||||||
SaLogger.Debug("\tTable = " + Table.Concat(" AS "));
|
SaLogger.Debug($"\tTable = {Table.Concat(" AS ")}");
|
||||||
SaLogger.Debug("\tFilters = " + Filters.Concat("", "\t\t", "\n"));
|
SaLogger.Debug($"\tFilters = {Filters.Concat("", "\t\t", "\n")}");
|
||||||
if (SubJoins.Count > 0)
|
if (SubJoins.Count > 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
SaLogger.Debug("\tJoin = " + BuildJoin(""));
|
SaLogger.Debug($"\tJoin = {BuildJoin("")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@@ -229,8 +235,8 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
foreach (var join in joins)
|
foreach (var join in joins)
|
||||||
{
|
{
|
||||||
// Add the next join in the list.
|
// Add the next join in the list.
|
||||||
if (++joinCount > 1 && !joinData.IsEmpty()) joinData = "(" + joinData + ")";
|
if (++joinCount > 1 && !joinData.IsEmpty()) joinData = $"({joinData})";
|
||||||
joinData = joinData + " " + join.BuildJoin("");
|
joinData = $"{joinData} {join.BuildJoin("")}";
|
||||||
joinData.Trim();
|
joinData.Trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,7 +253,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
joinData = join.BuildJoin(joinData);
|
joinData = join.BuildJoin(joinData);
|
||||||
joinData.Trim();
|
joinData.Trim();
|
||||||
}
|
}
|
||||||
joinData = primaryTable + " " + joinData;
|
joinData = $"{primaryTable} {joinData}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return joinData;
|
return joinData;
|
||||||
@@ -342,14 +348,14 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
if (!rawValue.IsEmpty() || !ignoreBlanks)
|
if (!rawValue.IsEmpty() || !ignoreBlanks)
|
||||||
{
|
{
|
||||||
if (stringData)
|
if (stringData)
|
||||||
value = "'" + FormatForCondition(value) + "'";
|
value = $"'{FormatForCondition(value)}'";
|
||||||
else value.Trim(); // Non string data can be cleansed.
|
else value.Trim(); // Non string data can be cleansed.
|
||||||
values.Add(value);
|
values.Add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
values.RemoveDuplicatesCI();
|
values.RemoveDuplicatesCI();
|
||||||
if (values.Count > 0)
|
if (values.Count > 0)
|
||||||
result = "(" + values.Concat(",") + ")";
|
result = $"({values.Concat(",")})";
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,7 +418,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
{
|
{
|
||||||
// Surround the expression in brackets if not present.
|
// Surround the expression in brackets if not present.
|
||||||
if (expression.Left(1) != "(")
|
if (expression.Left(1) != "(")
|
||||||
expression = "(" + expression + ")";
|
expression = $"({expression})";
|
||||||
// Logic to include or exclude null values.
|
// Logic to include or exclude null values.
|
||||||
if (excludeNulls)
|
if (excludeNulls)
|
||||||
{
|
{
|
||||||
@@ -443,7 +449,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
{
|
{
|
||||||
// Surround the expression in brackets if not present.
|
// Surround the expression in brackets if not present.
|
||||||
if (expression.Left(1) != "(")
|
if (expression.Left(1) != "(")
|
||||||
expression = "(" + expression + ")";
|
expression = $"({expression})";
|
||||||
// Logic to promote null values to start of sequence or demote null values to the end of the sequence.
|
// Logic to promote null values to start of sequence or demote null values to the end of the sequence.
|
||||||
String nullsClause = String.Empty;
|
String nullsClause = String.Empty;
|
||||||
if (nullMode == DbOrderByNullMode.PromoteNulls || nullMode == DbOrderByNullMode.DatePromoteNulls)
|
if (nullMode == DbOrderByNullMode.PromoteNulls || nullMode == DbOrderByNullMode.DatePromoteNulls)
|
||||||
@@ -452,15 +458,15 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
{
|
{
|
||||||
// Treat NULLs before other values.
|
// Treat NULLs before other values.
|
||||||
List<String> nullsFilters = new List<String>();
|
List<String> nullsFilters = new List<String>();
|
||||||
nullsFilters.Add(expression + " IS NULL");
|
nullsFilters.Add($"{expression} IS NULL");
|
||||||
if (treatZeroAsNull)
|
if (treatZeroAsNull)
|
||||||
nullsFilters.Add(expression + "=0");
|
nullsFilters.Add($"{expression}=0");
|
||||||
if (nullMode == DbOrderByNullMode.DatePromoteNulls)
|
if (nullMode == DbOrderByNullMode.DatePromoteNulls)
|
||||||
nullsFilters.Add(expression + "<=" + FormatDateForCondition(NullDate));
|
nullsFilters.Add($"{expression}<={FormatDateForCondition(NullDate)}");
|
||||||
nullsClause = "(CASE WHEN " + nullsFilters.Concat(" OR ", "(", ")") + " THEN 0 ELSE 1 END)";
|
nullsClause = $"(CASE WHEN {nullsFilters.Concat(" OR ", "(", ")")} THEN 0 ELSE 1 END)";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nullsClause = expression + " IS NULL";
|
nullsClause = $"{expression} IS NULL";
|
||||||
}
|
}
|
||||||
else if (nullMode == DbOrderByNullMode.DemoteNulls || nullMode == DbOrderByNullMode.DateDemoteNulls)
|
else if (nullMode == DbOrderByNullMode.DemoteNulls || nullMode == DbOrderByNullMode.DateDemoteNulls)
|
||||||
{
|
{
|
||||||
@@ -472,15 +478,15 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
if (treatZeroAsNull)
|
if (treatZeroAsNull)
|
||||||
nullsFilters.Add(expression + "=0");
|
nullsFilters.Add(expression + "=0");
|
||||||
if (nullMode == DbOrderByNullMode.DateDemoteNulls)
|
if (nullMode == DbOrderByNullMode.DateDemoteNulls)
|
||||||
nullsFilters.Add(expression + "<=" + FormatDateForCondition(NullDate));
|
nullsFilters.Add($"{expression}<={FormatDateForCondition(NullDate)}");
|
||||||
nullsClause = "(CASE WHEN " + nullsFilters.Concat(" OR ", "(", ")") + " THEN 1 ELSE 0 END)";
|
nullsClause = $"(CASE WHEN {nullsFilters.Concat(" OR ", "(", ")")} THEN 1 ELSE 0 END)";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nullsClause = expression + " IS NOT NULL";
|
nullsClause = $"{expression} IS NOT NULL";
|
||||||
}
|
}
|
||||||
if (!nullsClause.IsEmpty()) orderBy.Add(nullsClause);
|
if (!nullsClause.IsEmpty()) orderBy.Add(nullsClause);
|
||||||
// Main clause for this expression.
|
// Main clause for this expression.
|
||||||
orderBy.Add(expression + " " + (ascending ? "ASC" : "DESC"));
|
orderBy.Add($"{expression} {(ascending ? "ASC" : "DESC")}");
|
||||||
}
|
}
|
||||||
return orderBy;
|
return orderBy;
|
||||||
}
|
}
|
||||||
@@ -617,7 +623,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
}
|
}
|
||||||
if (interval.IsEmpty()) return "''";
|
if (interval.IsEmpty()) return "''";
|
||||||
}
|
}
|
||||||
return "DateDiff(" + interval + "," + column1 + "," + column2 + ")";
|
return $"DateDiff({interval},{column1},{column2})";
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@@ -643,7 +649,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SaLogger.Debug("BuildBitMappedFilter - Invalid bit (" + bit + ").");
|
SaLogger.Debug($"BuildBitMappedFilter - Invalid bit ({bit}).");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -662,7 +668,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
if (!clause.IsEmpty())
|
if (!clause.IsEmpty())
|
||||||
{
|
{
|
||||||
if (DbGlobalDbms.Type == DbmsType.MsSql)
|
if (DbGlobalDbms.Type == DbmsType.MsSql)
|
||||||
clause = "(" + clause + " <> 0)";
|
clause = $"({clause} <> 0)";
|
||||||
}
|
}
|
||||||
return clause;
|
return clause;
|
||||||
}
|
}
|
||||||
@@ -708,23 +714,23 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// Start with the column names.
|
// Start with the column names.
|
||||||
String query = "SELECT ";
|
String query = "SELECT";
|
||||||
if (DistinctRows) query += "DISTINCT ";
|
if (DistinctRows) query += " DISTINCT";
|
||||||
if (RowLimit > 0) query += "TOP " + RowLimit.ToString() + " ";
|
if (RowLimit > 0) query += $" TOP {RowLimit.ToString()}";
|
||||||
if (Columns.Count < 1) query += "* ";
|
if (Columns.Count < 1) query += " *";
|
||||||
else query += Columns.Concat(" AS ", false).Concat(",");
|
else query += $" {Columns.Concat(" AS ", false).Concat(",")}";
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// Add the tables and joins.
|
// Add the tables and joins.
|
||||||
String tableAliasOperator = DbGlobalDbms.Type == DbmsType.Sage ? " " : " AS ";
|
String tableAliasOperator = DbGlobalDbms.Type == DbmsType.Sage ? " " : " AS ";
|
||||||
if (Tables.Count > 1 || Joins.Count < 1)
|
if (Tables.Count > 1 || Joins.Count < 1)
|
||||||
{
|
{
|
||||||
query += " FROM " + Tables.Concat(tableAliasOperator, false).Concat(",") + " " + Joins.BuildJoins("");
|
query += $" FROM {Tables.Concat(tableAliasOperator, false).Concat(",")} {Joins.BuildJoins("")}";
|
||||||
}
|
}
|
||||||
else if (Tables.Count == 1)
|
else if (Tables.Count == 1)
|
||||||
{
|
{
|
||||||
// Table name is bracketed with multiple joins...
|
// Single Table name is bracketed with multiple joins.
|
||||||
query += " FROM " + Joins.BuildJoins(Tables.Concat(tableAliasOperator, false)[0]);
|
query += $" FROM {Joins.BuildJoins(Tables.Concat(tableAliasOperator, false)[0])}";
|
||||||
}
|
}
|
||||||
query.TrimEnd(' ');
|
query.TrimEnd(' ');
|
||||||
|
|
||||||
@@ -732,24 +738,24 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
// Filters.
|
// Filters.
|
||||||
String filter = Filters.Concat(" AND ", "(", ")", true, true);
|
String filter = Filters.Concat(" AND ", "(", ")", true, true);
|
||||||
// Jan2019 Not required: if (Filters.Count > 1) filter = "(" + filter + ")";
|
// Jan2019 Not required: if (Filters.Count > 1) filter = "(" + filter + ")";
|
||||||
if (!filter.IsEmpty()) query += " WHERE " + filter;
|
if (!filter.IsEmpty()) query += $" WHERE {filter}";
|
||||||
|
|
||||||
// Groupings.
|
// Groupings.
|
||||||
String groupByData = GroupBy.Concat(",", "", "", true, true);
|
String groupByClause = GroupBy.Concat(",", "", "", true, true);
|
||||||
if (!groupByData.IsEmpty()) query += " GROUP BY " + groupByData;
|
if (!groupByClause.IsEmpty()) query += $" GROUP BY {groupByClause}";
|
||||||
|
|
||||||
// Sort sequence.
|
// Sort sequence.
|
||||||
String orderByData = OrderBy.Concat(",", "", "", true, true);
|
String orderByClause = OrderBy.Concat(",", "", "", true, true);
|
||||||
if (!orderByData.IsEmpty()) query += " ORDER BY " + orderByData;
|
if (!orderByClause.IsEmpty()) query += $" ORDER BY {orderByClause}";
|
||||||
|
|
||||||
// Paging.
|
// Paging.
|
||||||
if (paging != null && paging.Paged)
|
if (paging != null && paging.Paged)
|
||||||
{
|
{
|
||||||
// Must have an 'Order By' clause to use 'Offset ... Fetch Next ...'
|
// Must have an 'Order By' clause to use 'Offset ... Fetch Next ...'
|
||||||
if (orderByData.IsEmpty())
|
if (orderByClause.IsEmpty())
|
||||||
throw new NotSupportedException("Query paging requires sort order to be specified");
|
throw new NotSupportedException("Query paging requires sort order to be specified");
|
||||||
if (DbGlobalDbms.Type == DbmsType.MsSql)
|
if (DbGlobalDbms.Type == DbmsType.MsSql)
|
||||||
query += " OFFSET " + ((paging.PageNo - 1) * paging.PageLength) + " ROWS FETCH NEXT " + paging.PageLength + " ROWS ONLY";
|
query += $" OFFSET {((paging.PageNo - 1) * paging.PageLength)} ROWS FETCH NEXT {paging.PageLength} ROWS ONLY";
|
||||||
else throw new NotSupportedException($"Query paging not supported for {DbGlobalDbms.Type}");
|
else throw new NotSupportedException($"Query paging not supported for {DbGlobalDbms.Type}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -757,7 +763,7 @@ namespace Sarand.Net.Standard.Base.Dbas
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
bool bDisplayDebugMsg = false;
|
bool bDisplayDebugMsg = false;
|
||||||
if (bDisplayDebugMsg)
|
if (bDisplayDebugMsg)
|
||||||
SaLogger.Debug("Query: " + query);
|
SaLogger.Debug($"Query: {query}");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CsvHelper" Version="19.0.0" />
|
<PackageReference Include="CsvHelper" Version="19.0.0" />
|
||||||
<PackageReference Include="MailKit" Version="4.9.0" />
|
<PackageReference Include="MailKit" Version="4.11.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
|
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.3.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
|
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.3.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.6" />
|
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
|
||||||
<PackageReference Include="ZstdNet" Version="1.4.5" />
|
<PackageReference Include="ZstdNet" Version="1.4.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
|||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Get filtered codes, indexed by Code Type code.
|
// Get filtered codes, indexed by Code Type code.
|
||||||
public override Dictionary<String, List<SaCode>> GetCodesByCodeType(SaCode.Params prmCode)
|
public override Dictionary<String, List<SaCode>> GetCodes(SaCode.Params prmCode)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
|||||||
// Convert Code Type identity from Id to code and sort each list of codes appropriately.
|
// Convert Code Type identity from Id to code and sort each list of codes appropriately.
|
||||||
return ConvertCodeTypeIdentityAndSortCodes(codesByCodeTypeId, codeTypes);
|
return ConvertCodeTypeIdentityAndSortCodes(codesByCodeTypeId, codeTypes);
|
||||||
}
|
}
|
||||||
public override async Task<Dictionary<String, List<SaCode>>> GetCodesByCodeTypeAsync(SaCode.Params prmCode)
|
public override async Task<Dictionary<String, List<SaCode>>> GetCodesAsync(SaCode.Params prmCode)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
|
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
|||||||
private long GetCodeTypeCount(String filter)
|
private long GetCodeTypeCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(TableName_CodeType + " As " + aliasCodeType, filter);
|
return Database.GetRowCount($"{TableName_CodeType} As {aliasCodeType}", filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@@ -1030,7 +1030,7 @@ namespace Sarand.Net.Standard.Dbas.CodeTypes
|
|||||||
private long GetCodeCount(String filter)
|
private long GetCodeCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(TableName_Code + " As " + aliasCode, filter);
|
return Database.GetRowCount($"{TableName_Code} As {aliasCode}", filter);
|
||||||
}
|
}
|
||||||
public override long GetCodeCount(SaCode.Params prm)
|
public override long GetCodeCount(SaCode.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
|||||||
private long GetInterfaceDataItemCount(String filter)
|
private long GetInterfaceDataItemCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(TableName_InterfaceDataItem + " As " + aliasInterfaceDataItem, filter);
|
return Database.GetRowCount($"{TableName_InterfaceDataItem} As {aliasInterfaceDataItem}", filter);
|
||||||
}
|
}
|
||||||
public override long GetInterfaceDataItemCount(SaInterfaceDataItem.Params prm)
|
public override long GetInterfaceDataItemCount(SaInterfaceDataItem.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
|||||||
private long GetInterfaceProcessMessageCount(String filter)
|
private long GetInterfaceProcessMessageCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(TableName_InterfaceProcessMessage + " As " + aliasInterfaceProcessMessage, filter);
|
return Database.GetRowCount($"{TableName_InterfaceProcessMessage} As {aliasInterfaceProcessMessage}", filter);
|
||||||
}
|
}
|
||||||
public override long GetInterfaceProcessMessageCount(SaInterfaceProcessMessage.Params prm)
|
public override long GetInterfaceProcessMessageCount(SaInterfaceProcessMessage.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -621,7 +621,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
|||||||
private long GetInterfaceProcessCount(String filter)
|
private long GetInterfaceProcessCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(TableName_InterfaceProcess + " As " + aliasInterfaceProcess, filter);
|
return Database.GetRowCount($"{TableName_InterfaceProcess} As {aliasInterfaceProcess}", filter);
|
||||||
}
|
}
|
||||||
public override long GetInterfaceProcessCount(SaInterfaceProcess.Params prm)
|
public override long GetInterfaceProcessCount(SaInterfaceProcess.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -456,7 +456,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
|
|||||||
private long GetInterfaceCount (String filter)
|
private long GetInterfaceCount (String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(TableName_Interface + " As " + aliasInterface, filter);
|
return Database.GetRowCount($"{TableName_Interface} As {aliasInterface}", filter);
|
||||||
}
|
}
|
||||||
public override long GetInterfaceCount (SaInterface.Params prm)
|
public override long GetInterfaceCount (SaInterface.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -486,7 +486,7 @@ namespace Sarand.Net.Standard.Dbas.ItemData
|
|||||||
private long GetItemDataCount(String filter)
|
private long GetItemDataCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(SaItemDataDbDfn.GetTableName(SaItemDataDbDfn.TableIdx.SaItemData) + " As " + aliasItemData, filter);
|
return Database.GetRowCount($"{SaItemDataDbDfn.GetTableName(SaItemDataDbDfn.TableIdx.SaItemData)} As {aliasItemData}", filter);
|
||||||
}
|
}
|
||||||
public override long GetItemDataCount(SaItemData.Params prm)
|
public override long GetItemDataCount(SaItemData.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ namespace Sarand.Net.Standard.Dbas.ItemDocs
|
|||||||
private long GetItemDocCount (String filter)
|
private long GetItemDocCount (String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(SaItemDocsDbDfn.GetTableName(SaItemDocsDbDfn.TableIdx.SaItemDoc) + " As " + aliasItemDoc, filter);
|
return Database.GetRowCount($"{SaItemDocsDbDfn.GetTableName(SaItemDocsDbDfn.TableIdx.SaItemDoc)} As {aliasItemDoc}", filter);
|
||||||
}
|
}
|
||||||
public override long GetItemDocCount (SaItemDoc.Params prm)
|
public override long GetItemDocCount (SaItemDoc.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ namespace Sarand.Net.Standard.Dbas.ItemOptions
|
|||||||
private long GetItemOptionCount (String filter)
|
private long GetItemOptionCount (String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(SaItemOptionDbDfn.GetTableName(SaItemOptionDbDfn.TableIdx.SaItemOption) + " As " + aliasItemOption, filter);
|
return Database.GetRowCount($"{SaItemOptionDbDfn.GetTableName(SaItemOptionDbDfn.TableIdx.SaItemOption)} As {aliasItemOption}", filter);
|
||||||
}
|
}
|
||||||
public override long GetItemOptionCount (SaItemOption.Params prm)
|
public override long GetItemOptionCount (SaItemOption.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
|||||||
private long GetCurrencyCount(String filter)
|
private long GetCurrencyCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(ReferenceDataConsole.TableName_Currency + " As " + aliasCurrency, filter);
|
return Database.GetRowCount($"{ReferenceDataConsole.TableName_Currency} As {aliasCurrency}", filter);
|
||||||
}
|
}
|
||||||
public override long GetCurrencyCount(SaCurrency.Params prm)
|
public override long GetCurrencyCount(SaCurrency.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -423,7 +423,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
|||||||
private long GetLanguageCount(String filter)
|
private long GetLanguageCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(ReferenceDataConsole.TableName_Language + " As " + aliasLanguage, filter);
|
return Database.GetRowCount($"{ReferenceDataConsole.TableName_Language} As {aliasLanguage}", filter);
|
||||||
}
|
}
|
||||||
public override long GetLanguageCount(SaLanguage.Params prm)
|
public override long GetLanguageCount(SaLanguage.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -400,7 +400,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
|||||||
private long GetRegionCount(String filter)
|
private long GetRegionCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(ReferenceDataConsole.TableName_Region + " As " + aliasRegion, filter);
|
return Database.GetRowCount($"{ReferenceDataConsole.TableName_Region} As {aliasRegion}", filter);
|
||||||
}
|
}
|
||||||
public override long GetRegionCount(SaRegion.Params prm)
|
public override long GetRegionCount(SaRegion.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -442,7 +442,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
|||||||
private long GetTaxCodeCount(String filter)
|
private long GetTaxCodeCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(ReferenceDataConsole.TableName_TaxCode + " As " + aliasTaxCode, filter);
|
return Database.GetRowCount($"{ReferenceDataConsole.TableName_TaxCode} As {aliasTaxCode}", filter);
|
||||||
}
|
}
|
||||||
public override long GetTaxCodeCount(SaTaxCode.Params prm)
|
public override long GetTaxCodeCount(SaTaxCode.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ namespace Sarand.Net.Standard.Dbas.ReferenceData
|
|||||||
private long GetUnitMeasureCount(String filter)
|
private long GetUnitMeasureCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(ReferenceDataConsole.TableName_UnitMeasure + " As " + aliasUnitMeasure, filter);
|
return Database.GetRowCount($"{ReferenceDataConsole.TableName_UnitMeasure} As {aliasUnitMeasure}", filter);
|
||||||
}
|
}
|
||||||
public override long GetUnitMeasureCount(SaUnitMeasure.Params prm)
|
public override long GetUnitMeasureCount(SaUnitMeasure.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
|||||||
private long GetSecurityItemCount(String filter)
|
private long GetSecurityItemCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(TableName_SecItem + " As " + aliasSecurityItem, filter);
|
return Database.GetRowCount($"{TableName_SecItem} As {aliasSecurityItem}", filter);
|
||||||
}
|
}
|
||||||
public override long GetSecurityItemCount(SaSecurityItem.Params prm)
|
public override long GetSecurityItemCount(SaSecurityItem.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
|||||||
private long GetSecurityLinkCount(String filter)
|
private long GetSecurityLinkCount(String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(TableName_SecLink + " As " + aliasSecurityLink, filter);
|
return Database.GetRowCount($"{TableName_SecLink} As {aliasSecurityLink}", filter);
|
||||||
}
|
}
|
||||||
public override long GetSecurityLinkCount(SaSecurityLink.Params prm)
|
public override long GetSecurityLinkCount(SaSecurityLink.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -549,7 +549,7 @@ namespace Sarand.Net.Standard.Dbas.UpdateLog
|
|||||||
private long GetUpdateLogEntryCount (String filter)
|
private long GetUpdateLogEntryCount (String filter)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
return Database.GetRowCount(SaUpdateLogDbDfn.GetTableName(SaUpdateLogDbDfn.TableIdx.SaAttrUpdate) + " As " + aliasUpdateLog, filter);
|
return Database.GetRowCount($"{SaUpdateLogDbDfn.GetTableName(SaUpdateLogDbDfn.TableIdx.SaAttrUpdate)} As {aliasUpdateLog}", filter);
|
||||||
}
|
}
|
||||||
public override long GetLogEntryCount (SaUpdateLogEntry.Params prm)
|
public override long GetLogEntryCount (SaUpdateLogEntry.Params prm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DocumentFormat.OpenXml" Version="3.2.0" />
|
<PackageReference Include="DocumentFormat.OpenXml" Version="3.3.0" />
|
||||||
<PackageReference Include="NPOI" Version="2.7.2" />
|
<PackageReference Include="NPOI" Version="2.7.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user