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
+38
View File
@@ -0,0 +1,38 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SafeBagDE70.Model
{
internal class CDMDbContext:DbContext
{
public DbSet<History> Histories { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer("Server=.\\SQLEXPRESS;Database=CDMLOCAL;User Id=cdm;Password=Navis@123;Trusted_Connection=False;TrustServerCertificate=True");
}
}
public class History
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public DateTime? DepositTime { get; set; }
public string UserCode { get; set; }
public string Data { get; set; }
public bool? IsSent { get; set; }
public DateTime? SyncTime { get; set; }
public string Status { get; set; }
}
}
+69
View File
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace SafeBagDE70.Model
{
public class KeyModel
{
public enum MapType : uint
{
MAPVK_VK_TO_VSC = 0x0,
MAPVK_VSC_TO_VK = 0x1,
MAPVK_VK_TO_CHAR = 0x2,
MAPVK_VSC_TO_VK_EX = 0x3,
}
[DllImport("user32.dll")]
public static extern int ToUnicode(
uint wVirtKey,
uint wScanCode,
byte[] lpKeyState,
[Out, MarshalAs(UnmanagedType.LPWStr, SizeParamIndex = 4)]
StringBuilder pwszBuff,
int cchBuff,
uint wFlags);
[DllImport("user32.dll")]
public static extern bool GetKeyboardState(byte[] lpKeyState);
[DllImport("user32.dll")]
public static extern uint MapVirtualKey(uint uCode, MapType uMapType);
public static char GetCharFromKey(Key key)
{
char ch = ' ';
int virtualKey = KeyInterop.VirtualKeyFromKey(key);
byte[] keyboardState = new byte[256];
GetKeyboardState(keyboardState);
uint scanCode = MapVirtualKey((uint)virtualKey, MapType.MAPVK_VK_TO_VSC);
StringBuilder stringBuilder = new StringBuilder(2);
int result = ToUnicode((uint)virtualKey, scanCode, keyboardState, stringBuilder, stringBuilder.Capacity, 0);
switch (result)
{
case -1:
break;
case 0:
break;
case 1:
{
ch = stringBuilder[0];
break;
}
default:
{
ch = stringBuilder[0];
break;
}
}
return ch;
}
}
}
+128
View File
@@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Net.Mail;
using System.Net.WebSockets;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
using SafeBagDE70;
namespace SafeBagDE70.Model
{
public class LvCountItem : INotifyPropertyChanged
{
private string _Name { get; set; }
public string Name
{
get
{
int deno = 0;
var str = _Name;
if (int.TryParse(_Name, out deno))
{
str = String.Format(CultureInfo.InvariantCulture,
"{0:#,#.##}", deno);
}
return str;
}
set
{
if (_Name != value)
{
_Name = value;
OnPropertyChanged(nameof(Name));
}
}
}
private string _Quantity { get; set; }
public string Quantity
{
get => _Quantity;
set
{
if(_Quantity != value)
{
_Quantity = value;
OnPropertyChanged(nameof(Quantity));
double deno = 0;
double.TryParse(_Name, out deno);
var str = getValue().ToString();
if (str == "") str = "0";
Value = str;
//if(double.TryParse(_Name, out deno))
//{
// var str = getValue().ToString();
// if (str == "") str = "0";
// Value = str;
//}
}
}
}
public double getValue()
{
double deno = 0;
double.TryParse(_Name, out deno);
double quant = 0;
double.TryParse(_Quantity, out quant);
return (deno * quant);
}
private string _Value;
public string Value
{
get
{
var str = _Value;
int val = 0;
if (int.TryParse(_Value, out val))
{
str = String.Format(CultureInfo.InvariantCulture,
"{0:#,#.##}", val);
if(str=="")str= "0";
}
return str;
}
set
{
if (_Value != value)
{
_Value = value;
OnPropertyChanged(nameof(Value));
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public class SessionQuantity
{
private List<int[]> subSessionQuantities = new List<int[]>();
public void AddSubSession(int[] subSessionQuantity)
{
subSessionQuantities.Add(subSessionQuantity);
}
public void RemoveLastSubSession()
{
subSessionQuantities.RemoveAt(subSessionQuantities.Count - 1);
}
public int GetQuantity(int index)
{
int _totalQuantity = 0;
foreach (var item in subSessionQuantities)
{
_totalQuantity += item[index];
}
return _totalQuantity;
}
}
}