init
This commit is contained in:
36
Common/DTS.CommonCore/Classes/Locking/LockError.cs
Normal file
36
Common/DTS.CommonCore/Classes/Locking/LockError.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
namespace DTS.Common.Classes.Locking
|
||||
{
|
||||
public class LockError
|
||||
{
|
||||
public int ErrorCode { get; private set; }
|
||||
public string Message { get; private set; }
|
||||
public string LockingUser {get; private set; }
|
||||
public string LockingMachine { get; private set; }
|
||||
|
||||
public bool LockStolen => ErrorCode == LOCKSTOLEN_ERROR;
|
||||
public bool LockLost => ErrorCode == LOCKDOESNTEXIST_ERROR;
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{ErrorCode} - {Message}";
|
||||
}
|
||||
|
||||
public LockError(int error, string message, string user = null, string machine = null)
|
||||
{
|
||||
ErrorCode = error;
|
||||
Message = message;
|
||||
LockingUser = user??string.Empty;
|
||||
LockingMachine = machine??string.Empty;
|
||||
}
|
||||
//14782 Improve lost remote db connection modal dialogs
|
||||
//this can apparently be returned by sqlclient on failed lock maintenance issues
|
||||
public const int BAD_NETPATH_ERROR = 994;
|
||||
//14782 Improve lost remote db connection modal dialogs
|
||||
//system error of semaphore timeout, returned by sqlclient on failed to connect issues
|
||||
public const int SEM_TIMEOUT_ERROR = 995;
|
||||
public const int ITEM_NOT_FOUND = 996;
|
||||
public const int LOCKDOESNTEXIST_ERROR = 997;
|
||||
public const int LOCKSTOLEN_ERROR = 998;
|
||||
public const int UNKNOWN_ERROR = 999;
|
||||
}
|
||||
}
|
||||
30
Common/DTS.CommonCore/Classes/Locking/LockRecord.cs
Normal file
30
Common/DTS.CommonCore/Classes/Locking/LockRecord.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace DTS.Common.Classes.Locking
|
||||
{
|
||||
public class LockRecord
|
||||
{
|
||||
public string LockingUserName { get; }
|
||||
public string LockingMachineName { get; }
|
||||
public DateTime CreationTime { get; }
|
||||
public DateTime LastUpdated { get; }
|
||||
public string ItemKey { get; }
|
||||
/// <summary>
|
||||
/// this is the item category (as a value in the db - LockCategories)
|
||||
/// </summary>
|
||||
public int ItemCategory { get; }
|
||||
public int ItemId { get; }
|
||||
|
||||
public LockRecord(string user, string machine, DateTime createTime, DateTime lastUpdate, string itemKey, int itemCategory, int itemId)
|
||||
{
|
||||
LockingUserName = user;
|
||||
LockingMachineName = machine;
|
||||
CreationTime = createTime;
|
||||
LastUpdated = lastUpdate;
|
||||
ItemKey = itemKey;
|
||||
ItemCategory = itemCategory;
|
||||
ItemId = itemId;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user