fix bugs
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
Margin="10"
|
||||
Click="DashboardButton_Click"/>
|
||||
<Button
|
||||
Content="Quản lý vận hành"
|
||||
Content="Quản lý người dùng"
|
||||
HorizontalAlignment="Stretch"
|
||||
Height="40"
|
||||
Margin="10"
|
||||
|
||||
@@ -22,11 +22,13 @@ namespace SafeBagDE70.Admin
|
||||
{
|
||||
LogViewerUC loguc;
|
||||
AdminConfigurationUC configuration;
|
||||
UserManageUC userManage;
|
||||
public AdminWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
loguc= new LogViewerUC();
|
||||
configuration = new AdminConfigurationUC();
|
||||
userManage=new UserManageUC();
|
||||
this.MainContentControl.Content = loguc;
|
||||
this.Loaded += AdminWindow_Loaded;
|
||||
}
|
||||
@@ -43,7 +45,7 @@ namespace SafeBagDE70.Admin
|
||||
|
||||
private void UserManagementButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
this.MainContentControl.Content = userManage;
|
||||
}
|
||||
|
||||
private void DashboardButton_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<UserControl x:Class="SafeBagDE70.Admin.UserManageUC"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SafeBagDE70.Admin"
|
||||
mc:Ignorable="d"
|
||||
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"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,69 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SafeBagDE70.API;
|
||||
using SafeBagDE70.Model;
|
||||
using Serilog;
|
||||
using Serilog.Core;
|
||||
using Serilog.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SafeBagDE70.Admin
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for LogViewerUC.xaml
|
||||
/// </summary>
|
||||
public partial class UserManageUC : UserControl
|
||||
{
|
||||
private ObservableCollection<string> _logItems = new ObservableCollection<string>();
|
||||
|
||||
public UserManageUC()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void LogInfoButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private async void btnGetUsers_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var amCustomers= await APIModels.GetAeonMallCustomers(5);
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user