thêm d/s ng dùng
This commit is contained in:
+27
-4
@@ -5,12 +5,35 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:SafeBagDE70.Admin"
|
xmlns:local="clr-namespace:SafeBagDE70.Admin"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="1024" d:DesignWidth="1280"
|
||||||
|
Loaded="UserControl_Loaded">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="80"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Button Content="TẢI D/S GIAN HÀNG" Width="300" Margin="10" x:Name="btnGetUsers" Click="btnGetUsers_Click"/>
|
<Grid Grid.Row="0" >
|
||||||
<Button Content="ĐỒNG BỘ GIAO DỊCH LÊN SERVER" Width="300" Margin="10" x:Name="btnSyncTransaction" Click="btnSyncTransaction_Click"/>
|
<Button Content="TẢI D/S GIAN HÀNG" HorizontalAlignment="Left" Width="300" Margin="2" x:Name="btnGetUsers" Click="btnGetUsers_Click"/>
|
||||||
<Label x:Name="lblStatus"/>
|
<Button Content="ĐỒNG BỘ GIAO DỊCH" HorizontalAlignment="Right" Width="300" Margin="2" x:Name="btnSyncTransaction" Click="btnSyncTransaction_Click"/>
|
||||||
|
</Grid>
|
||||||
|
<Label x:Name="lblStatus" Background="Transparent"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Row="1" Height="1000">
|
||||||
|
<TextBlock Text="DANH SÁCH GIAN HÀNG" FontSize="16" HorizontalAlignment="Center"/>
|
||||||
|
<TextBox x:Name="SearchBox" Width="300" Height="25" Margin="10" HorizontalAlignment="Right"
|
||||||
|
TextChanged="SearchBox_TextChanged" ToolTip="Enter search term..." />
|
||||||
|
<!-- ListView to show items -->
|
||||||
|
<ListView x:Name="ListViewItems" Height="800">
|
||||||
|
<ListView.View>
|
||||||
|
<GridView>
|
||||||
|
<GridViewColumn Header="Tên GH" DisplayMemberBinding="{Binding Name}" Width="280"/>
|
||||||
|
<GridViewColumn Header="Mã GH" DisplayMemberBinding="{Binding CustomerId}" Width="280"/>
|
||||||
|
</GridView>
|
||||||
|
</ListView.View>
|
||||||
|
</ListView>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -67,6 +67,20 @@ namespace SafeBagDE70.Admin
|
|||||||
{
|
{
|
||||||
AppData.ResendData();
|
AppData.ResendData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SearchBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
string searchTerm = SearchBox.Text.ToLower();
|
||||||
|
|
||||||
|
// Filter items based on search term
|
||||||
|
var filteredItems = AppData.customerAccounts.Where(item => item.Name.ToLower().Contains(searchTerm)|| item.CustomerId.ToLower().Contains(searchTerm)).ToList();
|
||||||
|
ListViewItems.ItemsSource = filteredItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
ListViewItems.ItemsSource = AppData.customerAccounts;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -27,7 +27,7 @@ namespace SafeBagDE70
|
|||||||
public static string CDMPort = "COM4";
|
public static string CDMPort = "COM4";
|
||||||
public static string SensorPort = "COM3";
|
public static string SensorPort = "COM3";
|
||||||
public static Version? CurrentVersion = null;
|
public static Version? CurrentVersion = null;
|
||||||
public static List<CustomerAccount>? customerAccounts = null;
|
public static ObservableCollection<CustomerAccount>? customerAccounts = null;
|
||||||
public static CustomerAccount? CurrentCustomerAccount{get;set;}
|
public static CustomerAccount? CurrentCustomerAccount{get;set;}
|
||||||
public static CCmdRsp? cCmdRsp=null;
|
public static CCmdRsp? cCmdRsp=null;
|
||||||
public static bool IsAuthenticated = false;
|
public static bool IsAuthenticated = false;
|
||||||
@@ -65,6 +65,7 @@ namespace SafeBagDE70
|
|||||||
{
|
{
|
||||||
CDMSTATE = new CDMSTATE();
|
CDMSTATE = new CDMSTATE();
|
||||||
ADMINDEVICESTATUS = new ADMINDEVICESTATUS();
|
ADMINDEVICESTATUS = new ADMINDEVICESTATUS();
|
||||||
|
customerAccounts = new ObservableCollection<CustomerAccount>();
|
||||||
//InitDeviceStatus();
|
//InitDeviceStatus();
|
||||||
}
|
}
|
||||||
public static void Init()
|
public static void Init()
|
||||||
@@ -125,7 +126,7 @@ namespace SafeBagDE70
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
customerAccounts = new List<CustomerAccount>();
|
customerAccounts.Clear();
|
||||||
using (var context = new CDMDbContext())
|
using (var context = new CDMDbContext())
|
||||||
{
|
{
|
||||||
var customers = context.Customers;
|
var customers = context.Customers;
|
||||||
|
|||||||
@@ -1122,10 +1122,13 @@ namespace SafeBagDE70
|
|||||||
}
|
}
|
||||||
if (cCmdRsp.recv_dat.dat[0]!=0x40)
|
if (cCmdRsp.recv_dat.dat[0]!=0x40)
|
||||||
{
|
{
|
||||||
|
var strRcvData = cCmdRsp.GetRecvDat();
|
||||||
bSuccess = false;
|
bSuccess = false;
|
||||||
|
|
||||||
var state = GetCDMState();
|
var state = GetCDMState();
|
||||||
AppData.DeviceStatus.Description = "START_ERROR:" + state.GetFullStatus();
|
var str = $"START_ERROR: {strRcvData}, STATUS: {state.GetFullStatus()}";
|
||||||
|
Log.Error(str);
|
||||||
|
AppData.DeviceStatus.Description = str;
|
||||||
APIModels.SendEvent(AppData.DeviceStatus);
|
APIModels.SendEvent(AppData.DeviceStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user