InitUser after download
This commit is contained in:
+31
-21
@@ -42,29 +42,39 @@ namespace SafeBagDE70.Admin
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var amCustomers = await APIModels.GetAeonMallCustomers(AppData.TenantId);
|
if(AppData.IsInTransaction)
|
||||||
using (var context = new CDMDbContext())
|
|
||||||
{
|
{
|
||||||
var customers = context.Customers;
|
lblStatus.Foreground = new SolidColorBrush(Colors.Red);
|
||||||
context.Customers.RemoveRange(customers);
|
lblStatus.Content = "Vui lòng kết thúc giao dịch để thực hiện chức năng này";
|
||||||
context.SaveChanges();
|
|
||||||
foreach (var amCustomer in amCustomers)
|
|
||||||
{
|
|
||||||
var customer = new Customer
|
|
||||||
{
|
|
||||||
AccountNumber = amCustomer.TenantCode,
|
|
||||||
AccountHolder = amCustomer.TenantName,
|
|
||||||
TenantName = amCustomer.TenantShortName,
|
|
||||||
TenantCode = amCustomer.TenantCode,
|
|
||||||
PinCode = amCustomer.TenantCode,
|
|
||||||
UpdatedTime = DateTime.Now,
|
|
||||||
};
|
|
||||||
customers.Add(customer);
|
|
||||||
}
|
|
||||||
context.SaveChanges();
|
|
||||||
}
|
}
|
||||||
lblStatus.Foreground = new SolidColorBrush(Colors.Green);
|
else
|
||||||
lblStatus.Content = "Updated customers: " + amCustomers.Count;
|
{
|
||||||
|
var amCustomers = await APIModels.GetAeonMallCustomers(AppData.TenantId);
|
||||||
|
using (var context = new CDMDbContext())
|
||||||
|
{
|
||||||
|
var customers = context.Customers;
|
||||||
|
context.Customers.RemoveRange(customers);
|
||||||
|
context.SaveChanges();
|
||||||
|
foreach (var amCustomer in amCustomers)
|
||||||
|
{
|
||||||
|
var customer = new Customer
|
||||||
|
{
|
||||||
|
AccountNumber = amCustomer.TenantCode,
|
||||||
|
AccountHolder = amCustomer.TenantName,
|
||||||
|
TenantName = amCustomer.TenantShortName,
|
||||||
|
TenantCode = amCustomer.TenantCode,
|
||||||
|
PinCode = amCustomer.TenantCode,
|
||||||
|
UpdatedTime = DateTime.Now,
|
||||||
|
};
|
||||||
|
customers.Add(customer);
|
||||||
|
}
|
||||||
|
context.SaveChanges();
|
||||||
|
}
|
||||||
|
lblStatus.Foreground = new SolidColorBrush(Colors.Green);
|
||||||
|
lblStatus.Content = "Updated customers: " + amCustomers.Count;
|
||||||
|
}
|
||||||
|
AppData.InitUsers();
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -68,7 +68,7 @@ namespace SafeBagDE70
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool InitUsers()
|
public static bool InitUsers()
|
||||||
{
|
{
|
||||||
int retryCount = 0;
|
int retryCount = 0;
|
||||||
int maxRetries = 20; // Max retries before giving up
|
int maxRetries = 20; // Max retries before giving up
|
||||||
|
|||||||
Reference in New Issue
Block a user