Change Init Users
This commit is contained in:
@@ -8,9 +8,8 @@
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<TextBlock Text="Realtime Logs" FontSize="20" Margin="10"/>
|
||||
<ListView x:Name="LogListView" Height="500" Margin="10"/>
|
||||
<Button Content="Get Users" Width="200" Margin="10" x:Name="btnGetUsers" Click="btnGetUsers_Click"/>
|
||||
<Label x:Name="lblStatus"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
+26
-18
@@ -40,29 +40,37 @@ namespace SafeBagDE70.Admin
|
||||
|
||||
private async void btnGetUsers_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var amCustomers= await APIModels.GetAeonMallCustomers(AppData.TenantId);
|
||||
using(var context = new CDMDbContext())
|
||||
try
|
||||
{
|
||||
var customers = context.Customers;
|
||||
context.Customers.RemoveRange(customers);
|
||||
context.SaveChanges();
|
||||
foreach (var amCustomer in amCustomers)
|
||||
var amCustomers = await APIModels.GetAeonMallCustomers(AppData.TenantId);
|
||||
using (var context = new CDMDbContext())
|
||||
{
|
||||
var customer = new Customer
|
||||
var customers = context.Customers;
|
||||
context.Customers.RemoveRange(customers);
|
||||
context.SaveChanges();
|
||||
foreach (var amCustomer in amCustomers)
|
||||
{
|
||||
AccountNumber = amCustomer.TenantCode,
|
||||
AccountHolder = amCustomer.TenantName,
|
||||
TenantName = amCustomer.TenantShortName,
|
||||
TenantCode = amCustomer.TenantCode,
|
||||
PinCode = amCustomer.TenantCode,
|
||||
UpdatedTime = DateTime.Now,
|
||||
};
|
||||
customers.Add(customer);
|
||||
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();
|
||||
}
|
||||
context.SaveChanges();
|
||||
lblStatus.Foreground = new SolidColorBrush(Colors.Green);
|
||||
lblStatus.Content = "Updated customers: " + amCustomers.Count;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
lblStatus.Foreground = new SolidColorBrush(Colors.Red);
|
||||
lblStatus.Content= ex.Message;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user