AppData --> lấy trạng thái gán thời gian

APIModels--> Bỏ gán thời gian
DepositSMUCv2--> Báo đang trong giao dịch chỉ khi đăng nhập thành công
This commit is contained in:
Nguyen Dinh Thuan
2024-09-16 23:33:30 +07:00
parent 2e94ba03ac
commit 33214ad7fa
4 changed files with 85 additions and 20 deletions
+39 -14
View File
@@ -36,25 +36,34 @@ namespace SafeBagDE70
public static int MaxNotes = 300;
public static string BaseURL = "";
public static int TenantId = 0;
public static DeviceStatus? DeviceStatus = null;
public static DeviceStatus? _DeviceStatus = null;
public static DeviceStatus? DeviceStatus
{
set { _DeviceStatus = value; }
get
{
if (_DeviceStatus == null)
{
InitDeviceStatus();
}
else
{
_DeviceStatus.DeviceTime = DateTime.Now;
}
return _DeviceStatus;
}
}
public static bool bInitUser = false;
static AppData()
{
CDMSTATE = new CDMSTATE();
//InitDeviceStatus();
}
public static void Init()
{
try
{
CDMSTATE = new CDMSTATE();
DeviceStatus = new DeviceStatus
{
Device = Environment.MachineName,
TenantId = AppData.TenantId,
Status = 0,
CDMStatus = 0,
PrinterStatus = 0,
SensorStatus = 0,
Notes = "",
OtherError = 0,
};
bInitUser=InitUsers();
bInitUser = InitUsers();
}
catch (Exception ex)
{
@@ -68,6 +77,21 @@ namespace SafeBagDE70
}
public static void InitDeviceStatus()
{
DeviceStatus = new DeviceStatus
{
Device = Environment.MachineName,
TenantId = AppData.TenantId,
Status = 0,
CDMStatus = 0,
PrinterStatus = 0,
SensorStatus = 0,
Notes = "",
OtherError = 0,
};
}
public static bool InitUsers()
{
int retryCount = 0;
@@ -101,6 +125,7 @@ namespace SafeBagDE70
}
catch (Exception ex)
{
Log.Information($"Retry InitUser: {retryCount}/{maxRetries}");
retryCount++;
if (retryCount >= maxRetries)