try catch Init printer
Đảo thử tự InitUsers Kiểm tra đầu đọc QR
This commit is contained in:
+34
-13
@@ -1,5 +1,6 @@
|
||||
using DE70_CMDv2;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SafeBagDE70.API;
|
||||
using SafeBagDE70.Model;
|
||||
using Serilog;
|
||||
using System;
|
||||
@@ -39,7 +40,6 @@ namespace SafeBagDE70
|
||||
{
|
||||
try
|
||||
{
|
||||
InitUsers();
|
||||
CDMSTATE = new CDMSTATE();
|
||||
DeviceStatus = new DeviceStatus
|
||||
{
|
||||
@@ -52,33 +52,54 @@ namespace SafeBagDE70
|
||||
Notes = "",
|
||||
OtherError = 0,
|
||||
};
|
||||
InitUsers();
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex, "AppInit: "+ex.Message);
|
||||
if(DeviceStatus != null)
|
||||
{
|
||||
DeviceStatus.Description = "Exception in AppInit: "+ex.Message;
|
||||
APIModels.SendEvent(DeviceStatus);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void InitUsers()
|
||||
{
|
||||
customerAccounts = new List<CustomerAccount>();
|
||||
using (var context = new CDMDbContext())
|
||||
try
|
||||
{
|
||||
var customers = context.Customers;
|
||||
foreach (var customer in customers)
|
||||
customerAccounts = new List<CustomerAccount>();
|
||||
using (var context = new CDMDbContext())
|
||||
{
|
||||
var ca = new CustomerAccount
|
||||
var customers = context.Customers;
|
||||
foreach (var customer in customers)
|
||||
{
|
||||
Name = customer.TenantName,
|
||||
CustomerId = customer.AccountNumber,
|
||||
QRCode = customer.AccountNumber,
|
||||
PINCode = customer.PinCode
|
||||
};
|
||||
customerAccounts.Add(ca);
|
||||
var ca = new CustomerAccount
|
||||
{
|
||||
Name = customer.TenantName,
|
||||
CustomerId = customer.AccountNumber,
|
||||
QRCode = customer.AccountNumber,
|
||||
PINCode = customer.PinCode
|
||||
};
|
||||
customerAccounts.Add(ca);
|
||||
}
|
||||
}
|
||||
CurrentCustomerAccount = customerAccounts[0];
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Log.Fatal(ex, "InitUsers: " + ex.Message);
|
||||
if (DeviceStatus != null)
|
||||
{
|
||||
DeviceStatus.Description = "Exception in InitUsers: " + ex.Message;
|
||||
APIModels.SendEvent(DeviceStatus);
|
||||
}
|
||||
}
|
||||
CurrentCustomerAccount = customerAccounts[0];
|
||||
|
||||
}
|
||||
|
||||
public static CDMSTATE? CDMSTATE = null;
|
||||
|
||||
Reference in New Issue
Block a user