Add project files.

This commit is contained in:
Admin
2024-09-02 10:03:23 +07:00
parent 42def0d4aa
commit 6219298497
361 changed files with 58423 additions and 0 deletions
@@ -0,0 +1,81 @@
#pragma checksum "..\..\..\..\Views\KeyboardValueView.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "7CEB2F6BE0031A78F4843553F03A6F9656DD4608"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Controls.Ribbon;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;
using VirtualKeyboard.Wpf.Controls;
using VirtualKeyboard.Wpf.Views;
namespace VirtualKeyboard.Wpf.Views {
internal partial class KeyboardValueView : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {
private bool _contentLoaded;
/// <summary>
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.7.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/VirtualKeyboard;component/views/keyboardvalueview.xaml", System.UriKind.Relative);
#line 1 "..\..\..\..\Views\KeyboardValueView.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.7.0")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal System.Delegate _CreateDelegate(System.Type delegateType, string handler) {
return System.Delegate.CreateDelegate(delegateType, this, handler);
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "8.0.7.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
this._contentLoaded = true;
}
}
}
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
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 AdminLoginUC.xaml
/// </summary>
public partial class AdminLoginUC : UserControl
{
public AdminLoginUC()
{
InitializeComponent();
}
private void LoginButton_Click(object sender, RoutedEventArgs e)
{
string username = UsernameTextBox.Text;
string password = PasswordBox.Password;
// Simple authentication logic
if (username == "admin" && password == "password") // Replace with actual logic
{
// Load Settings UserControl
var mainWindow = (MainWindow)Window.GetWindow(this);
//mainWindow.LoadUserControl(new SettingsUserControl());
}
else
{
MessageBox.Show("Invalid username or password.", "Login Failed", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
}
@@ -0,0 +1,86 @@
using DE70_CMDv2;
using SafeBagDE70.Model;
using Serilog;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace SafeBagDE70
{
public static class AppData
{
public static string CDMPort = "COM4";
public static string SensorPort = "COM3";
public static Version? CurrentVersion = null;
public static List<CustomerAccount>? customerAccounts = null;
public static CustomerAccount? CurrentCustomerAccount{get;set;}
public static CCmdRsp? cCmdRsp=null;
public static bool IsAuthenticated = false;
public static bool IsInTransaction = false;
public static int WDTCount = 0;
public static ObservableCollection<string> logCollection = new ObservableCollection<string>();
public static ListView logListView = null;
public static int MaxLogCount = 500;
public static void Init()
{
customerAccounts = new List<CustomerAccount>{
new CustomerAccount{Name="NGUYỄN ĐÌNH THUẬN",CustomerId="HUE_0000000001",QRCode="HUE_0000000001",PINCode="H0001" },
new CustomerAccount{Name="HOÀNG VĂN HIỆP",CustomerId="HUE_0000000002",QRCode="HUE_0000000002",PINCode="H0002" },
new CustomerAccount{Name="PHẠM NGỌC HƯNG",CustomerId="HUE_0000000003",QRCode="HUE_0000000003",PINCode="H0003" },
new CustomerAccount{Name="AMHUE-ESTELLETEST",CustomerId="00DZAMHUE0004",QRCode="00DZAMHUE0004",PINCode="H0004" },
new CustomerAccount{Name="AMHUE-ECCOTEST",CustomerId="00DZAMHUE0005",QRCode="00DZAMHUE0005",PINCode="H0005" },
new CustomerAccount{Name="AMHUE-ALDOTEST",CustomerId="00DZAMHUE0006",QRCode="00DZAMHUE0006",PINCode="H0006" },
new CustomerAccount{Name="AMHUE-MLBTEST",CustomerId="00DZAMHUE0007",QRCode="00DZAMHUE0007",PINCode="H0007" },
new CustomerAccount{Name="AMHUE-PEDROTEST",CustomerId="00DZAMHUE0008",QRCode="00DZAMHUE0008",PINCode="H0008" }
};
CurrentCustomerAccount = customerAccounts[0];
}
private static DateTime CutOffTime = new DateTime(1, 1, 1, 12, 0, 0); // 12:00 noon as cut-off time
public static void GetNewTransactionCode()
{
DateTime transactionDateTime = DateTime.Now;
string merchantCode = CurrentCustomerAccount.CustomerId;
// Adjust transaction date if it's past cut-off time (12:00 noon)
DateTime prevadjustedDate = CurrentCustomerAccount.TransactionTime.Hour >= CutOffTime.Hour ? transactionDateTime.Date : transactionDateTime.Date.AddDays(-1);
DateTime adjustedDate = transactionDateTime.Hour >= CutOffTime.Hour ? transactionDateTime.Date : transactionDateTime.Date.AddDays(-1);
if ((adjustedDate - prevadjustedDate).Days > 0)
{
CurrentCustomerAccount.TransactionCount =1;
}
else
{
CurrentCustomerAccount.TransactionCount++;
}
var transactionCount = CurrentCustomerAccount.TransactionCount;
string datePart = adjustedDate.ToString("yyyyMMdd");
string timePart = transactionDateTime.ToString("HHmmss");
string transactionCountPart = transactionCount.ToString("D2"); // Ensure 2 digits
// Combine all parts to form the transaction ID
string transactionId = $"{datePart}{timePart}{merchantCode}{transactionCountPart}";
CurrentCustomerAccount.TransactionCode = transactionId;
CurrentCustomerAccount.TransactionTime = transactionDateTime;
}
}
public class CustomerAccount
{
public string? Name { get; set; }
public string? CustomerId { get; set; }
public string? QRCode { get; set; }
public string? PINCode { get; set; }
public int TransactionCount { get; set; } = 1;
public DateTime TransactionTime { get; set; }
public string TransactionCode { get; set; }
}
}