- Chỉnh update users
- Đưa phần gọi lệnh đếm vào Task
This commit is contained in:
@@ -50,29 +50,9 @@ namespace SafeBagDE70.Admin
|
||||
}
|
||||
else
|
||||
{
|
||||
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();
|
||||
}
|
||||
int nUpdatedCustomers=await AppData.UpdateCustomers();
|
||||
lblStatus.Foreground = new SolidColorBrush(Colors.Green);
|
||||
lblStatus.Content = "Updated customers: " + amCustomers.Count;
|
||||
lblStatus.Content = "Updated customers: " + nUpdatedCustomers;
|
||||
}
|
||||
AppData.InitUsers();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user