functionality testing

This commit is contained in:
Luc Vandenbroucke 2020-02-05 14:21:53 +01:00
parent 824f98e6d2
commit 3c99fe5624
24 changed files with 870 additions and 128 deletions

View file

@ -1,16 +1,15 @@
#include "stdafx.h" #include "stdafx.h"
#include "EpdBase.h" #include "EpdBase.h"
#define DiscoveryExpirationPeriod 1000
EpdBase::Epd2U::Epd2U(int comport) EpdBase::Epd2U::Epd2U(int comport)
{ {
port = comport; port = comport;
CommsInitialized = 0; CommsInitialized = 0;
SetAutoCommit(0); SetAutoCommit(0);
Error = 123; Error = 123;
//SetTimeouts(port, 20, 1000, 1000); //SetTimeouts(port, 20, 1000, 1000);
} }
DWORD EpdBase::Epd2U::StartCom() DWORD EpdBase::Epd2U::StartCom()
@ -20,7 +19,7 @@ DWORD EpdBase::Epd2U::StartCom()
if (InitRv == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); if (InitRv == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
else { else {
CommsInitialized = 1; CommsInitialized = 1;
SetDiscoveryExpirationPeriod(port, 5000); SetDiscoveryExpirationPeriod(port, DiscoveryExpirationPeriod);
} }
return Error; return Error;
} }
@ -35,17 +34,18 @@ EpdBase::Epd2U::~Epd2U()
int EpdBase::Epd2U::StartDiscover() int EpdBase::Epd2U::StartDiscover()
{ {
Error = 0; Error = 0;
FlushDiscoveryCache(port); Sleep(200);
DiscRV= Discover(port, DeviceIDs, MaxDevices, &DeviceCount); DiscRV= Discover(port, DeviceIDs, MaxDevices, &DeviceCount);
Commit(); Commit();
if (DiscRV == 1 && DeviceCount == 0) if (DiscRV == 1 && DeviceCount == 0)
{ {
DeinitComms(port); DeinitComms(port);
Sleep(100); FlushDiscoveryCache(port);
Sleep(200);
InitRv = InitComms(port, 9600, 8, 0, 0); InitRv = InitComms(port, 9600, 8, 0, 0);
if (InitRv == 1) { if (InitRv == 1) {
CommsInitialized = 1; CommsInitialized = 1;
SetDiscoveryExpirationPeriod(port, 5000); SetDiscoveryExpirationPeriod(port, DiscoveryExpirationPeriod);
DiscRV = Discover(port, DeviceIDs, MaxDevices, &DeviceCount); DiscRV = Discover(port, DeviceIDs, MaxDevices, &DeviceCount);
Commit(); Commit();
} }
@ -54,10 +54,7 @@ int EpdBase::Epd2U::StartDiscover()
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
} }
} }
return DiscRV; return DiscRV;
} }
void EpdBase::Epd2U::Open(DWORD DeviceID) void EpdBase::Epd2U::Open(DWORD DeviceID)
@ -119,6 +116,7 @@ void EpdBase::Epd2U::DecodeStatus()
WORD EpdBase::Epd2U::ReadStatus() WORD EpdBase::Epd2U::ReadStatus()
{ {
Error = 0; ReadStatusRV = 0;
memset(WearerID, 0, WearerIDLength+1); memset(WearerID, 0, WearerIDLength+1);
memset(WearerName, 0, WearerNameLength+1); memset(WearerName, 0, WearerNameLength+1);
@ -126,7 +124,6 @@ WORD EpdBase::Epd2U::ReadStatus()
ErrorSource = ErrorReason = ErrorData = 0; ErrorSource = ErrorReason = ErrorData = 0;
EpdID = HardVersion = SoftVersion = FunctionFlags = 0; EpdID = HardVersion = SoftVersion = FunctionFlags = 0;
CommitRV = ReadEpdStatus(&EpdClock, &RealTime, &IssueCount, &OffTime, &OperatingStatus, &ErrorStatus, &AlarmStatus, &OtherAlarms, &EEPROMBadSectors); CommitRV = ReadEpdStatus(&EpdClock, &RealTime, &IssueCount, &OffTime, &OperatingStatus, &ErrorStatus, &AlarmStatus, &OtherAlarms, &EEPROMBadSectors);
if (CommitRV==1) CommitRV= ReadEpdID( if (CommitRV==1) CommitRV= ReadEpdID(
&EpdID, &EpdID,
@ -136,7 +133,8 @@ WORD EpdBase::Epd2U::ReadStatus()
if (CommitRV==1) CommitRV = Commit(); if (CommitRV==1) CommitRV = Commit();
if(CommitRV == 0) { if(CommitRV == 0) {
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
return ErrorReason; ReadStatusRV= ErrorReason;
return 0;
} }
else { else {
if (CurrentDeviceID == 0) CurrentDeviceID = EpdID; if (CurrentDeviceID == 0) CurrentDeviceID = EpdID;
@ -156,14 +154,14 @@ WORD EpdBase::Epd2U::ReadStatus()
if(CommitRV==1) CommitRV = Commit(); if(CommitRV==1) CommitRV = Commit();
if (CommitRV == 0) { if (CommitRV == 0) {
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
return ErrorReason; ReadStatusRV = ErrorReason;
return 0;
} }
else { else {
for (int i = 0; i < WearerIDLength; i++) for (int i = 0; i < WearerIDLength; i++)
if (WearerID[i] == 0xb) WearerID[i] = '0'; else WearerID[i] |= 0x30; if (WearerID[i] == 0xb) WearerID[i] = '0'; else WearerID[i] |= 0x30;
} }
} }
return CommitRV; return CommitRV;
} }
@ -378,7 +376,6 @@ WORD EpdBase::Epd2U::DeIssue()
} }
//DeinitComms(port); //DeinitComms(port);
return CommitRV; return CommitRV;
} }
@ -386,7 +383,6 @@ WORD EpdBase::Epd2U::Issue()
{ {
IssueEpdRV = WriteAlarmDoseThresholdsRV = WriteAlarmRateThresholdsRV = WriteWearerNameRV = OnRV = CommitRV = 0; IssueEpdRV = WriteAlarmDoseThresholdsRV = WriteAlarmRateThresholdsRV = WriteWearerNameRV = OnRV = CommitRV = 0;
DWORD OKRV = SetFailFlag(); // all actions have been completed DWORD OKRV = SetFailFlag(); // all actions have been completed
if (OKRV) OKRV = Commit(); if (OKRV) OKRV = Commit();
@ -406,7 +402,7 @@ WORD EpdBase::Epd2U::Issue()
Commit(); Commit();
if (!DetectorsOn) { if (!DetectorsOn) {
OKRV = EpdOn(); OKRV=Commit(); Sleep(1000); OKRV = EpdOn(); OKRV=Commit(); Sleep(1500);
} }
if (OKRV) { if (OKRV) {

View file

@ -23,6 +23,8 @@ EpdBaseClr::Epd2::!Epd2()
int EpdBaseClr::Epd2::Connect() int EpdBaseClr::Epd2::Connect()
{ {
ConnectError = 0;
epd->StartCom(); epd->StartCom();
b->CurrentDeviceID = 0; b->CurrentDeviceID = 0;
@ -32,6 +34,9 @@ int EpdBaseClr::Epd2::Connect()
DeviceCount = epd->DeviceCount; DeviceCount = epd->DeviceCount;
if (epd->DeviceCount >= 0) b->CurrentDeviceID = epd->DeviceIDs[0]; if (epd->DeviceCount >= 0) b->CurrentDeviceID = epd->DeviceIDs[0];
} }
else {
ConnectError = epd->Error;
}
return DiscRV; return DiscRV;
} }
@ -43,16 +48,13 @@ int EpdBaseClr::Epd2::Close()
return 0; return 0;
} }
int EpdBaseClr::Epd2::GetStatus() int EpdBaseClr::Epd2::GetStatus()
{ {
//ReadStatus GetStatusError = 0; StatusRV = 0; Issued = false;
StatusRV = 0; Issued = false;
WearerID = String::Empty; WearerID = String::Empty;
WearerName = String::Empty; WearerName = String::Empty;
epd->ReadStatus(); StatusRV = epd->ReadStatus();
StatusRV= epd->ReadStatusRV; if (StatusRV != 1 ) GetStatusError=epd->Error;
Issued = epd->EPDIssued; Issued = epd->EPDIssued;
WearerID = gcnew String((char *)epd->WearerID); WearerID = gcnew String((char *)epd->WearerID);
WearerName = gcnew String((char *)epd->WearerName); WearerName = gcnew String((char *)epd->WearerName);
@ -77,6 +79,7 @@ int EpdBaseClr::Epd2::GetDoses()
ReadDosesRV = epd->ReadDoses(); ReadDosesRV = epd->ReadDoses();
if (ReadDosesRV == 1) { if (ReadDosesRV == 1) {
GetDosesError = 0;
Hp10 = (double)epd->Hp10Dose / 64.0; Hp10 = (double)epd->Hp10Dose / 64.0;
Hp07 = (double)epd->Hp07Dose / 64.0; Hp07 = (double)epd->Hp07Dose / 64.0;
Hp07Peak = (double)epd->Hp07Peak / 64.0; Hp07Peak = (double)epd->Hp07Peak / 64.0;
@ -84,7 +87,9 @@ int EpdBaseClr::Epd2::GetDoses()
Hp07Total = epd->Hp07Total / 64.0; Hp07Total = epd->Hp07Total / 64.0;
Hp10Total = epd->Hp10Total / 64.0; Hp10Total = epd->Hp10Total / 64.0;
}
else {
GetDosesError = epd->Error;
} }
if (epd->Hp10Time > 0) if (epd->Hp10Time > 0)
@ -119,12 +124,15 @@ int EpdBaseClr::Epd2::SetDeIssued()
int EpdBaseClr::Epd2::PrepareForIssue() int EpdBaseClr::Epd2::PrepareForIssue()
{ {
return epd->PrepareForIssue(); PrepareForIssueError = 0;
int rv= epd->PrepareForIssue();
if (rv != 1) PrepareForIssueError = epd->Error;
return rv;
} }
int EpdBaseClr::Epd2::SetIssued() int EpdBaseClr::Epd2::SetIssued()
{ {
SetIssuedError = 0;
epd->Hp07THDose = Hp07THDose*64; epd->Hp07THDose = Hp07THDose*64;
epd->Hp10THDose1 = Hp10THDose1*64; epd->Hp10THDose1 = Hp10THDose1*64;
epd->Hp10THDose2 = Hp10THDose2*64; epd->Hp10THDose2 = Hp10THDose2*64;
@ -136,7 +144,6 @@ int EpdBaseClr::Epd2::SetIssued()
epd->Hp10Rate2Off = Hp10Rate2Off; epd->Hp10Rate2Off = Hp10Rate2Off;
epd->Hp07RateOff = Hp07RateOff; epd->Hp07RateOff = Hp07RateOff;
memset(epd->WearerID, ' ', WearerIDLength); epd->WearerID[WearerIDLength] = 0; memset(epd->WearerID, ' ', WearerIDLength); epd->WearerID[WearerIDLength] = 0;
char* str1 = (char*)(void *)Runtime::InteropServices::Marshal::StringToHGlobalAnsi(WearerID); char* str1 = (char*)(void *)Runtime::InteropServices::Marshal::StringToHGlobalAnsi(WearerID);
int l = strlen(str1); int l = strlen(str1);
@ -151,11 +158,11 @@ int EpdBaseClr::Epd2::SetIssued()
_memccpy(epd->WearerName, str2, l, WearerNameLength); _memccpy(epd->WearerName, str2, l, WearerNameLength);
Runtime::InteropServices::Marshal::FreeHGlobal((IntPtr)str2); Runtime::InteropServices::Marshal::FreeHGlobal((IntPtr)str2);
epd->Issue(); int rv = epd->Issue();
return 0; if (rv != 1) SetIssuedError = epd->Error;
return rv;
} }
int EpdBaseClr::Epd2::WriteCalibration() int EpdBaseClr::Epd2::WriteCalibration()
{ {
@ -180,7 +187,9 @@ int EpdBaseClr::Epd2::WriteCalibration()
int EpdBaseClr::Epd2::ReadTresholds() int EpdBaseClr::Epd2::ReadTresholds()
{ {
epd->ReadTresHolds(); ReadTresholdsError = 0;
int rv= epd->ReadTresHolds();
if (rv != 0) ReadTresholdsError = epd->Error;
Hp10THDose1 = (double)epd->Hp10THDose1 / 64.0; Hp10THDose1 = (double)epd->Hp10THDose1 / 64.0;
Hp10THDose2 = (double)epd->Hp10THDose2 / 64.0; Hp10THDose2 = (double)epd->Hp10THDose2 / 64.0;
@ -207,7 +216,7 @@ int EpdBaseClr::Epd2::ReadTresholds()
FB = epd->FB; FB = epd->FB;
HG = epd->HG; HG = epd->HG;
return 0; return rv;
} }
int EpdBaseClr::Epd2::ReadExtraStatus() int EpdBaseClr::Epd2::ReadExtraStatus()

View file

@ -29,6 +29,12 @@ namespace EpdBaseClr {
int InitRV; int InitRV;
int DiscRV; int DiscRV;
int StatusRV; int StatusRV;
int GetStatusError;
int GetDosesError;
int ReadTresholdsError;
int PrepareForIssueError;
int SetIssuedError;
int ConnectError;
int ReadDosesRV; int ReadDosesRV;
int DeviceCount = 0; int DeviceCount = 0;

View file

@ -14,7 +14,6 @@ namespace OkReadBadge
clr = gcnew OkReadBadge::BadgeMessageHandler(); clr = gcnew OkReadBadge::BadgeMessageHandler();
clr->OnMessage = f; clr->OnMessage = f;
clrb = new OkReadBadge::BadgeUnmanaged(clr); clrb = new OkReadBadge::BadgeUnmanaged(clr);
} }
void Start() void Start()

View file

@ -62,9 +62,6 @@ void OkReadBadge::BadgeUnmanaged::GetDeviceUSB(std::wstring vid, std::wstring pi
} }
} }
int OkReadBadge::BadgeUnmanaged::read() int OkReadBadge::BadgeUnmanaged::read()
{ {
//const string x ="USB\\VID_076B&PID_5128&MI_00\\6&13A62366&0&0000"; //const string x ="USB\\VID_076B&PID_5128&MI_00\\6&13A62366&0&0000";
@ -73,6 +70,7 @@ int OkReadBadge::BadgeUnmanaged::read()
//const wchar_t *devicePath1 = L"\\\\?\\hid#vid_076b&pid_5428&mi_00#7&95573f7&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"; //const wchar_t *devicePath1 = L"\\\\?\\hid#vid_076b&pid_5428&mi_00#7&95573f7&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}";
HANDLE HIDfile = CreateFile(DevicePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL| FILE_FLAG_OVERLAPPED, nullptr); //FILE_FLAG_OVERLAPPED| HANDLE HIDfile = CreateFile(DevicePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL| FILE_FLAG_OVERLAPPED, nullptr); //FILE_FLAG_OVERLAPPED|
DWORD err = GetLastError(); DWORD err = GetLastError();
completed = false;
if (err != 0) { if (err != 0) {
//_tprintf(TEXT("unable to obtain read permissions for the HID device, error:\n ")); //_tprintf(TEXT("unable to obtain read permissions for the HID device, error:\n "));
} }
@ -81,7 +79,7 @@ int OkReadBadge::BadgeUnmanaged::read()
bread = 0; bread = 0;
rv = 1; rv = 1;
err = 0; err = 0;
while (err==0) while (err==0 && !completed)
{ {
rv = ReadFile(HIDfile, buffer, 100, &bread, Overlapped); rv = ReadFile(HIDfile, buffer, 100, &bread, Overlapped);
if (rv == 0) if (rv == 0)
@ -117,16 +115,13 @@ int OkReadBadge::BadgeUnmanaged::read()
return 0; return 0;
} }
OkReadBadge::BadgeUnmanaged::BadgeUnmanaged(BadgeMessageHandler^ clr) OkReadBadge::BadgeUnmanaged::BadgeUnmanaged(BadgeMessageHandler^ clr)
{ {
m_clr = clr; m_clr = clr;
Overlapped = new OVERLAPPED(); Overlapped = new OVERLAPPED();
memset(Overlapped, 0, sizeof(OVERLAPPED)); memset(Overlapped, 0, sizeof(OVERLAPPED));
Overlapped->Offset = 0; Overlapped->Offset = 0;
Overlapped->hEvent = CreateEvent(nullptr, true, false, nullptr); Overlapped->hEvent = CreateEvent(nullptr, true, false, nullptr);
buffer[100]; buffer[100];
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
buffer[0] = 0x00; // Feature report 0x0F buffer[0] = 0x00; // Feature report 0x0F

View file

@ -30,9 +30,9 @@ namespace OkReadBadge
bool nextSite = false; bool nextSite = false;
bool nextCode = false; bool nextCode = false;
bool nextFinish = false; bool nextFinish = false;
bool completed = false;
char Res [100]; char Res [100];
static bool CALLBACK Message(int err, LPARAM param) static bool CALLBACK Message(int err, LPARAM param)
{ {
//m_clr.Result = gcnew buffer //m_clr.Result = gcnew buffer
@ -50,7 +50,7 @@ namespace OkReadBadge
} }
else if (!strncmp("csn:", r, 4)) { else if (!strncmp("csn:", r, 4)) {
memset(bu->Res, 0, sizeof(bu->Res)); memset(bu->Res, 0, sizeof(bu->Res));
bu->nextCSN = true; bu->nextFinish = bu->nextCode = bu->nextSite = false ; bu->nextCSN = true; bu->nextFinish = bu->nextCode = bu->nextSite = bu->completed = false ;
} }
else if (!strncmp("site:", r, 5)) { bu->nextSite = true; } else if (!strncmp("site:", r, 5)) { bu->nextSite = true; }
else if (!strncmp("code:", r, 5)) { bu->nextCode = true; } else if (!strncmp("code:", r, 5)) { bu->nextCode = true; }
@ -59,6 +59,7 @@ namespace OkReadBadge
bu->nextCode = bu->nextSite = bu->nextCSN = false; bu->nextCode = bu->nextSite = bu->nextCSN = false;
if (bu->nextFinish) { if (bu->nextFinish) {
bu->nextFinish = false; bu->nextFinish = false;
bu->completed = true;
} }
} }
bu->m_clr->Result = gcnew String(r); bu->m_clr->Result = gcnew String(r);

16
RegisterBAdge/App.config Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="RegisterBAdge.Properties.Settings.idpbwConnection"
connectionString="Data Source=sqlprdidpbw;Initial Catalog=idpbw;Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="RegisterBAdge.Properties.Settings.RemsConnection"
connectionString="Data Source=sqlsrv3;Initial Catalog=HPH_REMS_new;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

9
RegisterBAdge/App.xaml Normal file
View file

@ -0,0 +1,9 @@
<Application x:Class="RegisterBAdge.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:RegisterBAdge"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

17
RegisterBAdge/App.xaml.cs Normal file
View file

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace RegisterBAdge
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

View file

@ -0,0 +1,53 @@
<Window x:Class="RegisterBAdge.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:RegisterBAdge"
mc:Ignorable="d"
Title="Register Badge" Height="450" Width="800" Loaded="Window_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="*" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Text="Registratie Badge in Rems" Background="AntiqueWhite" HorizontalAlignment="Stretch" TextAlignment="Center" FontWeight="Bold" Margin="5,10,5,10" />
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="PersID" Grid.Row="0" Grid.Column="0" Padding="10,0,10,0"/>
<TextBox Name="PersID" Grid.Row="0" Grid.Column="1"/>
<TextBlock Text="Name" Grid.Row="1" Grid.Column="0" Padding="10,0,10,0"/>
<TextBox Name="Name" Grid.Row="1" Grid.Column="1"/>
<TextBlock Text="FirstName" Grid.Row="2" Grid.Column="0" Padding="10,0,10,0"/>
<TextBox Name="FirstName" Grid.Row="2" Grid.Column="1"/>
<TextBlock Text="CSN: Card Serial Number" Grid.Row="3" Grid.Column="0" Padding="10,0,10,0"/>
<TextBox Name="CSN" Grid.Row="3" Grid.Column="1"/>
<TextBlock Text="SiteCode" Grid.Row="4" Grid.Column="0" Padding="10,0,10,0"/>
<TextBox Name="Site" Grid.Row="4" Grid.Column="1"/>
<TextBlock Text="BadgeCode" Grid.Row="5" Grid.Column="0" Padding="10,0,10,0"/>
<TextBox Name="Code" Grid.Row="5" Grid.Column="1"/>
</Grid>
</Grid>
</Window>

View file

@ -0,0 +1,184 @@
using System;
using System.Collections.Generic;
using System.Data;
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 RegisterBAdge
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public static OkReadBadge.Badging a;
System.Threading.Thread t;
bool nextCSN = false;
bool nextSite = false;
bool nextCode = false;
bool nextFinish = false;
string csn, site, code;
System.Data.SqlClient.SqlCommand UpdPers;
public MainWindow()
{
InitializeComponent();
}
void CheckBadge()
{
using (var t = new System.Data.DataTable()) {
using (var co = new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.idpbwConnection))
{
using (var co2 = new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.RemsConnection))
{
using (var cm = new System.Data.SqlClient.SqlCommand("rems.GetPerson", co))
{
cm.CommandType = System.Data.CommandType.StoredProcedure;
cm.Parameters.AddWithValue("CSN", CSN.Text);
cm.Parameters.AddWithValue("Badge", Code.Text);
co.Open();
var rs = cm.ExecuteReader(System.Data.CommandBehavior.SingleRow | System.Data.CommandBehavior.CloseConnection);
t.Load(rs);
co.Close();
if (t.Rows.Count > 0)
{
co2.Open();
DataRow r = t.Rows[0];
PersID.Text = r["persID"].ToString();
Name.Text = r["LastName"].ToString();
FirstName.Text = (string)r["NickName"];
UpdPers.Parameters["persID"].Value = (int)r["persID"];
UpdPers.Parameters["TYPE"].Value = (string)r["TYPE"];
UpdPers.Parameters["CSN"].Value = (string)r["CSN"];
UpdPers.Parameters["Badge"].Value = (string)r["Badge"];
UpdPers.Parameters["firstname"].Value = (string)r["firstname"];
UpdPers.Parameters["LastName"].Value = (string)r["LastName"];
UpdPers.Parameters["NickName"].Value = (string)r["NickName"];
UpdPers.Parameters["birthDate"].Value = (DateTime)r["birthDate"];
UpdPers.Parameters["conCode"].Value = (string)r["conCode"];
UpdPers.Parameters["AccessAllow"].Value = (Boolean)r["AccessAllow"];
UpdPers.Parameters["Language"].Value = (string)r["Language"];
UpdPers.Parameters["VisitIdLocked"].Value = DBNull.Value;
UpdPers.Parameters["Deleted"].Value = (Boolean)r["Deleted"];
UpdPers.Connection = co2;
UpdPers.ExecuteNonQuery();
co2.Close();
}
}
}
}
}
//_User = new User(CSN.Text, Code.Text);
//if (_User.Error == 0)
// AskTask();
//else
//{
// MessageBox.Show(_User.ErrorMessage);
// Close();
//}
}
public void showBadge()
{
CSN.Text = csn;
Site.Text = site;
Code.Text = code;
Dispatcher.Invoke(CheckBadge);
}
bool Msg(int err)
{
//decodeert verschillenden USB messages. (callback )
if (err == 0)
{
if (a.clr.Result.StartsWith("csn:", StringComparison.InvariantCultureIgnoreCase) && a.clr.Result.EndsWith(";"))
{ //GEn 2
csn = string.Empty;
foreach (string ar in a.clr.Result.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
if (ar.StartsWith("csn:")) csn = ar.Substring(4);
if (ar.StartsWith("site:")) site = ar.Substring(5);
if (ar.StartsWith("code:")) code = ar.Substring(5);
}
this.Dispatcher.Invoke(new Action(() => showBadge()));
}
else
{
if (a.clr.Result.Equals(";"))
{
if (nextSite) site = string.Empty;
if (nextCode) code = string.Empty;
if (nextFinish || nextCode)
{
this.Dispatcher.Invoke(new Action(() => showBadge()));
}
nextCSN = nextSite = nextCode = nextFinish = false;
}
else if (nextCSN) { csn = a.clr.Result; nextCSN = nextFinish = false; }
else if (nextSite) { site = a.clr.Result; nextSite = false; }
else if (nextCode) { code = a.clr.Result; nextCode = false; nextFinish = true; }
else if (a.clr.Result.Equals("csn:")) { nextCSN = true; nextCode = nextSite = false; }
else if (a.clr.Result.Equals("site:")) { nextSite = true; nextCSN = nextCode = false; }
else if (a.clr.Result.Equals("code:")) { nextCode = true; nextCSN = nextSite = false; }
else System.Diagnostics.Debug.WriteLine(a.clr.Result);
}
}
else
System.Diagnostics.Debug.WriteLine($"Error {err}");
return false;
}
private void Starter()
{
try
{
a = new OkReadBadge.Badging(Msg);
a.Start();
}
catch (System.Exception ex)
{
MessageBox.Show($"Badgereader error {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
UpdPers = new System.Data.SqlClient.SqlCommand("UpdatePerson");
UpdPers.CommandType = System.Data.CommandType.StoredProcedure;
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("RETURN_VALUE", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.ReturnValue, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("persID", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("TYPE", System.Data.SqlDbType.Char, 1, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("CSN", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("Badge", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("firstname", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("LastName", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("NickName", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("birthDate", System.Data.SqlDbType.Date, 0, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("conCode", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("AccessAllow", System.Data.SqlDbType.Bit, 0, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("Language", System.Data.SqlDbType.Char, 1, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("VisitIdLocked", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
UpdPers.Parameters.Add(new System.Data.SqlClient.SqlParameter("Deleted", System.Data.SqlDbType.Bit, 0, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, DBNull.Value));
t = new System.Threading.Thread(() => Starter());
t.Start();
}
}
}

View file

@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("RegisterBAdge")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RegisterBAdge")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <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>
//------------------------------------------------------------------------------
namespace RegisterBAdge.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RegisterBAdge.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View file

@ -0,0 +1,46 @@
//------------------------------------------------------------------------------
// <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>
//------------------------------------------------------------------------------
namespace RegisterBAdge.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=sqlprdidpbw;Initial Catalog=idpbw;Integrated Security=True")]
public string idpbwConnection {
get {
return ((string)(this["idpbwConnection"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=sqlsrv3;Initial Catalog=HPH_REMS_new;Integrated Security=True")]
public string RemsConnection {
get {
return ((string)(this["RemsConnection"]));
}
}
}
}

View file

@ -0,0 +1,22 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="RegisterBAdge.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="idpbwConnection" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;ConnectionString&gt;Data Source=sqlprdidpbw;Initial Catalog=idpbw;Integrated Security=True&lt;/ConnectionString&gt;
&lt;ProviderName&gt;System.Data.SqlClient&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Data Source=sqlprdidpbw;Initial Catalog=idpbw;Integrated Security=True</Value>
</Setting>
<Setting Name="RemsConnection" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;ConnectionString&gt;Data Source=sqlsrv3;Initial Catalog=HPH_REMS_new;Integrated Security=True&lt;/ConnectionString&gt;
&lt;ProviderName&gt;System.Data.SqlClient&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Data Source=sqlsrv3;Initial Catalog=HPH_REMS_new;Integrated Security=True</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>RegisterBAdge</RootNamespace>
<AssemblyName>RegisterBAdge</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="OkReadBadge">
<HintPath>..\Release\OkReadBadge.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -15,6 +15,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EpdBaseClr", "EpdBaseClr\Ep
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OkReadBadge", "OkReadBadge\OkReadBadge.vcxproj", "{F98F3496-8A4C-4BDB-9F17-C7AF47A60739}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OkReadBadge", "OkReadBadge\OkReadBadge.vcxproj", "{F98F3496-8A4C-4BDB-9F17-C7AF47A60739}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RegisterBAdge", "RegisterBAdge\RegisterBAdge.csproj", "{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -121,6 +123,26 @@ Global
{F98F3496-8A4C-4BDB-9F17-C7AF47A60739}.Release|x64.Build.0 = Release|x64 {F98F3496-8A4C-4BDB-9F17-C7AF47A60739}.Release|x64.Build.0 = Release|x64
{F98F3496-8A4C-4BDB-9F17-C7AF47A60739}.Release|x86.ActiveCfg = Release|Win32 {F98F3496-8A4C-4BDB-9F17-C7AF47A60739}.Release|x86.ActiveCfg = Release|Win32
{F98F3496-8A4C-4BDB-9F17-C7AF47A60739}.Release|x86.Build.0 = Release|Win32 {F98F3496-8A4C-4BDB-9F17-C7AF47A60739}.Release|x86.Build.0 = Release|Win32
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Debug|ARM.Build.0 = Debug|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Debug|ARM64.Build.0 = Debug|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Debug|x64.ActiveCfg = Debug|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Debug|x64.Build.0 = Debug|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Debug|x86.ActiveCfg = Debug|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Debug|x86.Build.0 = Debug|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Release|Any CPU.Build.0 = Release|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Release|ARM.ActiveCfg = Release|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Release|ARM.Build.0 = Release|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Release|ARM64.ActiveCfg = Release|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Release|ARM64.Build.0 = Release|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Release|x64.ActiveCfg = Release|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Release|x64.Build.0 = Release|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Release|x86.ActiveCfg = Release|Any CPU
{6AC69ACE-3666-4A3D-A4B9-FFA24C424C1B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -83,7 +83,7 @@
<xs:element name="DataSet1" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="DataSet1" msprop:Generator_UserDSName="DataSet1"> <xs:element name="DataSet1" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="DataSet1" msprop:Generator_UserDSName="DataSet1">
<xs:complexType> <xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="GetTaskList" msprop:Generator_TableClassName="GetTaskListDataTable" msprop:Generator_TableVarName="tableGetTaskList" msprop:Generator_TablePropName="GetTaskList" msprop:Generator_RowDeletingName="GetTaskListRowDeleting" msprop:Generator_RowChangingName="GetTaskListRowChanging" msprop:Generator_RowEvHandlerName="GetTaskListRowChangeEventHandler" msprop:Generator_RowDeletedName="GetTaskListRowDeleted" msprop:Generator_UserTableName="GetTaskList" msprop:Generator_RowChangedName="GetTaskListRowChanged" msprop:Generator_RowEvArgName="GetTaskListRowChangeEvent" msprop:Generator_RowClassName="GetTaskListRow"> <xs:element name="GetTaskList" msprop:Generator_TableClassName="GetTaskListDataTable" msprop:Generator_TableVarName="tableGetTaskList" msprop:Generator_RowChangedName="GetTaskListRowChanged" msprop:Generator_TablePropName="GetTaskList" msprop:Generator_RowDeletingName="GetTaskListRowDeleting" msprop:Generator_RowChangingName="GetTaskListRowChanging" msprop:Generator_RowEvHandlerName="GetTaskListRowChangeEventHandler" msprop:Generator_RowDeletedName="GetTaskListRowDeleted" msprop:Generator_RowClassName="GetTaskListRow" msprop:Generator_UserTableName="GetTaskList" msprop:Generator_RowEvArgName="GetTaskListRowChangeEvent">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
<xs:element name="ID_Task" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnID_Task" msprop:Generator_ColumnPropNameInRow="ID_Task" msprop:Generator_ColumnPropNameInTable="ID_TaskColumn" msprop:Generator_UserColumnName="ID_Task" type="xs:int" /> <xs:element name="ID_Task" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnID_Task" msprop:Generator_ColumnPropNameInRow="ID_Task" msprop:Generator_ColumnPropNameInTable="ID_TaskColumn" msprop:Generator_UserColumnName="ID_Task" type="xs:int" />
@ -113,7 +113,7 @@
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
<xs:element name="GetTaskInfo" msprop:Generator_TableClassName="GetTaskInfoDataTable" msprop:Generator_TableVarName="tableGetTaskInfo" msprop:Generator_RowChangedName="GetTaskInfoRowChanged" msprop:Generator_TablePropName="GetTaskInfo" msprop:Generator_RowDeletingName="GetTaskInfoRowDeleting" msprop:Generator_RowChangingName="GetTaskInfoRowChanging" msprop:Generator_RowEvHandlerName="GetTaskInfoRowChangeEventHandler" msprop:Generator_RowDeletedName="GetTaskInfoRowDeleted" msprop:Generator_RowClassName="GetTaskInfoRow" msprop:Generator_UserTableName="GetTaskInfo" msprop:Generator_RowEvArgName="GetTaskInfoRowChangeEvent"> <xs:element name="GetTaskInfo" msprop:Generator_TableClassName="GetTaskInfoDataTable" msprop:Generator_TableVarName="tableGetTaskInfo" msprop:Generator_TablePropName="GetTaskInfo" msprop:Generator_RowDeletingName="GetTaskInfoRowDeleting" msprop:Generator_RowChangingName="GetTaskInfoRowChanging" msprop:Generator_RowEvHandlerName="GetTaskInfoRowChangeEventHandler" msprop:Generator_RowDeletedName="GetTaskInfoRowDeleted" msprop:Generator_UserTableName="GetTaskInfo" msprop:Generator_RowChangedName="GetTaskInfoRowChanged" msprop:Generator_RowEvArgName="GetTaskInfoRowChangeEvent" msprop:Generator_RowClassName="GetTaskInfoRow">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
<xs:element name="ID_Task" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnID_Task" msprop:Generator_ColumnPropNameInRow="ID_Task" msprop:Generator_ColumnPropNameInTable="ID_TaskColumn" msprop:Generator_UserColumnName="ID_Task" type="xs:int" /> <xs:element name="ID_Task" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnID_Task" msprop:Generator_ColumnPropNameInRow="ID_Task" msprop:Generator_ColumnPropNameInTable="ID_TaskColumn" msprop:Generator_UserColumnName="ID_Task" type="xs:int" />

View file

@ -6,7 +6,7 @@
xmlns:local="clr-namespace:eDosStation" xmlns:local="clr-namespace:eDosStation"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="eDosStation.EntryBadge" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="eDosStation.EntryBadge"
mc:Ignorable="d" mc:Ignorable="d"
Title="EntryBadge" Height="980" Width="1820" Loaded="Window_Loaded" FontFamily="Comic Sans MS" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowState="Maximized" > Title="EntryBadge" Height="980" Width="1820" Loaded="Window_Loaded" FontFamily="Comic Sans MS" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowState="Maximized" Closing="Window_Closing" >
<Window.Resources> <Window.Resources>
<local:DataSet1 x:Key="dataSet1"/> <local:DataSet1 x:Key="dataSet1"/>
<CollectionViewSource x:Key="getTaskListViewSource" Source="{Binding GetTaskInfo, Source={StaticResource dataSet1}}"/> <CollectionViewSource x:Key="getTaskListViewSource" Source="{Binding GetTaskInfo, Source={StaticResource dataSet1}}"/>
@ -37,6 +37,7 @@
<TabItem Name="tbTask"> <TabItem Name="tbTask">
<Grid DataContext="{Binding Mode=OneWay, Source={StaticResource getTaskListViewSource}}" > <Grid DataContext="{Binding Mode=OneWay, Source={StaticResource getTaskListViewSource}}" >
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
@ -46,8 +47,8 @@
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.ColumnSpan="2" Text="Naam" Name="Naam" HorizontalAlignment="Stretch" TextAlignment="Center" FontWeight="Bold" Background="Azure" FontSize="15" />
<Border Grid.Row="0" Grid.ColumnSpan="2" Background="AliceBlue" HorizontalAlignment="Stretch" CornerRadius="10" > <Border Grid.Row="1" Grid.ColumnSpan="2" Background="AliceBlue" HorizontalAlignment="Stretch" CornerRadius="10" >
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition />
@ -57,7 +58,6 @@
<StackPanel Orientation="Horizontal" Grid.Column="0"> <StackPanel Orientation="Horizontal" Grid.Column="0">
<telerik:RadToggleButton Name="cbNormal" HorizontalAlignment="Left" Width="150" Content="Normal" TextBlock.FontSize="24" Click="CbNormal_Click" IsChecked="True" CornerRadius="15" /> <telerik:RadToggleButton Name="cbNormal" HorizontalAlignment="Left" Width="150" Content="Normal" TextBlock.FontSize="24" Click="CbNormal_Click" IsChecked="True" CornerRadius="15" />
<telerik:RadToggleButton Name="cbAlara" HorizontalAlignment="Left" Width="150" Content="Alara" TextBlock.FontSize="24" Click="CbAlara_Click" IsChecked="False" CornerRadius="15" /> <telerik:RadToggleButton Name="cbAlara" HorizontalAlignment="Left" Width="150" Content="Alara" TextBlock.FontSize="24" Click="CbAlara_Click" IsChecked="False" CornerRadius="15" />
</StackPanel> </StackPanel>
<TextBlock Grid.Column="1" FontSize="36" TextAlignment="Center" Text="Choose a task" /> <TextBlock Grid.Column="1" FontSize="36" TextAlignment="Center" Text="Choose a task" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="3"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="3">
@ -66,7 +66,7 @@
</StackPanel> </StackPanel>
</Grid> </Grid>
</Border> </Border>
<StackPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Stretch" > <StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Vertical" VerticalAlignment="Top" HorizontalAlignment="Stretch" >
<ScrollViewer VerticalScrollBarVisibility="Visible" Style="{Binding Mode=OneWay, Source={StaticResource CustomScrollViewer}}" MaxHeight="753"> <ScrollViewer VerticalScrollBarVisibility="Visible" Style="{Binding Mode=OneWay, Source={StaticResource CustomScrollViewer}}" MaxHeight="753">
<ListBox ItemsSource="{Binding Mode=OneWay}" SelectedValuePath="ID_Task" SelectionChanged="ListBox_SelectionChanged" ScrollViewer.CanContentScroll="False" > <ListBox ItemsSource="{Binding Mode=OneWay}" SelectedValuePath="ID_Task" SelectionChanged="ListBox_SelectionChanged" ScrollViewer.CanContentScroll="False" >
<ListBox.ItemsPanel > <ListBox.ItemsPanel >
@ -107,7 +107,7 @@
</ScrollViewer> </ScrollViewer>
</StackPanel> </StackPanel>
<Grid Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="10,10,10,10"> <Grid Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Margin="10,10,10,10">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
@ -156,11 +156,8 @@
<TextBlock Grid.Row="2" Grid.Column="0" Text="{Binding EPDRad,StringFormat={}Type: {0} }" /> <TextBlock Grid.Row="2" Grid.Column="0" Text="{Binding EPDRad,StringFormat={}Type: {0} }" />
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding FNGain_ANGainValue,StringFormat={}Gain: {0:0.00} }" /> <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding FNGain_ANGainValue,StringFormat={}Gain: {0:0.00} }" />
<TextBlock Grid.Row="2" Grid.Column="2" Text="{Binding MinWorkerDosisMargin,StringFormat={}Margin: {0:0.00} }" /> <TextBlock Grid.Row="2" Grid.Column="2" Text="{Binding MinWorkerDosisMargin,StringFormat={}Margin: {0:0.00} }" />
</Grid> </Grid>
<Image Grid.Row="2" Grid.RowSpan="2" Grid.Column="0" Height="150" > <Image Grid.Row="3" Grid.RowSpan="2" Grid.Column="0" Height="150" >
<Image.Style> <Image.Style>
<Style TargetType="{x:Type Image}"> <Style TargetType="{x:Type Image}">
<Style.Triggers> <Style.Triggers>
@ -174,7 +171,7 @@
</Style> </Style>
</Image.Style> </Image.Style>
</Image> </Image>
<StackPanel Grid.Row="3" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" > <StackPanel Grid.Row="4" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" >
<telerik:RadButton Name="TaskOK" Content="OK" Click="TaskOK_Click" Width="300" Height="50" CornerRadius="10" TextBlock.FontSize="25" /> <telerik:RadButton Name="TaskOK" Content="OK" Click="TaskOK_Click" Width="300" Height="50" CornerRadius="10" TextBlock.FontSize="25" />
</StackPanel> </StackPanel>
</Grid> </Grid>

View file

@ -42,7 +42,7 @@ namespace eDosStation
static User _User; static User _User;
DataSet1.GetTaskInfoRow CurTaskRow; DataSet1.GetTaskInfoRow CurTaskRow;
private bool StopReadBadge=true;
public EntryBadge(EpdBaseClr.Epd2 curEP, Station curStation) public EntryBadge(EpdBaseClr.Epd2 curEP, Station curStation)
{ {
ep=curEP; ep=curEP;
@ -50,12 +50,16 @@ namespace eDosStation
InitializeComponent(); InitializeComponent();
_User = null; _User = null;
} }
private bool LoadDoses() private bool LoadDoses()
{ {
bool rv = true; bool rv = true;
ep.GetStatus(); System.Diagnostics.Debug.WriteLine("LoadDoses: EPD GEt Status");
int rva= ep.GetStatus();
if (rva != 1)
{
MessageBox.Show($"Entry GetStatus error {rva} {ep.GetStatusError}");
}
System.Diagnostics.Debug.WriteLine($"LoadDoses: EPD {ep.EpdID} Type:{ep.epdType}");
if (ep.Issued) if (ep.Issued)
{ {
MessageBox.Show("EPD is currently issued\nPlease take an other", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification); MessageBox.Show("EPD is currently issued\nPlease take an other", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
@ -68,22 +72,28 @@ namespace eDosStation
MessageBox.Show("Wrong EPD Type", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification); MessageBox.Show("Wrong EPD Type", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
this.Close(); this.Close();
return false; return false;
} }
statusEPD.Text = $"EPD: {ep.EpdID}"; statusEPD.Text = $"EPD: {ep.EpdID}";
ep.ReadTresholds(); rva = ep.ReadTresholds();
if (rva != 1)
{
MessageBox.Show($"ReadTresholds error {ep.ReadTresholdsError}");
}
return rv; return rv;
//ep.Hp07THDose = //ep.Hp07THDose =
} }
private void DispatcherTimer_Tick(object sender, EventArgs e) private void DispatcherTimer_Tick(object sender, EventArgs e)
{ {
EpdFound = false;
dispatcherTimer.Stop(); dispatcherTimer.Stop();
ep.Close(); ep.Close();
ep.Connect(); System.Threading.Thread.Sleep(200);
if (ep.DeviceCount == 1) int rv= ep.Connect();
System.Diagnostics.Debug.WriteLine($"Connect {rv} error {ep.ConnectError}");
if (ep.DeviceCount >0 && ep.b.CurrentDeviceID>0)
{ {
System.Diagnostics.Debug.WriteLine($"Devices:{ep.DeviceCount} id:{ep.b.CurrentDeviceID} {ep.ConnectError} ");
EpdFound = true; EpdFound = true;
DoEPD(); DoEPD();
} }
@ -92,7 +102,7 @@ namespace eDosStation
Search--; Search--;
if (Search > 0) if (Search > 0)
{ {
statusEPD.Text = $"Search {Search}"; statusEPD.Text = $"Search {Search} ({ep.ConnectError})";
dispatcherTimer.Start(); dispatcherTimer.Start();
} }
else else
@ -101,7 +111,6 @@ namespace eDosStation
} }
} }
} }
private void DoEPD() private void DoEPD()
{ {
if (LoadDoses()) if (LoadDoses())
@ -127,7 +136,10 @@ namespace eDosStation
} }
int rv= ep.PrepareForIssue(); int rv= ep.PrepareForIssue();
if (rv != 1)
{
MessageBox.Show($"PrepareForIssue error {ep.PrepareForIssueError}");
}
ep.WearerID = VisitID.ToString(); ep.WearerID = VisitID.ToString();
ep.WearerName = _User.PersID.ToString(); ep.WearerName = _User.PersID.ToString();
@ -174,17 +186,21 @@ namespace eDosStation
} }
} }
ep.SetIssued(); rv = ep.SetIssued();
if (rv != 1)
{
MessageBox.Show($"SetIssued error {ep.SetIssuedError}");
}
bEpdDone.Visibility = Visibility.Visible; bEpdDone.Visibility = Visibility.Visible;
} }
} }
private void GetEPD() private void GetEPD()
{ {
if (_User == null || CurTaskRow == null) return; if (_User == null || CurTaskRow == null) return;
int ok = ep.Connect(); int ok = ep.Connect();
if (ep.DeviceCount == 1) if (ok != 1) System.Diagnostics.Debug.WriteLine($"GetEpd {ok} ConnectError: {ep.ConnectError}");
if (ep.DeviceCount == 1 && ep.b.CurrentDeviceID>0)
{ {
EpdFound = true; EpdFound = true;
DoEPD(); DoEPD();
@ -200,7 +216,6 @@ namespace eDosStation
return; return;
} }
} }
private void SetFilter(bool isAlara) private void SetFilter(bool isAlara)
{ {
Inst1 = (cbInst1.IsChecked ==true); Inst1 = (cbInst1.IsChecked ==true);
@ -240,12 +255,10 @@ namespace eDosStation
} }
else else
{ {
if (!string.IsNullOrEmpty(_User.UserComment)) if (!string.IsNullOrEmpty(_User.UserComment))
{ {
MessageBox.Show(_User.UserComment, "Comment", MessageBoxButton.OK, MessageBoxImage.Asterisk); MessageBox.Show(_User.UserComment, "Comment", MessageBoxButton.OK, MessageBoxImage.Asterisk);
} }
eDosStation.DataSet1 dataSet1 = ((eDosStation.DataSet1)(this.FindResource("dataSet1"))); eDosStation.DataSet1 dataSet1 = ((eDosStation.DataSet1)(this.FindResource("dataSet1")));
using (var dataSet1GetTaskInfoTableAdapter = new eDosStation.DataSet1TableAdapters.GetTaskInfoTableAdapter()) using (var dataSet1GetTaskInfoTableAdapter = new eDosStation.DataSet1TableAdapters.GetTaskInfoTableAdapter())
{ {
@ -261,7 +274,10 @@ namespace eDosStation
{ {
_User = new User(CSN.Text, Code.Text); _User = new User(CSN.Text, Code.Text);
if (_User.Error == 0) if (_User.Error == 0)
{
Naam.Text = string.Concat(_User.FirstName, " ", _User.LastName);
AskTask(); AskTask();
}
else else
{ {
MessageBox.Show(_User.ErrorMessage); MessageBox.Show(_User.ErrorMessage);
@ -273,16 +289,25 @@ namespace eDosStation
CSN.Text = csn; CSN.Text = csn;
Site.Text = site; Site.Text = site;
Code.Text = code; Code.Text = code;
Dispatcher.Invoke(CheckBadge); Dispatcher.Invoke(CheckBadge);
} }
bool Msg(int err) bool Msg(int err)
{ {
//decodeert verschillende USB messages. (callback )
if (StopReadBadge )
{
System.Diagnostics.Debug.WriteLine("msg dropped:");
if (err!=0) System.Diagnostics.Debug.WriteLine($"msg result={a.clr.Result}");
return false;
}
if (err == 0) if (err == 0)
{ {
System.Diagnostics.Debug.WriteLine($"msg result={a.clr.Result}");
if (a.clr.Result.StartsWith("csn:", StringComparison.InvariantCultureIgnoreCase) && a.clr.Result.EndsWith(";")) if (a.clr.Result.StartsWith("csn:", StringComparison.InvariantCultureIgnoreCase) && a.clr.Result.EndsWith(";"))
{ //GEn 2 { //GEn 2
csn = string.Empty; csn = string.Empty;
foreach (string ar in a.clr.Result.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) foreach (string ar in a.clr.Result.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{ {
if (ar.StartsWith("csn:")) csn = ar.Substring(4); if (ar.StartsWith("csn:")) csn = ar.Substring(4);
@ -290,6 +315,7 @@ namespace eDosStation
if (ar.StartsWith("code:")) code = ar.Substring(5); if (ar.StartsWith("code:")) code = ar.Substring(5);
} }
this.Dispatcher.Invoke(new Action(() => showBadge())); this.Dispatcher.Invoke(new Action(() => showBadge()));
StopReadBadge = true;
} }
else else
{ {
@ -300,6 +326,7 @@ namespace eDosStation
if (nextFinish || nextCode) if (nextFinish || nextCode)
{ {
this.Dispatcher.Invoke(new Action(() => showBadge())); this.Dispatcher.Invoke(new Action(() => showBadge()));
StopReadBadge = true;
} }
nextCSN = nextSite = nextCode = nextFinish = false; nextCSN = nextSite = nextCode = nextFinish = false;
} }
@ -314,9 +341,6 @@ namespace eDosStation
} }
else else
System.Diagnostics.Debug.WriteLine($"Error {err}"); System.Diagnostics.Debug.WriteLine($"Error {err}");
return false; return false;
} }
@ -324,9 +348,6 @@ namespace eDosStation
{ {
this.Close(); this.Close();
} }
private void BClear_Click(object sender, RoutedEventArgs e) private void BClear_Click(object sender, RoutedEventArgs e)
{ {
CSN.Text = string.Empty; CSN.Text = string.Empty;
@ -393,12 +414,6 @@ namespace eDosStation
} }
private void CbInst1_Click(object sender, RoutedEventArgs e) private void CbInst1_Click(object sender, RoutedEventArgs e)
{ {
Inst1 = (cbInst1.IsChecked == true); Inst1 = (cbInst1.IsChecked == true);
@ -427,7 +442,13 @@ namespace eDosStation
cbNormal.IsChecked = !isAlara; cbNormal.IsChecked = !isAlara;
SetFilter(isAlara); SetFilter(isAlara);
} }
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
t = null;
a = null;
//t.Abort();
} }
private void CbInst2_Click(object sender, RoutedEventArgs e) private void CbInst2_Click(object sender, RoutedEventArgs e)
@ -438,14 +459,16 @@ namespace eDosStation
SetFilter(isAlara); SetFilter(isAlara);
} }
private void Starter() private void Starter()
{ {
try try
{
if (a == null)
{ {
a = new OkReadBadge.Badging(Msg); a = new OkReadBadge.Badging(Msg);
StopReadBadge = false;
a.Start(); a.Start();
}
} catch (System.Exception ex) } catch (System.Exception ex)
{ {
MessageBox.Show($"Badgereader error {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); MessageBox.Show($"Badgereader error {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
@ -453,6 +476,7 @@ namespace eDosStation
} }
private void Window_Loaded(object sender, RoutedEventArgs e) private void Window_Loaded(object sender, RoutedEventArgs e)
{ {
EpdFound = false;
initialising = true; initialising = true;
tbEntry.IsSelected = true; tbEntry.IsSelected = true;
bEpdDone.Visibility = Visibility.Hidden; bEpdDone.Visibility = Visibility.Hidden;
@ -468,28 +492,12 @@ namespace eDosStation
Inst2 = false; Inst2 = false;
cbInst2.IsChecked = Inst2; cbInst2.IsChecked = Inst2;
} }
//eDosStation.DataSet1 dataSet1 = ((eDosStation.DataSet1)(this.FindResource("dataSet1")));
////using (eDosStation.DataSet1TableAdapters.GetTaskListTableAdapter dataSet1GetTaskListTableAdapter = new eDosStation.DataSet1TableAdapters.GetTaskListTableAdapter())
////{
//// dataSet1GetTaskListTableAdapter.Fill(dataSet1.GetTaskList);
////}
//using (var dataSet1GetTaskInfoTableAdapter = new eDosStation.DataSet1TableAdapters.GetTaskInfoTableAdapter())
//{
// dataSet1GetTaskInfoTableAdapter.Fill(dataSet1.GetTaskInfo, null, null);
//}
//System.Windows.Data.CollectionViewSource getTaskListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("getTaskListViewSource")));
//getTaskListViewSource.View.MoveCurrentToFirst();
string TestCSN = thisStation.TestCSN; string TestCSN = thisStation.TestCSN;
initialising = false; initialising = false;
if (string.IsNullOrWhiteSpace(TestCSN)) if (string.IsNullOrWhiteSpace(TestCSN))
{ {
////Real
t = new System.Threading.Thread(() => Starter()); t = new System.Threading.Thread(() => Starter());
t.Start(); t.Start();
} }

View file

@ -57,12 +57,21 @@ namespace eDosStation
} }
dispatcherTimer.Tick += DispatcherTimer_TickTO; ; dispatcherTimer.Tick += DispatcherTimer_TickTO; ;
ep.GetStatus(); int rv= ep.GetStatus();
if (rv != 1)
{
int er= ep.GetStatusError;
MessageBox.Show($"GetStatus {rv} error {er}");
}
if (!ep.Issued) if (!ep.Issued)
{ {
MessageBox.Show("This EPD is not issued","EDP",MessageBoxButton.OK,MessageBoxImage.Hand,MessageBoxResult.OK,MessageBoxOptions.ServiceNotification); MessageBox.Show("This EPD is not issued","EDP",MessageBoxButton.OK,MessageBoxImage.Hand,MessageBoxResult.OK,MessageBoxOptions.ServiceNotification);
this.Close(); this.Close();
return; return;
} else if (ep.EpdID==0)
{
MessageBox.Show("This EPD is not read", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
} }
@ -80,11 +89,19 @@ namespace eDosStation
DosePanel.Background = GreenBrush; DosePanel.Background = GreenBrush;
ok.IsSelected = true; ok.IsSelected = true;
} }
int rv = ep.ReadExtraStatus(); //D1 BaseD1 ... rv = ep.ReadExtraStatus(); //D1 BaseD1 ...
if (rv != 1)
{
MessageBox.Show($"ReadExtraStatus {rv}");
}
Wearer.Text = $"Wearer: {ep.WearerName}"; Wearer.Text = $"Wearer: {ep.WearerName}";
EpdVisit.Text = $"Visit: {ep.WearerID}"; EpdVisit.Text = $"Visit: {ep.WearerID}";
ep.GetDoses(); rv = ep.GetDoses();
if (rv != 1)
{
MessageBox.Show($"GetDoses {rv} er:{ep.GetDosesError}");
}
HpDose07.Text = $"Hp07: {ep.Hp07:0.00} µSv "; HpDose07.Text = $"Hp07: {ep.Hp07:0.00} µSv ";
HpDose10.Text = $"Hp10: {ep.Hp10:0.00} µSv"; HpDose10.Text = $"Hp10: {ep.Hp10:0.00} µSv";
if (int.TryParse(ep.WearerID, out int VisitID)) { if (int.TryParse(ep.WearerID, out int VisitID)) {
@ -127,8 +144,6 @@ namespace eDosStation
pa = new SqlParameter("D3", SqlDbType.Int); pa.Value = ep.D3; cmd1.Parameters.Add(pa); pa = new SqlParameter("D3", SqlDbType.Int); pa.Value = ep.D3; cmd1.Parameters.Add(pa);
pa = new SqlParameter("D4", SqlDbType.Int); pa.Value = ep.D4; cmd1.Parameters.Add(pa); pa = new SqlParameter("D4", SqlDbType.Int); pa.Value = ep.D4; cmd1.Parameters.Add(pa);
pa = new SqlParameter("alarmStatus", SqlDbType.Int); pa.Value = ep.alarmStatus; cmd1.Parameters.Add(pa); pa = new SqlParameter("alarmStatus", SqlDbType.Int); pa.Value = ep.alarmStatus; cmd1.Parameters.Add(pa);
pa = new SqlParameter("otherAlarms", SqlDbType.Int); pa.Value = ep.otherAlarms; cmd1.Parameters.Add(pa); pa = new SqlParameter("otherAlarms", SqlDbType.Int); pa.Value = ep.otherAlarms; cmd1.Parameters.Add(pa);
pa = new SqlParameter("errorStatus", SqlDbType.Int); pa.Value = ep.errorStatus; cmd1.Parameters.Add(pa); pa = new SqlParameter("errorStatus", SqlDbType.Int); pa.Value = ep.errorStatus; cmd1.Parameters.Add(pa);
@ -140,8 +155,12 @@ namespace eDosStation
} }
} }
} }
ep.SetDeIssued();
rv= ep.SetDeIssued();
if (rv!=1)
{
MessageBox.Show($"DeIssueerror {rv}");
}
dispatcherTimer.Start(); //Knop hide dispatcherTimer.Start(); //Knop hide
return; return;
@ -156,12 +175,14 @@ namespace eDosStation
private void StartScan() private void StartScan()
{ {
EpdFound = false;
//ep = new EpdBaseClr.Epd2(thisStation.ComPort); //ep = new EpdBaseClr.Epd2(thisStation.ComPort);
ep.Connect(); int rv = ep.Connect();
System.Diagnostics.Debug.WriteLine($"Connect {rv} error {ep.ConnectError}");
if (ep.DeviceCount == 1) if (ep.DeviceCount == 1)
{ {
EpdFound = true; EpdFound = true;
statusEPD.Content = $"EPD: {ep.b.CurrentDeviceID}"; statusEPD.Content = $"StartScan : EPD: {ep.b.CurrentDeviceID}";
LoadDoses(); LoadDoses();
} }
if (!EpdFound) if (!EpdFound)
@ -178,12 +199,12 @@ namespace eDosStation
private void Window_Loaded(object sender, RoutedEventArgs e) private void Window_Loaded(object sender, RoutedEventArgs e)
{ {
Wait.IsSelected = true; Wait.IsSelected = true;
EpdFound = false;
Dispatcher.InvokeAsync(StartScan); Dispatcher.InvokeAsync(StartScan);
} }
private void DispatcherTimer_Tick(object sender, EventArgs e) private void DispatcherTimer_Tick(object sender, EventArgs e)
{ {
dispatcherTimer.Stop(); dispatcherTimer.Stop();
EpdFound = false; EpdFound = false;
ep.Connect(); ep.Connect();

View file

@ -38,12 +38,14 @@ namespace eDosStation
{ {
var w = new EntryBadge(ep, thisStation); var w = new EntryBadge(ep, thisStation);
w.ShowDialog(); w.ShowDialog();
w = null;
} }
private void BExit_Click(object sender, RoutedEventArgs e) private void BExit_Click(object sender, RoutedEventArgs e)
{ {
var w = new EpdExit(ep, thisStation); var w = new EpdExit(ep, thisStation);
w.ShowDialog(); w.ShowDialog();
w = null;
} }
private void MenuItem_Click(object sender, RoutedEventArgs e) private void MenuItem_Click(object sender, RoutedEventArgs e)

View file

@ -15,13 +15,9 @@ namespace eDosStation
public string conCode { get; set; } public string conCode { get; set; }
public string Language { get; set; } public string Language { get; set; }
public bool? AccessAllow { get; set; } public bool? AccessAllow { get; set; }
public double? Margin { get; set; } public double? Margin { get; set; }
public bool? VisitIDLocked { get; set; } public bool? VisitIDLocked { get; set; }
public string ReasonNoAccess { get; set; } public string ReasonNoAccess { get; set; }
public string UserComment { get; set; } public string UserComment { get; set; }
public bool AllOk = false; public bool AllOk = false;
@ -61,14 +57,13 @@ namespace eDosStation
AllOk = (AccessAllow == true & VisitIDLocked == true); AllOk = (AccessAllow == true & VisitIDLocked == true);
} }
rs.Close(); rs.Close();
} catch(System.Exception ex) }
catch (System.Exception ex)
{ {
Error = 1; Error = 1;
ErrorMessage = ex.Message; ErrorMessage = ex.Message;
} }
co.Close(); co.Close();
} }
} }
} }