144 lines
4.8 KiB
C#
144 lines
4.8 KiB
C#
using DE70_CMDv2;
|
|
using Serilog;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
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 AdminConfigurationUC.xaml
|
|
/// </summary>
|
|
public partial class AdminConfigurationUC : UserControl
|
|
{
|
|
public AdminConfigurationUC()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void btnResetCounter_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
Log.Information("[ADMIN] reset cdm counter");
|
|
bool bResetCDMCounter = AppData.ResetCDMCounter();
|
|
if(!bResetCDMCounter)
|
|
{
|
|
bResetCDMCounter = AppData.ResetCDMCounter();
|
|
}
|
|
if (bResetCDMCounter)
|
|
{
|
|
Log.Information("[ADMIN] reset counter successfully");
|
|
lblCounterStatus.Text = "TRẠNG THÁI: KHỞI TẠO BỘ ĐẾM THÀNH CÔNG";
|
|
((MainWindow)Application.Current.MainWindow).ShowWelcomeScreen();
|
|
Task.Run(() =>
|
|
{
|
|
Thread.Sleep(30000);
|
|
Dispatcher.Invoke(() =>
|
|
{
|
|
lblCounterStatus.Text = "";
|
|
});
|
|
});
|
|
}
|
|
else
|
|
{
|
|
Log.Information("[ADMIN] reset counter fail");
|
|
}
|
|
|
|
}
|
|
|
|
private void btnOpenEscrow_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
Log.Information("[ADMIN] Do Check");
|
|
var mainWindow = ((MainWindow)Application.Current.MainWindow);
|
|
if (mainWindow!=null)
|
|
mainWindow.DoCheck();
|
|
}
|
|
|
|
private void btnGetCDMState_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var state = AppData.GetCDMState();
|
|
lblDeviceStatus.Text = state.GetFullStatus();
|
|
}
|
|
|
|
private void btnSoftResetError_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
Log.Information("[ADMIN] Reset CDM Error");
|
|
if (AppData.ResetCDMError())
|
|
{
|
|
Log.Information("[ADMIN] Reset CDM Error successfully");
|
|
lblCounterStatus.Text = "Reset lỗi thành công";
|
|
((MainWindow)Application.Current.MainWindow).ShowWelcomeScreen();
|
|
Task.Run(() =>
|
|
{
|
|
Thread.Sleep(10000);
|
|
Dispatcher.Invoke(() =>
|
|
{
|
|
lblCounterStatus.Text = "";
|
|
});
|
|
});
|
|
}
|
|
}
|
|
catch (Exception ex) {
|
|
Log.Fatal(ex, "SoftReset");
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void btnSoftImportantError_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var state = AppData.GetCDMState();
|
|
|
|
if (state.IsNotesInEscrow>0||
|
|
state.IsNotesInRejectPocket>0||
|
|
state.IsNotesInHopper>0)
|
|
{
|
|
lblCounterStatus.Foreground = new SolidColorBrush(Colors.Red);
|
|
lblCounterStatus.Text = "Vẫn còn tiền trong máy, đề nghị lấy tiền ra khỏi các ngăn và kiểm tra tiền kẹt";
|
|
}
|
|
else
|
|
{
|
|
lblCounterStatus.Foreground = new SolidColorBrush(Colors.Green);
|
|
lblCounterStatus.Text = "Đang thực hiện Reset lỗi";
|
|
|
|
Log.Information("[ADMIN] Reset CDM Error");
|
|
var bSuccess = AppData.ResetAbnormalStorage605();
|
|
if (bSuccess)
|
|
{
|
|
Log.Information("[ADMIN] Reset CDM AbnormalStorage successfully");
|
|
|
|
lblCounterStatus.Foreground = new SolidColorBrush(Colors.Green);
|
|
lblCounterStatus.Text = "Reset lỗi thành công";
|
|
((MainWindow)Application.Current.MainWindow).ShowWelcomeScreen();
|
|
Task.Run(() =>
|
|
{
|
|
Thread.Sleep(10000);
|
|
Dispatcher.Invoke(() =>
|
|
{
|
|
lblCounterStatus.Text = "";
|
|
});
|
|
});
|
|
}
|
|
else
|
|
{
|
|
lblCounterStatus.Foreground = new SolidColorBrush(Colors.Red);
|
|
lblCounterStatus.Text = "Reset lỗi không thành công";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|