Core item disposability
This commit is contained in:
@@ -13,7 +13,7 @@ using Sarand.Net.Standard.Base.Utils;
|
|||||||
namespace Sarand.Net.Standard.Accounts.QuickBooks.App
|
namespace Sarand.Net.Standard.Accounts.QuickBooks.App
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public class SaQuickBooksConsole : SaErrorStateItem
|
public class SaQuickBooksConsole : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Data members.
|
// Data members.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.Text;
|
|||||||
namespace Sarand.Net.Standard.Accounts.QuickBooks.Base
|
namespace Sarand.Net.Standard.Accounts.QuickBooks.Base
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaQuickBooksApiConsole : SaErrorStateItem
|
public abstract class SaQuickBooksApiConsole : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Data members.
|
// Data members.
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace Sarand.Net.Standard.Accounts.QuickBooks.Base
|
|||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// I t e r a t o r
|
// I t e r a t o r
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
public abstract class Iterator : SaErrorStateItem
|
public abstract class Iterator : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Data members.
|
// Data members.
|
||||||
@@ -119,13 +119,6 @@ namespace Sarand.Net.Standard.Accounts.QuickBooks.Base
|
|||||||
{
|
{
|
||||||
EntityType = entityType;
|
EntityType = entityType;
|
||||||
}
|
}
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Properties.
|
// Properties.
|
||||||
public Qbk.EntityType EntityType { get; }
|
public Qbk.EntityType EntityType { get; }
|
||||||
|
|||||||
@@ -42,13 +42,6 @@ namespace Sarand.Net.Standard.Accounts.QuickBooks.Internal
|
|||||||
protected Iterator (Qbk.EntityType entityType) : base(entityType)
|
protected Iterator (Qbk.EntityType entityType) : base(entityType)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected override void Dispose (bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
// Properties.
|
// Properties.
|
||||||
//---------------------------------------------------------------
|
//---------------------------------------------------------------
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace Sarand.Net.Standard.Accounts.QuickBooks.Online
|
|||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
qbkConsole = null;
|
qbkConsole.Dispose(); qbkConsole = null;
|
||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Xml.Linq;
|
|||||||
namespace Sarand.Net.Standard.Accounts.QuickBooks.Online
|
namespace Sarand.Net.Standard.Accounts.QuickBooks.Online
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
internal class SaQuickBooksRequest_Online : SaErrorStateItem
|
internal class SaQuickBooksRequest_Online : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Data members.
|
// Data members.
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using Sarand.Net.Standard.Base.Core;
|
||||||
|
using Sarand.Net.Standard.Base.Utils;
|
||||||
|
|
||||||
|
namespace Sarand.Net.Standard.Base.Bus
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
public abstract class SacsDisposableStateItem : SacsStateItem, ISacsDisposable
|
||||||
|
{
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Definitions.
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Data members.
|
||||||
|
private bool disposed = false;
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Construction.
|
||||||
|
protected SacsDisposableStateItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Disposal.
|
||||||
|
~SacsDisposableStateItem()
|
||||||
|
{
|
||||||
|
Dispose(!disposed);
|
||||||
|
}
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (disposed) return;
|
||||||
|
Dispose(true);
|
||||||
|
disposed = true;
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
// Properties.
|
||||||
|
public bool Disposed { get { return disposed; } }
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ namespace Sarand.Net.Standard.Base.Bus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public class SacsHierarchyItem : SaErrorStateItem
|
public class SacsHierarchyItem : SacsStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Definitions.
|
// Definitions.
|
||||||
@@ -333,15 +333,6 @@ namespace Sarand.Net.Standard.Base.Bus
|
|||||||
data.Id = id;
|
data.Id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
|
||||||
// Disposal.
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Properties.
|
// Properties.
|
||||||
/// <summary>By default, all hierarchy itrems have an Id.<br/>Override and return false where this is not the case.</summary>
|
/// <summary>By default, all hierarchy itrems have an Id.<br/>Override and return false where this is not the case.</summary>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using Sarand.Net.Standard.Base.Utils;
|
|||||||
namespace Sarand.Net.Standard.Base.Bus
|
namespace Sarand.Net.Standard.Base.Bus
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SacsItemMgr : SaErrorStateItem
|
public abstract class SacsItemMgr : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Definitions.
|
// Definitions.
|
||||||
|
|||||||
+8
-10
@@ -5,7 +5,10 @@ using Sarand.Net.Standard.Base.Utils;
|
|||||||
namespace Sarand.Net.Standard.Base.Bus
|
namespace Sarand.Net.Standard.Base.Bus
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaErrorStateItem : SacsDisposable, ISacsStateItem
|
/// <summary>
|
||||||
|
/// State Item - allows business component to record and report error message.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class SacsStateItem : ISacsStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Definitions.
|
// Definitions.
|
||||||
@@ -32,21 +35,15 @@ namespace Sarand.Net.Standard.Base.Bus
|
|||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Static initialisation.
|
// Static initialisation.
|
||||||
static SaErrorStateItem()
|
static SacsStateItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Construction.
|
// Construction.
|
||||||
protected SaErrorStateItem()
|
protected SacsStateItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Properties.
|
// Properties.
|
||||||
@@ -79,7 +76,8 @@ namespace Sarand.Net.Standard.Base.Bus
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool SetErrorState(String message)
|
public bool SetErrorState(String message)
|
||||||
{
|
{
|
||||||
if (StringUtil.IsEmpty(message)) return true;
|
if (StringUtil.IsBlank(message))
|
||||||
|
return false;
|
||||||
this.errorState = new SacsErrorState(message);
|
this.errorState = new SacsErrorState(message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
|||||||
namespace Sarand.Net.Standard.Base.CodeTypes
|
namespace Sarand.Net.Standard.Base.CodeTypes
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaCodeTypeConsole : SaErrorStateItem
|
public abstract class SaCodeTypeConsole : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Data members.
|
// Data members.
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using Sarand.Net.Standard.Base.Utils;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Sarand.Net.Standard.Base.Core
|
||||||
|
{
|
||||||
|
//=======================================================================
|
||||||
|
/// <summary>State Item interface.</summary>
|
||||||
|
public interface ISacsStateItem
|
||||||
|
{
|
||||||
|
bool HasErrorState();
|
||||||
|
SacsErrorState ErrorState { get; }
|
||||||
|
String ErrorStateMessage { get; }
|
||||||
|
bool SetErrorState(String message);
|
||||||
|
void ClearErrorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
}
|
||||||
@@ -3,7 +3,18 @@
|
|||||||
namespace Sarand.Net.Standard.Base.Core
|
namespace Sarand.Net.Standard.Base.Core
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SacsDisposable : IDisposable
|
/// <summary>
|
||||||
|
/// Disposable class.
|
||||||
|
/// <br/>- Override 'protecetd void Dispose(bool disposing)' to dispose resources when flag is true.
|
||||||
|
/// </summary>
|
||||||
|
public interface ISacsDisposable : IDisposable
|
||||||
|
{
|
||||||
|
/// <summary>Returns flag to indicate whether object has been disposed.</summary>
|
||||||
|
bool Disposed { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
public abstract class SacsDisposable : ISacsDisposable
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Data members.
|
// Data members.
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
using Sarand.Net.Standard.Base.Utils;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Sarand.Net.Standard.Base.Core
|
|
||||||
{
|
|
||||||
//=======================================================================
|
|
||||||
/// <summary>State Item interface.</summary>
|
|
||||||
public interface ISacsStateItem
|
|
||||||
{
|
|
||||||
bool HasErrorState();
|
|
||||||
SacsErrorState ErrorState { get; }
|
|
||||||
String ErrorStateMessage { get; }
|
|
||||||
bool SetErrorState(String message);
|
|
||||||
void ClearErrorState();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
/// <summary>
|
|
||||||
/// State Item - allows business component to record and report error message.
|
|
||||||
/// </summary>
|
|
||||||
public class SacsStateItem : ISacsStateItem
|
|
||||||
{
|
|
||||||
//-------------------------------------------------------------------
|
|
||||||
// Data items.
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
|
||||||
// Protected construction - use derived classes.
|
|
||||||
protected SacsStateItem() { }
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
|
||||||
// Poperties.
|
|
||||||
|
|
||||||
/// <summary>OK - No error state message.</summary>
|
|
||||||
public bool OK { get { return !HasErrorState(); } }
|
|
||||||
|
|
||||||
// Error state.
|
|
||||||
public SacsErrorState ErrorState { get; private set; }
|
|
||||||
public bool HasErrorState()
|
|
||||||
{
|
|
||||||
return ErrorState != null;
|
|
||||||
}
|
|
||||||
public String ErrorStateMessage
|
|
||||||
{
|
|
||||||
get { return (ErrorState != null ? ErrorState.Message : String.Empty); }
|
|
||||||
}
|
|
||||||
// Update properties.
|
|
||||||
public virtual bool SetErrorState(String message)
|
|
||||||
{
|
|
||||||
if (StringUtil.IsEmpty(StringUtil.EmptyOnNull(message).Trim()))
|
|
||||||
throw new NotSupportedException($"{SysUtil.Fn} Blank error message.");
|
|
||||||
this.ErrorState = new SacsErrorState(message);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
public void ClearErrorState()
|
|
||||||
{
|
|
||||||
ErrorState = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@ using Sarand.Net.Standard.Base.App;
|
|||||||
namespace Sarand.Net.Standard.Base.Dbas
|
namespace Sarand.Net.Standard.Base.Dbas
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class DbResultSet : SaErrorStateItem, IDbResultSet
|
public abstract class DbResultSet : SacsDisposableStateItem, IDbResultSet
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Data members.
|
// Data members.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Sarand.Net.Standard.Base.Core;
|
|||||||
namespace Sarand.Net.Standard.Base.Dbas
|
namespace Sarand.Net.Standard.Base.Dbas
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
interface IDbResultSet : IDisposable
|
interface IDbResultSet : ISacsDisposable
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Navigation.
|
// Navigation.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using System.Text;
|
|||||||
namespace Sarand.Net.Standard.Base.Diary
|
namespace Sarand.Net.Standard.Base.Diary
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaDiaryConsole : SaErrorStateItem
|
public abstract class SaDiaryConsole : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Definitions.
|
// Definitions.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Collections.Generic;
|
|||||||
namespace Sarand.Net.Standard.Base.Interfaces
|
namespace Sarand.Net.Standard.Base.Interfaces
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaInterfaceConsole : SaErrorStateItem
|
public abstract class SaInterfaceConsole : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Interface definition.
|
// Interface definition.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.Text;
|
|||||||
namespace Sarand.Net.Standard.Base.ItemData
|
namespace Sarand.Net.Standard.Base.ItemData
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaItemDataConsole : SaErrorStateItem
|
public abstract class SaItemDataConsole : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Definitions.
|
// Definitions.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.Text;
|
|||||||
namespace Sarand.Net.Standard.Base.ItemDocs
|
namespace Sarand.Net.Standard.Base.ItemDocs
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaItemDocConsole : SaErrorStateItem
|
public abstract class SaItemDocConsole : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Definitions.
|
// Definitions.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using Sarand.Net.Standard.Base.UpdateLog;
|
|||||||
namespace Sarand.Net.Standard.Base.ItemOptions
|
namespace Sarand.Net.Standard.Base.ItemOptions
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaItemOptionConsole : SaErrorStateItem
|
public abstract class SaItemOptionConsole : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Definitions.
|
// Definitions.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using Sarand.Net.Standard.Base.Bus;
|
|||||||
namespace Sarand.Net.Standard.Base.Procs
|
namespace Sarand.Net.Standard.Base.Procs
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaReport_Base : SaErrorStateItem
|
public abstract class SaReport_Base : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Definitions.
|
// Definitions.
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ namespace Sarand.Net.Standard.Base.ReferenceData
|
|||||||
};
|
};
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract partial class SaReferenceDataConsole : SaErrorStateItem
|
public abstract partial class SaReferenceDataConsole : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Definitions.
|
// Definitions.
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Sarand.Net.Standard.Base.Security
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaSecurityConsole : SaErrorStateItem
|
public abstract class SaSecurityConsole : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Definitions.
|
// Definitions.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Sarand.Net.Standard.Base.UpdateLog
|
|||||||
// Definitions.
|
// Definitions.
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaUpdateLogConsole : SaErrorStateItem
|
public abstract class SaUpdateLogConsole : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Definitions.
|
// Definitions.
|
||||||
|
|||||||
@@ -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.11.0" />
|
<PackageReference Include="MailKit" Version="4.13.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.3.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.3.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.3.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.7" />
|
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.11" />
|
||||||
<PackageReference Include="ZstdNet" Version="1.4.5" />
|
<PackageReference Include="ZstdNet" Version="1.4.5" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using System.Text.RegularExpressions;
|
|||||||
namespace Sarand.Net.Standard.Dbas.Base
|
namespace Sarand.Net.Standard.Dbas.Base
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public class SacsDatabaseConsole : SaErrorStateItem
|
public class SacsDatabaseConsole : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Database configuration
|
// Database configuration
|
||||||
|
|||||||
@@ -223,8 +223,7 @@ namespace Sarand.Net.Standard.Dbas.Security
|
|||||||
public override bool LoginUser(SysId userId, bool recordLastLogin = true)
|
public override bool LoginUser(SysId userId, bool recordLastLogin = true)
|
||||||
{
|
{
|
||||||
ClearErrorState();
|
ClearErrorState();
|
||||||
using (SaSecurityItem secItemUser = securityMgr.GetSecurityItemById(userId))
|
SaSecurityItem secItemUser = securityMgr.GetSecurityItemById(userId);
|
||||||
{
|
|
||||||
if (secItemUser == null || secItemUser.ItemType != SaSecurity.ItemType.User || !secItemUser.IsStatusEnabled)
|
if (secItemUser == null || secItemUser.ItemType != SaSecurity.ItemType.User || !secItemUser.IsStatusEnabled)
|
||||||
{
|
{
|
||||||
SaLogger.Error($"{SysUtil.Fn}Failed to retrieve user for login. Id: {SysId.ToString(userId)} - {securityMgr.ErrorStateMessage}", true);
|
SaLogger.Error($"{SysUtil.Fn}Failed to retrieve user for login. Id: {SysId.ToString(userId)} - {securityMgr.ErrorStateMessage}", true);
|
||||||
@@ -237,7 +236,6 @@ namespace Sarand.Net.Standard.Dbas.Security
|
|||||||
SaLogger.Error($"{SysUtil.Fn}Failed to update user on login. Id: {SysId.ToString(userId)}' - {securityMgr.ErrorStateMessage}", true);
|
SaLogger.Error($"{SysUtil.Fn}Failed to update user on login. Id: {SysId.ToString(userId)}' - {securityMgr.ErrorStateMessage}", true);
|
||||||
}
|
}
|
||||||
OnLogin(secItemUser != null ? secItemUser.Id : null);
|
OnLogin(secItemUser != null ? secItemUser.Id : null);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public override bool LoginAuthenticatedUser()
|
public override bool LoginAuthenticatedUser()
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ namespace Sarand.Net.Standard.Proc.Excel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public abstract class SaMsSpreadsheet : SaErrorStateItem
|
public abstract class SaMsSpreadsheet : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Definitions.
|
// Definitions.
|
||||||
|
|||||||
@@ -845,7 +845,11 @@ namespace Sarand.Net.Standard.Proc.Excel
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (IsCellDate(cell))
|
if (IsCellDate(cell))
|
||||||
return new DataValue((DateTime)(cell.DateCellValue ?? DateTime.MinValue));
|
{
|
||||||
|
// Ref. https://stackoverflow.com/questions/23280533/apache-poi-getting-a-null-pointer-while-reading-a-cell-with-value
|
||||||
|
// recommends using DateTime.FromOADate(cell.NumericCellValue) rather than cell.DateCellValue
|
||||||
|
return new DataValue(cell.DateCellValue);
|
||||||
|
}
|
||||||
if (IsCellNumeric(cell))
|
if (IsCellNumeric(cell))
|
||||||
{
|
{
|
||||||
double value = cell.NumericCellValue;
|
double value = cell.NumericCellValue;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using Sarand.Net.Standard.Base.Utils;
|
|||||||
namespace Sarand.Net.Standard.Proc.Xml
|
namespace Sarand.Net.Standard.Proc.Xml
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public class SaMsXmlDocument : SaErrorStateItem
|
public class SaMsXmlDocument : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Data members.
|
// Data members.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using Sarand.Net.Standard.Base.Utils;
|
|||||||
namespace Sarand.Net.Standard.Proc.Xml
|
namespace Sarand.Net.Standard.Proc.Xml
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public class SaMsXmlNode : SaErrorStateItem
|
public class SaMsXmlNode : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Data members.
|
// Data members.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using System.Text;
|
|||||||
namespace Sarand.Net.Standard.Proc.Zip
|
namespace Sarand.Net.Standard.Proc.Zip
|
||||||
{
|
{
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
public class SaMsZipArchive : SaErrorStateItem
|
public class SaMsZipArchive : SacsDisposableStateItem
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// Data members.
|
// Data members.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DocumentFormat.OpenXml" Version="3.3.0" />
|
<PackageReference Include="DocumentFormat.OpenXml" Version="3.3.0" />
|
||||||
<PackageReference Include="NPOI" Version="2.7.3" />
|
<PackageReference Include="NPOI" Version="2.6.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user