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:local="clr-namespace:SafeBagDE70.Admin"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
d:DesignHeight="1024" d:DesignWidth="1280"
|
||||
Loaded="UserControl_Loaded">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="80"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel>
|
||||
<Button Content="TẢI D/S GIAN HÀNG" Width="300" Margin="10" x:Name="btnGetUsers" Click="btnGetUsers_Click"/>
|
||||
<Button Content="ĐỒNG BỘ GIAO DỊCH LÊN SERVER" Width="300" Margin="10" x:Name="btnSyncTransaction" Click="btnSyncTransaction_Click"/>
|
||||
<Label x:Name="lblStatus"/>
|
||||
<Grid Grid.Row="0" >
|
||||
<Button Content="TẢI D/S GIAN HÀNG" HorizontalAlignment="Left" Width="300" Margin="2" x:Name="btnGetUsers" Click="btnGetUsers_Click"/>
|
||||
<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>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -67,6 +67,20 @@ namespace SafeBagDE70.Admin
|
||||
{
|
||||
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 SensorPort = "COM3";
|
||||
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 CCmdRsp? cCmdRsp=null;
|
||||
public static bool IsAuthenticated = false;
|
||||
@@ -65,6 +65,7 @@ namespace SafeBagDE70
|
||||
{
|
||||
CDMSTATE = new CDMSTATE();
|
||||
ADMINDEVICESTATUS = new ADMINDEVICESTATUS();
|
||||
customerAccounts = new ObservableCollection<CustomerAccount>();
|
||||
//InitDeviceStatus();
|
||||
}
|
||||
public static void Init()
|
||||
@@ -125,7 +126,7 @@ namespace SafeBagDE70
|
||||
try
|
||||
{
|
||||
|
||||
customerAccounts = new List<CustomerAccount>();
|
||||
customerAccounts.Clear();
|
||||
using (var context = new CDMDbContext())
|
||||
{
|
||||
var customers = context.Customers;
|
||||
|
||||
@@ -1122,10 +1122,13 @@ namespace SafeBagDE70
|
||||
}
|
||||
if (cCmdRsp.recv_dat.dat[0]!=0x40)
|
||||
{
|
||||
var strRcvData = cCmdRsp.GetRecvDat();
|
||||
bSuccess = false;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user