diff --git a/EpdBase/EpdBase.cpp b/EpdBase/EpdBase.cpp
index ae9fb5e..2d15ec0 100644
--- a/EpdBase/EpdBase.cpp
+++ b/EpdBase/EpdBase.cpp
@@ -6,7 +6,7 @@
#define RxRetryCount 5
#define TxRetryCount 5
-
+#pragma unmanaged
EpdBase::Epd2U::Epd2U(int comport)
{
port = comport;
@@ -30,11 +30,11 @@ DWORD EpdBase::Epd2U::StartCom()
if (CommsInitialized==0)
do {
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) {
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);
}
else {
@@ -58,7 +58,7 @@ EpdBase::Epd2U::~Epd2U()
int EpdBase::Epd2U::StartDiscover()
{
WORD rv;
- System::Diagnostics::Trace::WriteLine("StartDiscover");
+ //System::Diagnostics::Trace::WriteLine("StartDiscover");
Error = 0;
//SetDiscoveryTimeslotCount(port, 2);
@@ -75,13 +75,13 @@ int EpdBase::Epd2U::StartDiscover()
{
//memset(DeviceIDs, 0, sizeof(DeviceIDs));
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 ) {
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;
}
@@ -379,16 +379,14 @@ WORD EpdBase::Epd2U::PrepareForIssue()
WORD EpdBase::Epd2U::DeIssue()
{
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 = ClearTotalDose();
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 = Commit();
if (CommitRV && DetectorsOn) {
diff --git a/EpdBase/EpdBase.vcxproj b/EpdBase/EpdBase.vcxproj
index 033330a..c346332 100644
--- a/EpdBase/EpdBase.vcxproj
+++ b/EpdBase/EpdBase.vcxproj
@@ -24,34 +24,34 @@
v4.7.2
ManagedCProj
EpdBase
- 10.0.17763.0
+ 10.0
StaticLibrary
true
- v141
+ v142
true
Unicode
StaticLibrary
false
- v141
+ v142
true
Unicode
StaticLibrary
true
- v141
+ v142
true
Unicode
StaticLibrary
false
- v141
+ v142
true
Unicode
diff --git a/EpdBase/TimeFunctions.cpp b/EpdBase/TimeFunctions.cpp
index b31212f..0ca6217 100644
--- a/EpdBase/TimeFunctions.cpp
+++ b/EpdBase/TimeFunctions.cpp
@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "TimeFunctions.h"
+#pragma unmanaged
TimeFunctions::TimeFunctions()
{
diff --git a/EpdBaseClr/EpdBaseClr.cpp b/EpdBaseClr/EpdBaseClr.cpp
index 4f1dad5..89f18d4 100644
--- a/EpdBaseClr/EpdBaseClr.cpp
+++ b/EpdBaseClr/EpdBaseClr.cpp
@@ -103,10 +103,6 @@ int EpdBaseClr::Epd2::GetStatus()
errorStatus = epd->ErrorStatus;
operatingStatus = epd->OperatingStatus;
-
-
-
-
EpdID = epd->EpdID;
HardVersion = epd->HardVersion;
SoftVersion = epd->SoftVersion;
diff --git a/EpdBaseClr/EpdBaseClr.vcxproj b/EpdBaseClr/EpdBaseClr.vcxproj
index 0db116d..533a29a 100644
--- a/EpdBaseClr/EpdBaseClr.vcxproj
+++ b/EpdBaseClr/EpdBaseClr.vcxproj
@@ -24,34 +24,34 @@
v4.7.2
ManagedCProj
EpdBaseClr
- 10.0.17763.0
+ 10.0
DynamicLibrary
true
- v141
+ v142
true
Unicode
DynamicLibrary
false
- v141
+ v142
true
Unicode
DynamicLibrary
true
- v141
+ v142
true
Unicode
DynamicLibrary
false
- v141
+ v142
true
Unicode
diff --git a/OkReadBadge/OkReadBadge.h b/OkReadBadge/OkReadBadge.h
index 34ed36f..3eaf36b 100644
--- a/OkReadBadge/OkReadBadge.h
+++ b/OkReadBadge/OkReadBadge.h
@@ -11,8 +11,7 @@
namespace OkReadBadge
{
-
- public class BadgeUnmanaged
+ public class BadgeUnmanaged
{
private:
@@ -35,7 +34,6 @@ namespace OkReadBadge
char CSN[50];
char Site[20];
char Badge[20];
-
int parse(char *rall)
{
diff --git a/OkReadBadge/OkReadBadge.vcxproj b/OkReadBadge/OkReadBadge.vcxproj
index f81c810..dded5c1 100644
--- a/OkReadBadge/OkReadBadge.vcxproj
+++ b/OkReadBadge/OkReadBadge.vcxproj
@@ -23,35 +23,35 @@
{F98F3496-8A4C-4BDB-9F17-C7AF47A60739}
ManagedCProj
OkReadBadge
- 10.0.16299.0
+ 10.0
4.7.2
DynamicLibrary
true
- v141
+ v142
true
Unicode
DynamicLibrary
false
- v141
+ v142
true
Unicode
DynamicLibrary
true
- v141
+ v142
true
Unicode
DynamicLibrary
false
- v141
+ v142
true
Unicode
diff --git a/TestDirect/TestDirect.vcxproj b/TestDirect/TestDirect.vcxproj
index 42f82d9..c9e3646 100644
--- a/TestDirect/TestDirect.vcxproj
+++ b/TestDirect/TestDirect.vcxproj
@@ -23,32 +23,32 @@
{3655B312-F7C2-4825-BD5F-E087F6AF2D90}
Win32Proj
TestDirect
- 10.0.16299.0
+ 10.0
Application
true
- v141
+ v142
Unicode
Application
false
- v141
+ v142
true
Unicode
Application
true
- v141
+ v142
Unicode
Application
false
- v141
+ v142
true
Unicode
diff --git a/TestEdosBase/TestEdosBase.vcxproj b/TestEdosBase/TestEdosBase.vcxproj
index fac2a13..668084a 100644
--- a/TestEdosBase/TestEdosBase.vcxproj
+++ b/TestEdosBase/TestEdosBase.vcxproj
@@ -23,32 +23,32 @@
{7B3DD1C5-D8D0-408C-A272-FF5E4A30DF24}
Win32Proj
TestEdosBase
- 10.0.16299.0
+ 10.0
Application
true
- v141
+ v142
Unicode
Application
false
- v141
+ v142
true
Unicode
Application
true
- v141
+ v142
Unicode
Application
false
- v141
+ v142
true
Unicode
diff --git a/eDosStation/EntryBadge.xaml b/eDosStation/EntryBadge.xaml
index 8039e48..646afa3 100644
--- a/eDosStation/EntryBadge.xaml
+++ b/eDosStation/EntryBadge.xaml
@@ -20,11 +20,17 @@
-
+
-
-
-
+
+
+ Welcome to eDOS
+
+ Entry Process is ready
+
+ Please scan your badge on the badge reader
+
+
diff --git a/eDosStation/EntryBadge.xaml.cs b/eDosStation/EntryBadge.xaml.cs
index 0144c6c..55635bd 100644
--- a/eDosStation/EntryBadge.xaml.cs
+++ b/eDosStation/EntryBadge.xaml.cs
@@ -41,7 +41,6 @@ namespace eDosStation
string csn, site, code;
static User _User;
- DataSet1.CommentOnEventDataTable dtCOE;
DataSet1.GetTaskInfoRow CurTaskRow;
enum eCOE { quiz=1} ;
private bool StopReadBadge=true;
@@ -258,7 +257,7 @@ namespace eDosStation
public string getCommentUnknown()
{
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("---");
res.AppendLine(r.Comment_FR).Replace("\\n", "\n");
@@ -272,7 +271,7 @@ namespace eDosStation
{
string res=string.Empty;
if (!string.IsNullOrWhiteSpace(prefix)) res = prefix + "\n";
- DataSet1.CommentOnEventRow r = dtCOE.FindByID_CommnentOnEvent(id);
+ var r = LocalRemote.GetCommentOnEventRow(id);
string l = _User?.Language ?? "E";
if (r!=null)
@@ -351,17 +350,14 @@ namespace eDosStation
{
Naam.Text = _User.FirstName + " " + _User.LastName;
eDosStation.DataSet1 dataSet1 = ((eDosStation.DataSet1)(this.FindResource("dataSet1")));
- using (var dataSet1GetTaskInfoTableAdapter = new eDosStation.DataSet1TableAdapters.GetTaskInfoTableAdapter())
- {
- dataSet1GetTaskInfoTableAdapter.Fill(dataSet1.GetTaskInfo, null, _User.Margin);
- }
+ LocalRemote.FillTaskInfo(_User, dataSet1);
tbTask.IsSelected = true;
bool isAlara = (cbAlara.IsChecked == true);
SetFilter(isAlara);
}
void CheckBadge()
{
- _User = new User(CSN.Text, Code.Text);
+ _User = LocalRemote.GetUser(CSN.Text, Code.Text);
ShowUserInfo(); //AskTask();
}
public void showBadge()
@@ -516,7 +512,7 @@ namespace eDosStation
private void BTestPerson_Click(object sender, RoutedEventArgs e)
{
Button b = sender as Button;
- _User = new User("TP"+b.Tag, "");
+ _User = LocalRemote.GetUser("TP"+b.Tag.ToString().ToUpper(), "");
ShowUserInfo(); //AskTask();
}
@@ -573,6 +569,7 @@ namespace eDosStation
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
+ LocalRemote.checkCon();
EpdFound = false;
initialising = true;
tbEntry.IsSelected = true;
@@ -590,7 +587,7 @@ namespace eDosStation
cbInst2.IsChecked = Inst2;
}
- LocalRemote.FillComment(dtCOE);
+ LocalRemote.FillComment();
string TestCSN = thisStation.TestCSN;
initialising = false;
@@ -606,7 +603,7 @@ namespace eDosStation
else
{
////Debug
- _User = new User(TestCSN, string.Empty);
+ _User = LocalRemote.GetUser(TestCSN, string.Empty);
if (_User.Error > 0)
{
MessageBox.Show(_User.ErrorMessage, "DB Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
diff --git a/eDosStation/EpdExit.xaml b/eDosStation/EpdExit.xaml
index eb28d50..d7396ac 100644
--- a/eDosStation/EpdExit.xaml
+++ b/eDosStation/EpdExit.xaml
@@ -45,14 +45,15 @@
-
-
+
+
Your dose and/or doserate has been above the alarmlevel
during your visit !
- Please contact the Radioprotection officer of the building.>
+ Please contact the Radioprotection officer of the building.
+
He needs to validate and clear your alarm(s).
@@ -65,11 +66,12 @@
- Your EPD has encounterd a problem.
+ Your EPD has encountered a problem.
+
+ Please contactthe Radioprotection officer of the building.
- Please contact the Radioprotection officer of the building.
-
- He needs to investigate it’.
+
+ He needs to investigate the alarm.
diff --git a/eDosStation/EpdExit.xaml.cs b/eDosStation/EpdExit.xaml.cs
index 1264009..42160c9 100644
--- a/eDosStation/EpdExit.xaml.cs
+++ b/eDosStation/EpdExit.xaml.cs
@@ -52,10 +52,10 @@ namespace eDosStation
dispatcherTimer.Interval = new TimeSpan(0, 0, 5);
} else
{
- dispatcherTimer.Tick -= DispatcherTimer_Tick;
+ dispatcherTimer.Tick -= DispatcherTimer_IsEPDFound;
dispatcherTimer.Stop();
}
- dispatcherTimer.Tick += DispatcherTimer_TickTimeOut; ;
+ dispatcherTimer.Tick += DispatcherTimer_WindowTimeoutAndClose; ;
int rv= ep.GetStatus();
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);
}
+ bool NoTimeout = false;
if (ep.alarmStatus != 0)
{
DosePanel.Background = AlarmBrush;
Alarm.IsSelected = true;
+ NoTimeout = true;
}
else if ((ep.otherAlarms & 0x7f) != 0)
{
DosePanel.Background = AlarmBrush;
OtherAlarm.IsSelected = true;
+ NoTimeout = true;
} else
{
DosePanel.Background = GreenBrush;
@@ -128,11 +131,11 @@ namespace eDosStation
}
l.Dispose();
}
- dispatcherTimer.Start(); //Knop hide
+ if (!NoTimeout) dispatcherTimer.Start(); //Knop hide
return;
}
- private void DispatcherTimer_TickTimeOut(object sender, EventArgs e)
+ private void DispatcherTimer_WindowTimeoutAndClose(object sender, EventArgs e)
{
dispatcherTimer.Stop();
this.Close();
@@ -156,7 +159,7 @@ namespace eDosStation
statusEPD.Content = $"EPD: Wait ";
Search = 100;
dispatcherTimer = new DispatcherTimer();
- dispatcherTimer.Tick += DispatcherTimer_Tick;
+ dispatcherTimer.Tick += DispatcherTimer_IsEPDFound;
dispatcherTimer.Interval = new TimeSpan(0, 0, 2);
dispatcherTimer.Start();
}
@@ -169,7 +172,7 @@ namespace eDosStation
Dispatcher.InvokeAsync(StartScan);
}
- private void DispatcherTimer_Tick(object sender, EventArgs e)
+ private void DispatcherTimer_IsEPDFound(object sender, EventArgs e)
{
dispatcherTimer.Stop();
EpdFound = false;
diff --git a/eDosStation/LocalRemote.cs b/eDosStation/LocalRemote.cs
index 3ef350e..5abd659 100644
--- a/eDosStation/LocalRemote.cs
+++ b/eDosStation/LocalRemote.cs
@@ -17,9 +17,11 @@ namespace eDosStation
static public string conStr;
static public System.Data.SqlClient.SqlConnection Connection;
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;
bool rv = false;
@@ -41,30 +43,47 @@ namespace eDosStation
rv = true;
}
if (!rv)
- try
- {
- co.Open();
+ try
+ {
+ co.Open();
isLocal = true;
conStr = localConstr;
rv = true;
- }
- catch
- {
- co = null; co.Dispose();
- }
+ }
+ catch
+ {
+ co = null; co.Dispose();
+ }
if (rv && !leaveOpen) co?.Close();
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;
var cb = new System.Data.SqlClient.SqlConnectionStringBuilder(serverConstr);
cb.ConnectTimeout = 5;
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);
MakeCommands();
}
+
static void switchLocal()
{
if (!isLocal)
@@ -107,57 +126,56 @@ namespace eDosStation
{
checkCon(true);
return Connection;
- }
+ }
- static void MakeCommands ()
+ static void MakeCommands()
{
VisitInitCommand = new System.Data.SqlClient.SqlCommand("VisitInit", Connection);
VisitInitCommand.CommandType = System.Data.CommandType.StoredProcedure;
- var VisitExitCommand.Parameters["ID_Station", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["PersID", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["ID_Task", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["Inst_CODE", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["EPD_InternalID", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["isBG", SqlDbType.Bit, 4); VisitInitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["EPDVisitID", SqlDbType.Int, 4); pa.Direction = ParameterDirection.Output; VisitInitCommand.Parameters.Add(pa);
-
+ var pa = new System.Data.SqlClient.SqlParameter("ID_Station", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("PersID", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("ID_Task", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("Inst_CODE", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("EPD_InternalID", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("isBG", SqlDbType.Bit, 4); 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.CommandType = CommandType.StoredProcedure;
- VisitExitCommand.Parameters["EPDVisitID", SqlDbType.Int, 4); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["HP07", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["HP10", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("EPDVisitID", SqlDbType.Int, 4); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("HP07", 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);
- VisitExitCommand.Parameters["Hp10Total", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("Hp07Total", 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);
- VisitExitCommand.Parameters["Hp10Peak", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["HP07PeakTime", SqlDbType.DateTime); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["HP10PeakTime", SqlDbType.DateTime); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["K1", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["K2", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["K3", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["K4", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["K5", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["K6", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["SG", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["BC", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["FB", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["HG", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("Hp07Peak", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("Hp10Peak", SqlDbType.Float); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("HP07PeakTime", SqlDbType.DateTime); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("HP10PeakTime", SqlDbType.DateTime); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("K1", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("K2", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("K3", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("K4", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("K5", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("K6", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("SG", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("BC", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("FB", 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);
- VisitExitCommand.Parameters["D2", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["D3", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["D4", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("D1", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("D2", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("D3", 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);
- VisitExitCommand.Parameters["otherAlarms", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["errorStatus", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
- VisitExitCommand.Parameters["operatingStatus", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("alarmStatus", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("otherAlarms", SqlDbType.Int); VisitExitCommand.Parameters.Add(pa);
+ pa = new System.Data.SqlClient.SqlParameter("errorStatus", 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();
}
- static public void FillComment(DataSet1.CommentOnEventDataTable dtCOE)
+ static public void FillComment()
{
if (dtCOE == null) dtCOE = new DataSet1.CommentOnEventDataTable();
using (var dt = new DataSet1TableAdapters.CommentOnEventTableAdapter())
@@ -217,9 +235,70 @@ namespace eDosStation
dt.Connection.ConnectionString = conStr;
dt.Fill(dtCOE);
}
-
- }
-
+ }
+
+ 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;
+ }
+
+
}
}
diff --git a/eDosStation/MainWindow.xaml.cs b/eDosStation/MainWindow.xaml.cs
index d119096..2b0ee4b 100644
--- a/eDosStation/MainWindow.xaml.cs
+++ b/eDosStation/MainWindow.xaml.cs
@@ -69,6 +69,7 @@ namespace eDosStation
else
{
bool ok = true;
+ LocalRemote.init();
try
{
thisStation = new Station(string.Empty);
diff --git a/eDosStation/User.cs b/eDosStation/User.cs
index 7c695b1..5350d7f 100644
--- a/eDosStation/User.cs
+++ b/eDosStation/User.cs
@@ -25,61 +25,10 @@ namespace eDosStation
public int Error = 0;
public string ErrorMessage;
- public User(string CSN, string Code)
+ public User()
{
LastName = FirstName = conCode = Language = string.Empty;
- 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();
- }
- }
+ AccessAllow = null;
}
}
}