try catch init
This commit is contained in:
+27
-13
@@ -37,12 +37,37 @@ namespace SafeBagDE70
|
||||
|
||||
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,
|
||||
};
|
||||
InitUsers();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex, "AppInit");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void InitUsers()
|
||||
{
|
||||
customerAccounts = new List<CustomerAccount>();
|
||||
using (var context = new CDMDbContext())
|
||||
{
|
||||
var customers = context.Customers;
|
||||
foreach(var customer in customers)
|
||||
foreach (var customer in customers)
|
||||
{
|
||||
var ca = new CustomerAccount
|
||||
{
|
||||
@@ -55,19 +80,8 @@ namespace SafeBagDE70
|
||||
}
|
||||
}
|
||||
CurrentCustomerAccount = customerAccounts[0];
|
||||
CDMSTATE=new CDMSTATE();
|
||||
DeviceStatus = new DeviceStatus
|
||||
{
|
||||
Device = Environment.MachineName,
|
||||
TenantId = AppData.TenantId,
|
||||
Status = 0,
|
||||
CDMStatus = 0,
|
||||
PrinterStatus = 0,
|
||||
SensorStatus = 0,
|
||||
Notes = "",
|
||||
OtherError = 0,
|
||||
};
|
||||
}
|
||||
|
||||
public static CDMSTATE? CDMSTATE = null;
|
||||
private static DateTime CutOffTime = new DateTime(1, 1, 1, 12, 0, 0); // 12:00 noon as cut-off time
|
||||
|
||||
|
||||
Reference in New Issue
Block a user