8 oktober, voor afwerking

This commit is contained in:
Luc Vandenbroucke 2020-10-08 13:48:36 +02:00
parent a218732e81
commit 43ab98dfe4
16 changed files with 211 additions and 181 deletions

View file

@ -6,7 +6,7 @@
#define RxRetryCount 5 #define RxRetryCount 5
#define TxRetryCount 5 #define TxRetryCount 5
#pragma unmanaged
EpdBase::Epd2U::Epd2U(int comport) EpdBase::Epd2U::Epd2U(int comport)
{ {
port = comport; port = comport;
@ -30,11 +30,11 @@ DWORD EpdBase::Epd2U::StartCom()
if (CommsInitialized==0) if (CommsInitialized==0)
do { do {
InitRv = InitComms(port, 9600, 8, 0, 0); InitRv = InitComms(port, 9600, 8, 0, 0);
System::Diagnostics::Trace::WriteLine(System::String::Format("InitCOms RV={0} Port={1}", InitRv, port)); //System::Diagnostics::Trace::WriteLine(System::String::Format("InitCOms RV={0} Port={1}", InitRv, port));
if (InitRv == 0) { if (InitRv == 0) {
rv= GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); rv= GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
System::Diagnostics::Trace::WriteLine(System::String::Format("InitCOms ErrorReason={0} ErrorData={1} Port={2}", ErrorReason, ErrorData, port)); //System::Diagnostics::Trace::WriteLine(System::String::Format("InitCOms ErrorReason={0} ErrorData={1} Port={2}", ErrorReason, ErrorData, port));
Sleep(300); DeinitComms(port); Sleep(300); DeinitComms(port);
} }
else { else {
@ -58,7 +58,7 @@ EpdBase::Epd2U::~Epd2U()
int EpdBase::Epd2U::StartDiscover() int EpdBase::Epd2U::StartDiscover()
{ {
WORD rv; WORD rv;
System::Diagnostics::Trace::WriteLine("StartDiscover"); //System::Diagnostics::Trace::WriteLine("StartDiscover");
Error = 0; Error = 0;
//SetDiscoveryTimeslotCount(port, 2); //SetDiscoveryTimeslotCount(port, 2);
@ -75,13 +75,13 @@ int EpdBase::Epd2U::StartDiscover()
{ {
//memset(DeviceIDs, 0, sizeof(DeviceIDs)); //memset(DeviceIDs, 0, sizeof(DeviceIDs));
DiscRV = Discover(port, DeviceIDs, MaxDevices, &DeviceCount); DiscRV = Discover(port, DeviceIDs, MaxDevices, &DeviceCount);
System::Diagnostics::Trace::WriteLine(System::String::Format("Discover try: {0} RV={1}", tries, DiscRV)); //System::Diagnostics::Trace::WriteLine(System::String::Format("Discover try: {0} RV={1}", tries, DiscRV));
if (DiscRV ==0 ) { if (DiscRV ==0 ) {
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
System::Diagnostics::Trace::WriteLine(System::String::Format("StartDiscover Error Connect Reason: {0} ErrorData {1}", ErrorReason, ErrorData)); //System::Diagnostics::Trace::WriteLine(System::String::Format("StartDiscover Error Connect Reason: {0} ErrorData {1}", ErrorReason, ErrorData));
} }
} }
System::Diagnostics::Trace::WriteLine(System::String::Format("Discover DeviceCount = {0}", DeviceCount)); //System::Diagnostics::Trace::WriteLine(System::String::Format("Discover DeviceCount = {0}", DeviceCount));
return DiscRV; return DiscRV;
} }
@ -379,16 +379,14 @@ WORD EpdBase::Epd2U::PrepareForIssue()
WORD EpdBase::Epd2U::DeIssue() WORD EpdBase::Epd2U::DeIssue()
{ {
ClearDoseRV = ClearTotalDoseRV = ClearPeakRatesRV = DeIssueEpdRV = 0; ClearDoseRV = ClearTotalDoseRV = ClearPeakRatesRV = DeIssueEpdRV = 0;
CommitRV = ClearFailFlag();
if (CommitRV) CommitRV = ClearFaultFlags();
if (CommitRV) CommitRV = ClearLatchedAlarms();
if (CommitRV) CommitRV = Commit();
if (CommitRV) CommitRV = ClearDose(); if (CommitRV) CommitRV = ClearDose();
if (CommitRV) CommitRV = ClearTotalDose(); if (CommitRV) CommitRV = ClearTotalDose();
if (CommitRV) CommitRV = ClearPeakRates(); if (CommitRV) CommitRV = ClearPeakRates();
if (CommitRV) CommitRV = Commit();
if (CommitRV) CommitRV = ClearFaultFlags();
if (CommitRV) CommitRV = ClearLatchedAlarms();//Hp10Rate1; Hp10Rate2; Hp07Rate; ReturnForRead
if (CommitRV) CommitRV = Commit();
CommitRV = ClearFailFlag();
if (CommitRV) CommitRV = DeIssueEpd(); if (CommitRV) CommitRV = DeIssueEpd();
if (CommitRV) CommitRV = Commit(); if (CommitRV) CommitRV = Commit();
if (CommitRV && DetectorsOn) { if (CommitRV && DetectorsOn) {

View file

@ -24,34 +24,34 @@
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword> <Keyword>ManagedCProj</Keyword>
<RootNamespace>EpdBase</RootNamespace> <RootNamespace>EpdBase</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport> <CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport> <CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport> <CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport> <CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

View file

@ -1,6 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "TimeFunctions.h" #include "TimeFunctions.h"
#pragma unmanaged
TimeFunctions::TimeFunctions() TimeFunctions::TimeFunctions()
{ {

View file

@ -103,10 +103,6 @@ int EpdBaseClr::Epd2::GetStatus()
errorStatus = epd->ErrorStatus; errorStatus = epd->ErrorStatus;
operatingStatus = epd->OperatingStatus; operatingStatus = epd->OperatingStatus;
EpdID = epd->EpdID; EpdID = epd->EpdID;
HardVersion = epd->HardVersion; HardVersion = epd->HardVersion;
SoftVersion = epd->SoftVersion; SoftVersion = epd->SoftVersion;

View file

@ -24,34 +24,34 @@
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<Keyword>ManagedCProj</Keyword> <Keyword>ManagedCProj</Keyword>
<RootNamespace>EpdBaseClr</RootNamespace> <RootNamespace>EpdBaseClr</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport> <CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport> <CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport> <CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport> <CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

View file

@ -11,7 +11,6 @@
namespace OkReadBadge namespace OkReadBadge
{ {
public class BadgeUnmanaged public class BadgeUnmanaged
{ {
@ -36,7 +35,6 @@ namespace OkReadBadge
char Site[20]; char Site[20];
char Badge[20]; char Badge[20];
int parse(char *rall) int parse(char *rall)
{ {
int items; int items;

View file

@ -23,35 +23,35 @@
<ProjectGuid>{F98F3496-8A4C-4BDB-9F17-C7AF47A60739}</ProjectGuid> <ProjectGuid>{F98F3496-8A4C-4BDB-9F17-C7AF47A60739}</ProjectGuid>
<Keyword>ManagedCProj</Keyword> <Keyword>ManagedCProj</Keyword>
<RootNamespace>OkReadBadge</RootNamespace> <RootNamespace>OkReadBadge</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<TargetFrameworkVersion>4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>4.7.2</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport> <CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport> <CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport> <CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport> <CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

View file

@ -23,32 +23,32 @@
<ProjectGuid>{3655B312-F7C2-4825-BD5F-E087F6AF2D90}</ProjectGuid> <ProjectGuid>{3655B312-F7C2-4825-BD5F-E087F6AF2D90}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>TestDirect</RootNamespace> <RootNamespace>TestDirect</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

View file

@ -23,32 +23,32 @@
<ProjectGuid>{7B3DD1C5-D8D0-408C-A272-FF5E4A30DF24}</ProjectGuid> <ProjectGuid>{7B3DD1C5-D8D0-408C-A272-FF5E4A30DF24}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>TestEdosBase</RootNamespace> <RootNamespace>TestEdosBase</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
</PropertyGroup> </PropertyGroup>

View file

@ -20,11 +20,17 @@
<TabControl Name="tb" TabStripPlacement="Top" > <TabControl Name="tb" TabStripPlacement="Top" >
<TabItem Name="tbEntry" > <TabItem Name="tbEntry" >
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<Border Background="AliceBlue" TextBlock.FontSize="24" TextBlock.LineHeight="30px" Padding="20,20,20,20" > <Border Background="AliceBlue" TextBlock.FontSize="24" TextBlock.LineHeight="30px" Padding="20,20,20,20" CornerRadius="10" BorderThickness="2" BorderBrush="Blue" >
<StackPanel HorizontalAlignment="Center" > <StackPanel HorizontalAlignment="Center" >
<TextBlock Text="Welcome to eDOS" TextAlignment="Center" /> <TextBlock TextAlignment="Center" Padding="10,10,10,10" >
<TextBlock Text="Entry Process ready !" FontSize="30" TextAlignment="Center" Margin="0,20,0,20"/> <LineBreak/>
<TextBlock Text="Please scan your badge on the badge reader" TextAlignment="Center"/> <Run Foreground="Blue" FontSize="28" FontWeight="Bold">Welcome to eDOS</Run>
<LineBreak/><LineBreak/>
<Run Background="LightGreen">Entry Process is ready</Run>
<LineBreak/><LineBreak/>
<Run>Please scan your badge on the badge reader</Run>
<LineBreak/><LineBreak/>
</TextBlock>
</StackPanel> </StackPanel>
</Border> </Border>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">

View file

@ -41,7 +41,6 @@ namespace eDosStation
string csn, site, code; string csn, site, code;
static User _User; static User _User;
DataSet1.CommentOnEventDataTable dtCOE;
DataSet1.GetTaskInfoRow CurTaskRow; DataSet1.GetTaskInfoRow CurTaskRow;
enum eCOE { quiz=1} ; enum eCOE { quiz=1} ;
private bool StopReadBadge=true; private bool StopReadBadge=true;
@ -258,7 +257,7 @@ namespace eDosStation
public string getCommentUnknown() public string getCommentUnknown()
{ {
StringBuilder res = new StringBuilder(); StringBuilder res = new StringBuilder();
DataSet1.CommentOnEventRow r = dtCOE.FindByID_CommnentOnEvent(3); var r = LocalRemote.GetCommentOnEventRow(3);
res.AppendLine(r.Comment_NL).Replace("\\n", "\n"); res.AppendLine(r.Comment_NL).Replace("\\n", "\n");
res.AppendLine("---"); res.AppendLine("---");
res.AppendLine(r.Comment_FR).Replace("\\n", "\n"); res.AppendLine(r.Comment_FR).Replace("\\n", "\n");
@ -272,7 +271,7 @@ namespace eDosStation
{ {
string res=string.Empty; string res=string.Empty;
if (!string.IsNullOrWhiteSpace(prefix)) res = prefix + "\n"; if (!string.IsNullOrWhiteSpace(prefix)) res = prefix + "\n";
DataSet1.CommentOnEventRow r = dtCOE.FindByID_CommnentOnEvent(id); var r = LocalRemote.GetCommentOnEventRow(id);
string l = _User?.Language ?? "E"; string l = _User?.Language ?? "E";
if (r!=null) if (r!=null)
@ -351,17 +350,14 @@ namespace eDosStation
{ {
Naam.Text = _User.FirstName + " " + _User.LastName; Naam.Text = _User.FirstName + " " + _User.LastName;
eDosStation.DataSet1 dataSet1 = ((eDosStation.DataSet1)(this.FindResource("dataSet1"))); eDosStation.DataSet1 dataSet1 = ((eDosStation.DataSet1)(this.FindResource("dataSet1")));
using (var dataSet1GetTaskInfoTableAdapter = new eDosStation.DataSet1TableAdapters.GetTaskInfoTableAdapter()) LocalRemote.FillTaskInfo(_User, dataSet1);
{
dataSet1GetTaskInfoTableAdapter.Fill(dataSet1.GetTaskInfo, null, _User.Margin);
}
tbTask.IsSelected = true; tbTask.IsSelected = true;
bool isAlara = (cbAlara.IsChecked == true); bool isAlara = (cbAlara.IsChecked == true);
SetFilter(isAlara); SetFilter(isAlara);
} }
void CheckBadge() void CheckBadge()
{ {
_User = new User(CSN.Text, Code.Text); _User = LocalRemote.GetUser(CSN.Text, Code.Text);
ShowUserInfo(); //AskTask(); ShowUserInfo(); //AskTask();
} }
public void showBadge() public void showBadge()
@ -516,7 +512,7 @@ namespace eDosStation
private void BTestPerson_Click(object sender, RoutedEventArgs e) private void BTestPerson_Click(object sender, RoutedEventArgs e)
{ {
Button b = sender as Button; Button b = sender as Button;
_User = new User("TP"+b.Tag, ""); _User = LocalRemote.GetUser("TP"+b.Tag.ToString().ToUpper(), "");
ShowUserInfo(); //AskTask(); ShowUserInfo(); //AskTask();
} }
@ -573,6 +569,7 @@ namespace eDosStation
} }
private void Window_Loaded(object sender, RoutedEventArgs e) private void Window_Loaded(object sender, RoutedEventArgs e)
{ {
LocalRemote.checkCon();
EpdFound = false; EpdFound = false;
initialising = true; initialising = true;
tbEntry.IsSelected = true; tbEntry.IsSelected = true;
@ -590,7 +587,7 @@ namespace eDosStation
cbInst2.IsChecked = Inst2; cbInst2.IsChecked = Inst2;
} }
LocalRemote.FillComment(dtCOE); LocalRemote.FillComment();
string TestCSN = thisStation.TestCSN; string TestCSN = thisStation.TestCSN;
initialising = false; initialising = false;
@ -606,7 +603,7 @@ namespace eDosStation
else else
{ {
////Debug ////Debug
_User = new User(TestCSN, string.Empty); _User = LocalRemote.GetUser(TestCSN, string.Empty);
if (_User.Error > 0) if (_User.Error > 0)
{ {
MessageBox.Show(_User.ErrorMessage, "DB Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); MessageBox.Show(_User.ErrorMessage, "DB Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);

View file

@ -45,14 +45,15 @@
</TabItem> </TabItem>
<TabItem Name="Alarm" Header="Alarm"> <TabItem Name="Alarm" Header="Alarm">
<StackPanel> <StackPanel>
<Border Background="LightYellow" TextBlock.FontSize="24" TextBlock.LineHeight="30px" Padding="20,20,20,20" > <Border Background="LightYellow" TextBlock.FontSize="22" TextBlock.LineHeight="30px" Padding="20,20,20,20" >
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" TextAlignment="Center" > <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" TextAlignment="Center" TextWrapping="Wrap" >
<LineBreak/> <LineBreak/>
<Run>Your dose and/or doserate has been above the alarmlevel</Run> <Run>Your dose and/or doserate has been above the alarmlevel</Run>
<Run>during your visit !</Run> <Run>during your visit !</Run>
<LineBreak/> <LineBreak/>
<Run>Please contact the Radioprotection officer of the building.</Run>>
<LineBreak/> <LineBreak/>
<Run>Please contact</Run><LineBreak/><Run> the Radioprotection officer of the building.</Run>
<LineBreak/><LineBreak/>
<Run>He needs to validate and clear your alarm(s).</Run> <Run>He needs to validate and clear your alarm(s).</Run>
<LineBreak/> <LineBreak/>
</TextBlock> </TextBlock>
@ -65,11 +66,12 @@
<Border Background="LightYellow" TextBlock.FontSize="24" TextBlock.LineHeight="30px" Padding="20,20,20,20" > <Border Background="LightYellow" TextBlock.FontSize="24" TextBlock.LineHeight="30px" Padding="20,20,20,20" >
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" TextAlignment="Center" > <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" TextAlignment="Center" >
<LineBreak/> <LineBreak/>
<Run>Your EPD has encounterd a problem.</Run> <Run>Your EPD has encountered a problem.</Run>
<LineBreak/><LineBreak/>
<Run>Please contact</Run><LineBreak/><Run>the Radioprotection officer of the building.</Run>
<LineBreak/> <LineBreak/>
<Run>Please contact the Radioprotection officer of the building.</Run>
<LineBreak/> <LineBreak/>
<Run> He needs to investigate it.</Run> <Run> He needs to investigate the alarm.</Run>
</TextBlock> </TextBlock>
</Border> </Border>
<Button Content="OK" Height="40" Width="200" Name="bConfirmAlarm2" Click="BConfirmAlarm_Click" /> <Button Content="OK" Height="40" Width="200" Name="bConfirmAlarm2" Click="BConfirmAlarm_Click" />

View file

@ -52,10 +52,10 @@ namespace eDosStation
dispatcherTimer.Interval = new TimeSpan(0, 0, 5); dispatcherTimer.Interval = new TimeSpan(0, 0, 5);
} else } else
{ {
dispatcherTimer.Tick -= DispatcherTimer_Tick; dispatcherTimer.Tick -= DispatcherTimer_IsEPDFound;
dispatcherTimer.Stop(); dispatcherTimer.Stop();
} }
dispatcherTimer.Tick += DispatcherTimer_TickTimeOut; ; dispatcherTimer.Tick += DispatcherTimer_WindowTimeoutAndClose; ;
int rv= ep.GetStatus(); int rv= ep.GetStatus();
if (rv != 1) if (rv != 1)
@ -74,16 +74,19 @@ namespace eDosStation
MessageBox.Show("This EPD is not read", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification); MessageBox.Show("This EPD is not read", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
} }
bool NoTimeout = false;
if (ep.alarmStatus != 0) if (ep.alarmStatus != 0)
{ {
DosePanel.Background = AlarmBrush; DosePanel.Background = AlarmBrush;
Alarm.IsSelected = true; Alarm.IsSelected = true;
NoTimeout = true;
} }
else if ((ep.otherAlarms & 0x7f) != 0) else if ((ep.otherAlarms & 0x7f) != 0)
{ {
DosePanel.Background = AlarmBrush; DosePanel.Background = AlarmBrush;
OtherAlarm.IsSelected = true; OtherAlarm.IsSelected = true;
NoTimeout = true;
} else } else
{ {
DosePanel.Background = GreenBrush; DosePanel.Background = GreenBrush;
@ -128,11 +131,11 @@ namespace eDosStation
} }
l.Dispose(); l.Dispose();
} }
dispatcherTimer.Start(); //Knop hide if (!NoTimeout) dispatcherTimer.Start(); //Knop hide
return; return;
} }
private void DispatcherTimer_TickTimeOut(object sender, EventArgs e) private void DispatcherTimer_WindowTimeoutAndClose(object sender, EventArgs e)
{ {
dispatcherTimer.Stop(); dispatcherTimer.Stop();
this.Close(); this.Close();
@ -156,7 +159,7 @@ namespace eDosStation
statusEPD.Content = $"EPD: Wait "; statusEPD.Content = $"EPD: Wait ";
Search = 100; Search = 100;
dispatcherTimer = new DispatcherTimer(); dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Tick += DispatcherTimer_Tick; dispatcherTimer.Tick += DispatcherTimer_IsEPDFound;
dispatcherTimer.Interval = new TimeSpan(0, 0, 2); dispatcherTimer.Interval = new TimeSpan(0, 0, 2);
dispatcherTimer.Start(); dispatcherTimer.Start();
} }
@ -169,7 +172,7 @@ namespace eDosStation
Dispatcher.InvokeAsync(StartScan); Dispatcher.InvokeAsync(StartScan);
} }
private void DispatcherTimer_Tick(object sender, EventArgs e) private void DispatcherTimer_IsEPDFound(object sender, EventArgs e)
{ {
dispatcherTimer.Stop(); dispatcherTimer.Stop();
EpdFound = false; EpdFound = false;

View file

@ -19,7 +19,9 @@ namespace eDosStation
static public System.Data.SqlClient.SqlCommand VisitInitCommand; static public System.Data.SqlClient.SqlCommand VisitInitCommand;
public static SqlCommand VisitExitCommand; public static SqlCommand VisitExitCommand;
static bool checkCon(bool leaveOpen=false) static public DataSet1.CommentOnEventDataTable dtCOE;
static public bool checkCon(bool leaveOpen = false)
{ {
if (Connection != null && Connection.State == System.Data.ConnectionState.Open) return true; if (Connection != null && Connection.State == System.Data.ConnectionState.Open) return true;
bool rv = false; bool rv = false;
@ -55,16 +57,33 @@ namespace eDosStation
if (rv && !leaveOpen) co?.Close(); if (rv && !leaveOpen) co?.Close();
return rv; return rv;
} }
static void init()
static public void first()
{ {
var cb = new System.Data.SqlClient.SqlConnectionStringBuilder(Properties.Settings.Default.eDosConnectionString);
if (string.IsNullOrEmpty(cb.Password))
{
var f = new AskPwd();
f.ShowDialog();
string pwd = f.ResponseText;
string cfg = System.IO.Path.Combine(Environment.CurrentDirectory, System.AppDomain.CurrentDomain.FriendlyName);
Config.ToggleConfigEncryption(cfg, pwd);
System.Windows.Application.Current.Shutdown();
}
}
static public void init()
{
first();
serverConstr = System.Configuration.ConfigurationManager.ConnectionStrings["eDosStation.Properties.Settings.eDosConnectionString"].ConnectionString; serverConstr = System.Configuration.ConfigurationManager.ConnectionStrings["eDosStation.Properties.Settings.eDosConnectionString"].ConnectionString;
var cb = new System.Data.SqlClient.SqlConnectionStringBuilder(serverConstr); var cb = new System.Data.SqlClient.SqlConnectionStringBuilder(serverConstr);
cb.ConnectTimeout = 5; cb.ConnectTimeout = 5;
serverTestConstr = cb.ConnectionString; serverTestConstr = cb.ConnectionString;
localConstr = System.Configuration.ConfigurationManager.ConnectionStrings["eDosStation.Properties.Settings.eDosConnectionString"].ConnectionString; localConstr = System.Configuration.ConfigurationManager.ConnectionStrings["eDosStation.Properties.Settings.eDosConnectionString"].ConnectionString; //Start met remote
checkCon(false); checkCon(false);
MakeCommands(); MakeCommands();
} }
static void switchLocal() static void switchLocal()
{ {
if (!isLocal) if (!isLocal)
@ -110,54 +129,53 @@ namespace eDosStation
} }
static void MakeCommands () static void MakeCommands()
{ {
VisitInitCommand = new System.Data.SqlClient.SqlCommand("VisitInit", Connection); VisitInitCommand = new System.Data.SqlClient.SqlCommand("VisitInit", Connection);
VisitInitCommand.CommandType = System.Data.CommandType.StoredProcedure; VisitInitCommand.CommandType = System.Data.CommandType.StoredProcedure;
var VisitExitCommand.Parameters["ID_Station", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa); var pa = new System.Data.SqlClient.SqlParameter("ID_Station", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["PersID", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("PersID", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["ID_Task", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("ID_Task", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["Inst_CODE", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("Inst_CODE", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["EPD_InternalID", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("EPD_InternalID", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["isBG", SqlDbType.Bit, 4); VisitInitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("isBG", SqlDbType.Bit, 4); VisitInitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["EPDVisitID", SqlDbType.Int, 4); pa.Direction = ParameterDirection.Output; VisitInitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("EPDVisitID", SqlDbType.Int, 4); pa.Direction = ParameterDirection.Output; VisitInitCommand.Parameters.Add(pa);
VisitExitCommand = new SqlCommand("VisitExit", Connection); VisitExitCommand = new SqlCommand("VisitExit", Connection);
VisitExitCommand.CommandType = CommandType.StoredProcedure; VisitExitCommand.CommandType = CommandType.StoredProcedure;
VisitExitCommand.Parameters["EPDVisitID", SqlDbType.Int, 4); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("EPDVisitID", SqlDbType.Int, 4); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["HP07", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("HP07", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["HP10", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("HP10", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["Hp07Total", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("Hp07Total", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["Hp10Total", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("Hp10Total", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["Hp07Peak", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("Hp07Peak", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["Hp10Peak", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("Hp10Peak", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["HP07PeakTime", SqlDbType.DateTime); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("HP07PeakTime", SqlDbType.DateTime); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["HP10PeakTime", SqlDbType.DateTime); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("HP10PeakTime", SqlDbType.DateTime); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["K1", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("K1", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["K2", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("K2", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["K3", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("K3", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["K4", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("K4", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["K5", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("K5", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["K6", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("K6", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["SG", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("SG", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["BC", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("BC", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["FB", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("FB", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["HG", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("HG", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["QualityData", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("QualityData", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["D1", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("D1", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["D2", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("D2", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["D3", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("D3", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["D4", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("D4", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["alarmStatus", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("alarmStatus", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["otherAlarms", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("otherAlarms", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["errorStatus", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("errorStatus", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
VisitExitCommand.Parameters["operatingStatus", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa); pa = new System.Data.SqlClient.SqlParameter("operatingStatus", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
} }
@ -209,7 +227,7 @@ namespace eDosStation
Connection.Close(); Connection.Close();
} }
static public void FillComment(DataSet1.CommentOnEventDataTable dtCOE) static public void FillComment()
{ {
if (dtCOE == null) dtCOE = new DataSet1.CommentOnEventDataTable(); if (dtCOE == null) dtCOE = new DataSet1.CommentOnEventDataTable();
using (var dt = new DataSet1TableAdapters.CommentOnEventTableAdapter()) using (var dt = new DataSet1TableAdapters.CommentOnEventTableAdapter())
@ -220,6 +238,67 @@ namespace eDosStation
} }
static public DataSet1.CommentOnEventRow GetCommentOnEventRow(int id)
{
return dtCOE.FindByID_CommnentOnEvent(id);
}
static public void FillTaskInfo(User _User, DataSet1 dataSet1)
{
using (var dataSet1GetTaskInfoTableAdapter = new eDosStation.DataSet1TableAdapters.GetTaskInfoTableAdapter())
{
dataSet1GetTaskInfoTableAdapter.Connection.ConnectionString = conStr;
dataSet1GetTaskInfoTableAdapter.Fill(dataSet1.GetTaskInfo, null, _User.Margin);
}
}
static public User GetUser(string CSN, string Code)
{
User u = new User();
object[] Values = null;
using (var cmd = new SqlCommand("GetPersonInfo", Connection))
{
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("csn", CSN);
if (!string.IsNullOrWhiteSpace(Code)) cmd.Parameters.AddWithValue("Badge", Code);
checkCon(true);
var rs = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow);
if (rs.HasRows && rs.Read())
{
Values = new object[rs.FieldCount];
int rv = rs.GetValues(Values);
u.PersID = (int)Values[rs.GetOrdinal("PersID")];
u.LastName = Values[rs.GetOrdinal("LastName")].ToString();
u.FirstName = Values[rs.GetOrdinal("FirstName")].ToString();
u.conCode = Values[rs.GetOrdinal("conCode")].ToString();
u.Language = Values[rs.GetOrdinal("Language")].ToString();
u.AccessAllow = Values[rs.GetOrdinal("AccessAllow")] as bool?;
u.Margin = Values[rs.GetOrdinal("AccessAllow")] as double?;
u.VisitIDLocked = Values[rs.GetOrdinal("VisitIDLocked")] as int?;
u.ReasonNoAccess = Values[rs.GetOrdinal("ReasonNoAccess")].ToString().Replace("\\n", "\n");
u.UserComment = Values[rs.GetOrdinal("Comment")].ToString();
u.AllOk = (u.AccessAllow == true && u.VisitIDLocked == 0);
}
else
{
// Not found
u.PersID = 0;
u.LastName = "Not Found";
u.FirstName = "Not Found";
u.conCode = "A1";
u.Language = "N";
u.AccessAllow = false;
u.Margin = 0;
u.VisitIDLocked = 0;
u.ReasonNoAccess = "Not found";
u.UserComment = "";
u.AllOk = (u.AccessAllow == true & u.VisitIDLocked == 0);
}
}
return u;
}
} }
} }

View file

@ -69,6 +69,7 @@ namespace eDosStation
else else
{ {
bool ok = true; bool ok = true;
LocalRemote.init();
try try
{ {
thisStation = new Station(string.Empty); thisStation = new Station(string.Empty);

View file

@ -25,61 +25,10 @@ namespace eDosStation
public int Error = 0; public int Error = 0;
public string ErrorMessage; public string ErrorMessage;
public User(string CSN, string Code) public User()
{ {
LastName = FirstName = conCode = Language = string.Empty; LastName = FirstName = conCode = Language = string.Empty;
AccessAllow = null; ; AccessAllow = null;
using (var co = new SqlConnection(Properties.Settings.Default.eDosConnectionString))
{
using (var cmd = new SqlCommand("GetPersonInfo", co))
{
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("csn", CSN);
if (!string.IsNullOrWhiteSpace(Code)) cmd.Parameters.AddWithValue("Badge", Code);
co.Open();
try
{
var rs = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow);
if (rs.HasRows && rs.Read())
{
object[] Values = new object[rs.FieldCount];
int rv = rs.GetValues(Values);
PersID = (int)Values[rs.GetOrdinal("PersID")];
LastName = Values[rs.GetOrdinal("LastName")].ToString();
FirstName = Values[rs.GetOrdinal("FirstName")].ToString();
conCode = Values[rs.GetOrdinal("conCode")].ToString();
Language = Values[rs.GetOrdinal("Language")].ToString();
AccessAllow = Values[rs.GetOrdinal("AccessAllow")] as bool?;
Margin = Values[rs.GetOrdinal("AccessAllow")] as double?;
VisitIDLocked = Values[rs.GetOrdinal("VisitIDLocked")] as int?;
ReasonNoAccess = Values[rs.GetOrdinal("ReasonNoAccess")].ToString().Replace("\\n","\n");
UserComment = Values[rs.GetOrdinal("Comment")].ToString();
AllOk = (AccessAllow == true && VisitIDLocked == 0 );
} else
{
// Not found
PersID = 0;
LastName = "Not Found";
FirstName = "Not Found";
conCode = "A1";
Language = "N";
AccessAllow = false;
Margin = 0;
VisitIDLocked = 0;
ReasonNoAccess = "Not found";
UserComment = "";
AllOk = (AccessAllow == true & VisitIDLocked == 0);
}
rs.Close();
}
catch (System.Exception ex)
{
Error = 1;
ErrorMessage = ex.Message;
}
co.Close();
}
}
} }
} }
} }