From 81ab4d634c3bb7de7a6944736a7bac8f38b1823d Mon Sep 17 00:00:00 2001 From: Luc Vandenbroucke Date: Tue, 18 Feb 2020 14:06:52 +0100 Subject: [PATCH] Nieuwe database --- EpdBase/EpdBase.cpp | 76 ++-- EpdBase/EpdBase.h | 2 - EpdBaseClr/EpdBaseClr.cpp | 50 ++- EpdBaseClr/EpdBaseClr.h | 42 ++- eDosStation/App.config | 2 +- eDosStation/DataSet1.Designer.cs | 397 +------------------- eDosStation/DataSet1.xsd | 85 +---- eDosStation/DataSet1.xss | 7 +- eDosStation/Decoder.cs | 55 +++ eDosStation/EntryBadge.xaml.cs | 68 ++-- eDosStation/EpdExit.xaml | 2 +- eDosStation/EpdExit.xaml.cs | 126 ++++--- eDosStation/InstMessage.xaml | 24 ++ eDosStation/InstMessage.xaml.cs | 66 ++++ eDosStation/MainWindow.xaml.cs | 57 ++- eDosStation/Properties/Settings.Designer.cs | 3 +- eDosStation/Properties/Settings.settings | 4 +- eDosStation/ShowEPDDose.xaml | 39 +- eDosStation/ShowEPDDose.xaml.cs | 32 +- eDosStation/SqlLog.cs | 71 ++++ eDosStation/Station.cs | 8 +- eDosStation/eDosStation.csproj | 9 + 22 files changed, 596 insertions(+), 629 deletions(-) create mode 100644 eDosStation/Decoder.cs create mode 100644 eDosStation/InstMessage.xaml create mode 100644 eDosStation/InstMessage.xaml.cs create mode 100644 eDosStation/SqlLog.cs diff --git a/EpdBase/EpdBase.cpp b/EpdBase/EpdBase.cpp index ba4ecfe..c0a7231 100644 --- a/EpdBase/EpdBase.cpp +++ b/EpdBase/EpdBase.cpp @@ -1,8 +1,10 @@ #include "stdafx.h" #include "EpdBase.h" -#define DiscoveryTimeslotPeriod 200 -#define DiscoveryExpirationPeriod 5000 +#define DiscoveryTimeslotPeriod 100 +#define DiscoveryExpirationPeriod 6000 +#define RxRetryCount 5 +#define TxRetryCount 5 EpdBase::Epd2U::Epd2U(int comport) { @@ -15,39 +17,65 @@ EpdBase::Epd2U::Epd2U(int comport) DWORD EpdBase::Epd2U::StartCom() { - Error = 0; - InitRv = InitComms(port, 9600, 8, 0, 0); - if (InitRv == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); - else { - CommsInitialized = 1; - } - return Error; + DWORD rv; + ErrorReason = 0; + + int mx = 10; + 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)); + + 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)); + Sleep(300); DeinitComms(port); + } + else { + SetRetryCounts(RxRetryCount, TxRetryCount); + //SetDiscoveryTimeslotCount(port, 2); + SetDiscoveryTimeslotPeriod(port, DiscoveryTimeslotPeriod); + SetDiscoveryExpirationPeriod(port, DiscoveryExpirationPeriod); + } + } while (InitRv == 0 && mx > 0); + + CommsInitialized = InitRv; + return ErrorReason; } EpdBase::Epd2U::~Epd2U() { DeinitComms(port); + CommsInitialized = 0; } int EpdBase::Epd2U::StartDiscover() { + WORD rv; System::Diagnostics::Trace::WriteLine("StartDiscover"); - FlushBuffers(port); - FlushDiscoveryCache(port); Error = 0; - SetDiscoveryTimeslotCount(port, 2); - SetDiscoveryTimeslotPeriod(port, DiscoveryTimeslotPeriod); - SetDiscoveryExpirationPeriod(port, DiscoveryExpirationPeriod); - int tries = 25; DeviceCount = 0; - while (tries-- > 0 && DeviceCount == 0) + + //SetDiscoveryTimeslotCount(port, 2); + //SetDiscoveryTimeslotPeriod(port, DiscoveryTimeslotPeriod); + //SetDiscoveryExpirationPeriod(port, DiscoveryExpirationPeriod); + + //rv =SetRetryCounts(RxRetryCount, TxRetryCount); + + FlushDiscoveryCache(port); + FlushBuffers(port); + + int tries = 25; DeviceCount = 0; DiscRV = 1; + while (tries-- > 0 && DeviceCount == 0 ) { + //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)); + if (DiscRV ==0 ) { + Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); + System::Diagnostics::Trace::WriteLine(System::String::Format("StartDiscover Error Connect Reason: {0} ErrorData {1}", ErrorReason, ErrorData)); + } } - if (DiscRV != 1) { - Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); - System::Diagnostics::Trace::WriteLine(System::String::Format("StartDiscover Error Connect1: {0}", ErrorReason)); - } + System::Diagnostics::Trace::WriteLine(System::String::Format("Discover DeviceCount = {0}", DeviceCount)); return DiscRV; } @@ -65,7 +93,7 @@ void EpdBase::Epd2U::Open(DWORD DeviceID) void EpdBase::Epd2U::Close() { CloseDevice(); - DeinitComms(port); + //DeinitComms(port); CommsInitialized = 0; } void EpdBase::Epd2U::DecodeFunctionFlags() @@ -119,6 +147,7 @@ WORD EpdBase::Epd2U::ReadStatus() EpdID = HardVersion = SoftVersion = FunctionFlags = 0; CommitRV = ReadEpdStatus(&EpdClock, &RealTime, &IssueCount, &OffTime, &OperatingStatus, &ErrorStatus, &AlarmStatus, &OtherAlarms, &EEPROMBadSectors); + if (CommitRV == 1) CommitRV = Commit(); if (CommitRV == 1) CommitRV = ReadEpdID( &EpdID, &HardVersion, @@ -233,7 +262,6 @@ WORD EpdBase::Epd2U::TurnOn() return 0; } - WORD EpdBase::Epd2U::WriteCal() { @@ -253,7 +281,6 @@ WORD EpdBase::Epd2U::WriteCal() return CommitRV; } - WORD EpdBase::Epd2U::ReadTresHolds() { Hp10THDose1 = Hp10THDose2 = Hp07THDose = 0; @@ -368,7 +395,7 @@ WORD EpdBase::Epd2U::DeIssue() FlushBuffers(port); Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); EndSession(0x5E, 40); return 0; } - //DeinitComms(port); + Close(); return CommitRV; } @@ -410,6 +437,7 @@ WORD EpdBase::Epd2U::Issue() EndSession(0x5E, 40); } + Close(); //DeinitComms(port); return OKRV; diff --git a/EpdBase/EpdBase.h b/EpdBase/EpdBase.h index 7145648..c5f1732 100644 --- a/EpdBase/EpdBase.h +++ b/EpdBase/EpdBase.h @@ -7,8 +7,6 @@ namespace EpdBase { - - class Epd2U { public: diff --git a/EpdBaseClr/EpdBaseClr.cpp b/EpdBaseClr/EpdBaseClr.cpp index ed5b24d..4f1dad5 100644 --- a/EpdBaseClr/EpdBaseClr.cpp +++ b/EpdBaseClr/EpdBaseClr.cpp @@ -8,6 +8,7 @@ EpdBaseClr::Epd2::Epd2(int port) epd = new EpdBase::Epd2U(port); b = gcnew sEpdBase(); this->InitRV = epd->InitRv; + epd->StartCom(); } EpdBaseClr::Epd2::~Epd2() @@ -21,12 +22,12 @@ EpdBaseClr::Epd2::!Epd2() { } -int EpdBaseClr::Epd2::Connect() +int EpdBaseClr::Epd2::Connect(bool reinit) { ConnectError = 0; - epd->StartCom(); + if (epd->CommsInitialized==0) epd->StartCom(); b->CurrentDeviceID = 0; - + DeviceCount = 0; DiscRV = epd->StartDiscover(); if (DiscRV == 1) { @@ -47,6 +48,44 @@ int EpdBaseClr::Epd2::Close() return 0; } +int EpdBaseClr::Epd2::DecodeStatus() +{ + epd->DecodeStatus(); + //OperatingStatus + DetectorsOn = epd->DetectorsOn; + EPDIssued = epd->EPDIssued; + EPDLocked = epd->EPDLocked; + EPDTesting = epd->EPDTesting; + EPDProcSec = epd->EPDProcSec; + EPDFaulty = epd->EPDFaulty; + + EPDNewFault = epd->EPDNewFault; + EPDComFault = epd->EPDComFault; + EPDCalFault = epd->EPDCalFault; + EPDDetFault = epd->EPDDetFault; + EPDEprFault = epd->EPDEprFault; + EPDTrhFault = epd->EPDTrhFault; + EPDOthFault = epd->EPDOthFault; + + AlarmDoseHP101G = epd->AlarmDoseHP101G; + AlarmDoseHP102G = epd->AlarmDoseHP102G; + AlarmDoseHP07N = epd->AlarmDoseHP07N; + AlarmRateHP101G = epd->AlarmRateHP101G; + AlarmRateHP102G = epd->AlarmRateHP102G; + AlarmRateHP07N = epd->AlarmRateHP07N; + + OtherAlarmRateHp101G = epd->OtherAlarmRateHp101G; + OtherAlarmRateHp102G = epd->OtherAlarmRateHp102G; + OtherAlarmRateHp07N = epd->OtherAlarmRateHp07N; + OtherAlarmReturn = epd->OtherAlarmReturn; + OtherAlarmBatLow = epd->OtherAlarmBatLow; + OtherAlarmCarrier = epd->OtherAlarmCarrier; + OtherAlarmBatVolt = epd->OtherAlarmBatVolt; + + return 1; +} + + int EpdBaseClr::Epd2::GetStatus() { GetStatusError = 0; StatusRV = 0; Issued = false; @@ -63,12 +102,17 @@ int EpdBaseClr::Epd2::GetStatus() otherAlarms = epd->OtherAlarms; errorStatus = epd->ErrorStatus; operatingStatus = epd->OperatingStatus; + + + + EpdID = epd->EpdID; HardVersion = epd->HardVersion; SoftVersion = epd->SoftVersion; FunctionFlags = epd->FunctionFlags; + DecodeStatus(); return StatusRV; } diff --git a/EpdBaseClr/EpdBaseClr.h b/EpdBaseClr/EpdBaseClr.h index 5f5c117..5a81ff3 100644 --- a/EpdBaseClr/EpdBaseClr.h +++ b/EpdBaseClr/EpdBaseClr.h @@ -90,15 +90,55 @@ namespace EpdBaseClr { unsigned short BatADC; unsigned short SupplyADC; + + + //OperatingStatus + BYTE DetectorsOn = 0; + BYTE EPDIssued = 0; + BYTE EPDLocked = 0; + BYTE EPDTesting = 0; + BYTE EPDProcSec = 0; + BYTE EPDFaulty = 0; + + + //ERrrostatus + BYTE EPDNewFault = 0; + BYTE EPDComFault = 0; + BYTE EPDCalFault = 0; + BYTE EPDDetFault = 0; + BYTE EPDEprFault = 0; + BYTE EPDTrhFault = 0; + BYTE EPDOthFault = 0; + + + //AlarmStatus + BYTE AlarmDoseHP101G = 0; + BYTE AlarmDoseHP102G = 0; + BYTE AlarmDoseHP07N = 0; + BYTE AlarmRateHP101G = 0; + BYTE AlarmRateHP102G = 0; + BYTE AlarmRateHP07N = 0; + + //OtherAlarm + BYTE OtherAlarmRateHp101G = 0; + BYTE OtherAlarmRateHp102G = 0; + BYTE OtherAlarmRateHp07N = 0; + BYTE OtherAlarmReturn = 0; + BYTE OtherAlarmBatLow = 0; + BYTE OtherAlarmCarrier = 0; + BYTE OtherAlarmBatVolt = 0; + Epd2(int port); ~Epd2(); !Epd2(); - int Connect(); + int Connect(bool reinit); int Close(); + int DecodeStatus(); + int GetStatus(); int GetDoses(); diff --git a/eDosStation/App.config b/eDosStation/App.config index 47240a0..dedbe63 100644 --- a/eDosStation/App.config +++ b/eDosStation/App.config @@ -6,7 +6,7 @@ - diff --git a/eDosStation/DataSet1.Designer.cs b/eDosStation/DataSet1.Designer.cs index 5344fd3..0a05aad 100644 --- a/eDosStation/DataSet1.Designer.cs +++ b/eDosStation/DataSet1.Designer.cs @@ -3354,59 +3354,6 @@ namespace eDosStation.DataSet1TableAdapters { tableMapping.ColumnMappings.Add("Comment_NL", "Comment_NL"); tableMapping.ColumnMappings.Add("Comment_EN", "Comment_EN"); this._adapter.TableMappings.Add(tableMapping); - this._adapter.DeleteCommand = new global::System.Data.SqlClient.SqlCommand(); - this._adapter.DeleteCommand.Connection = this.Connection; - this._adapter.DeleteCommand.CommandText = @"DELETE FROM [HPH_REMS_new].[dbo].[CommentOnEvent] WHERE (([ID_CommnentOnEvent] = @Original_ID_CommnentOnEvent) AND ((@IsNull_TriggerTable = 1 AND [TriggerTable] IS NULL) OR ([TriggerTable] = @Original_TriggerTable)) AND ((@IsNull_TriggerField = 1 AND [TriggerField] IS NULL) OR ([TriggerField] = @Original_TriggerField)) AND ((@IsNull_TriggerStatus = 1 AND [TriggerStatus] IS NULL) OR ([TriggerStatus] = @Original_TriggerStatus)) AND ((@IsNull_Comment_FR = 1 AND [Comment_FR] IS NULL) OR ([Comment_FR] = @Original_Comment_FR)) AND ((@IsNull_Comment_NL = 1 AND [Comment_NL] IS NULL) OR ([Comment_NL] = @Original_Comment_NL)) AND ((@IsNull_Comment_EN = 1 AND [Comment_EN] IS NULL) OR ([Comment_EN] = @Original_Comment_EN)))"; - this._adapter.DeleteCommand.CommandType = global::System.Data.CommandType.Text; - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_ID_CommnentOnEvent", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ID_CommnentOnEvent", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_TriggerTable", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerTable", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_TriggerTable", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerTable", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_TriggerField", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerField", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_TriggerField", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerField", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_TriggerStatus", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerStatus", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_TriggerStatus", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerStatus", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Comment_FR", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_FR", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Comment_FR", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_FR", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Comment_NL", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_NL", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Comment_NL", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_NL", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Comment_EN", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_EN", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); - this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Comment_EN", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_EN", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.InsertCommand = new global::System.Data.SqlClient.SqlCommand(); - this._adapter.InsertCommand.Connection = this.Connection; - this._adapter.InsertCommand.CommandText = @"INSERT INTO [HPH_REMS_new].[dbo].[CommentOnEvent] ([TriggerTable], [TriggerField], [TriggerStatus], [Comment_FR], [Comment_NL], [Comment_EN]) VALUES (@TriggerTable, @TriggerField, @TriggerStatus, @Comment_FR, @Comment_NL, @Comment_EN); -SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR, Comment_NL, Comment_EN FROM CommentOnEvent WHERE (ID_CommnentOnEvent = SCOPE_IDENTITY())"; - this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text; - this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@TriggerTable", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerTable", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@TriggerField", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerField", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@TriggerStatus", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerStatus", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Comment_FR", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_FR", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Comment_NL", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_NL", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Comment_EN", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_EN", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._adapter.UpdateCommand = new global::System.Data.SqlClient.SqlCommand(); - this._adapter.UpdateCommand.Connection = this.Connection; - this._adapter.UpdateCommand.CommandText = @"UPDATE [HPH_REMS_new].[dbo].[CommentOnEvent] SET [TriggerTable] = @TriggerTable, [TriggerField] = @TriggerField, [TriggerStatus] = @TriggerStatus, [Comment_FR] = @Comment_FR, [Comment_NL] = @Comment_NL, [Comment_EN] = @Comment_EN WHERE (([ID_CommnentOnEvent] = @Original_ID_CommnentOnEvent) AND ((@IsNull_TriggerTable = 1 AND [TriggerTable] IS NULL) OR ([TriggerTable] = @Original_TriggerTable)) AND ((@IsNull_TriggerField = 1 AND [TriggerField] IS NULL) OR ([TriggerField] = @Original_TriggerField)) AND ((@IsNull_TriggerStatus = 1 AND [TriggerStatus] IS NULL) OR ([TriggerStatus] = @Original_TriggerStatus)) AND ((@IsNull_Comment_FR = 1 AND [Comment_FR] IS NULL) OR ([Comment_FR] = @Original_Comment_FR)) AND ((@IsNull_Comment_NL = 1 AND [Comment_NL] IS NULL) OR ([Comment_NL] = @Original_Comment_NL)) AND ((@IsNull_Comment_EN = 1 AND [Comment_EN] IS NULL) OR ([Comment_EN] = @Original_Comment_EN))); -SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR, Comment_NL, Comment_EN FROM CommentOnEvent WHERE (ID_CommnentOnEvent = @ID_CommnentOnEvent)"; - this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text; - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@TriggerTable", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerTable", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@TriggerField", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerField", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@TriggerStatus", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerStatus", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Comment_FR", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_FR", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Comment_NL", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_NL", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Comment_EN", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_EN", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_ID_CommnentOnEvent", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "ID_CommnentOnEvent", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_TriggerTable", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerTable", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_TriggerTable", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerTable", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_TriggerField", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerField", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_TriggerField", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerField", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_TriggerStatus", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerStatus", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_TriggerStatus", global::System.Data.SqlDbType.Bit, 0, global::System.Data.ParameterDirection.Input, 0, 0, "TriggerStatus", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Comment_FR", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_FR", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Comment_FR", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_FR", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Comment_NL", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_NL", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Comment_NL", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_NL", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@IsNull_Comment_EN", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_EN", global::System.Data.DataRowVersion.Original, true, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_Comment_EN", global::System.Data.SqlDbType.VarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Comment_EN", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); - this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@ID_CommnentOnEvent", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 0, 0, "ID_CommnentOnEvent", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3422,10 +3369,9 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; - this._commandCollection[0].CommandText = "SELECT [ID_CommnentOnEvent]\r\n ,[TriggerTable]\r\n ,[TriggerField]\r\n " + - ",[TriggerStatus]\r\n ,[Comment_FR]\r\n ,[Comment_NL]\r\n ,[Comment_EN]\r" + - "\n FROM [HPH_REMS_new].[dbo].[CommentOnEvent]"; - this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; + this._commandCollection[0].CommandText = "dbo.CommentOnEventSelect"; + this._commandCollection[0].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[0].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -3451,277 +3397,6 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR this.Adapter.Fill(dataTable); return dataTable; } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] - [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - public virtual int Update(DataSet1.CommentOnEventDataTable dataTable) { - return this.Adapter.Update(dataTable); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] - [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - public virtual int Update(DataSet1 dataSet) { - return this.Adapter.Update(dataSet, "CommentOnEvent"); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] - [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - public virtual int Update(global::System.Data.DataRow dataRow) { - return this.Adapter.Update(new global::System.Data.DataRow[] { - dataRow}); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] - [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - public virtual int Update(global::System.Data.DataRow[] dataRows) { - return this.Adapter.Update(dataRows); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] - [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Delete, true)] - public virtual int Delete(int Original_ID_CommnentOnEvent, string Original_TriggerTable, string Original_TriggerField, global::System.Nullable Original_TriggerStatus, string Original_Comment_FR, string Original_Comment_NL, string Original_Comment_EN) { - this.Adapter.DeleteCommand.Parameters[0].Value = ((int)(Original_ID_CommnentOnEvent)); - if ((Original_TriggerTable == null)) { - this.Adapter.DeleteCommand.Parameters[1].Value = ((object)(1)); - this.Adapter.DeleteCommand.Parameters[2].Value = global::System.DBNull.Value; - } - else { - this.Adapter.DeleteCommand.Parameters[1].Value = ((object)(0)); - this.Adapter.DeleteCommand.Parameters[2].Value = ((string)(Original_TriggerTable)); - } - if ((Original_TriggerField == null)) { - this.Adapter.DeleteCommand.Parameters[3].Value = ((object)(1)); - this.Adapter.DeleteCommand.Parameters[4].Value = global::System.DBNull.Value; - } - else { - this.Adapter.DeleteCommand.Parameters[3].Value = ((object)(0)); - this.Adapter.DeleteCommand.Parameters[4].Value = ((string)(Original_TriggerField)); - } - if ((Original_TriggerStatus.HasValue == true)) { - this.Adapter.DeleteCommand.Parameters[5].Value = ((object)(0)); - this.Adapter.DeleteCommand.Parameters[6].Value = ((bool)(Original_TriggerStatus.Value)); - } - else { - this.Adapter.DeleteCommand.Parameters[5].Value = ((object)(1)); - this.Adapter.DeleteCommand.Parameters[6].Value = global::System.DBNull.Value; - } - if ((Original_Comment_FR == null)) { - this.Adapter.DeleteCommand.Parameters[7].Value = ((object)(1)); - this.Adapter.DeleteCommand.Parameters[8].Value = global::System.DBNull.Value; - } - else { - this.Adapter.DeleteCommand.Parameters[7].Value = ((object)(0)); - this.Adapter.DeleteCommand.Parameters[8].Value = ((string)(Original_Comment_FR)); - } - if ((Original_Comment_NL == null)) { - this.Adapter.DeleteCommand.Parameters[9].Value = ((object)(1)); - this.Adapter.DeleteCommand.Parameters[10].Value = global::System.DBNull.Value; - } - else { - this.Adapter.DeleteCommand.Parameters[9].Value = ((object)(0)); - this.Adapter.DeleteCommand.Parameters[10].Value = ((string)(Original_Comment_NL)); - } - if ((Original_Comment_EN == null)) { - this.Adapter.DeleteCommand.Parameters[11].Value = ((object)(1)); - this.Adapter.DeleteCommand.Parameters[12].Value = global::System.DBNull.Value; - } - else { - this.Adapter.DeleteCommand.Parameters[11].Value = ((object)(0)); - this.Adapter.DeleteCommand.Parameters[12].Value = ((string)(Original_Comment_EN)); - } - global::System.Data.ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State; - if (((this.Adapter.DeleteCommand.Connection.State & global::System.Data.ConnectionState.Open) - != global::System.Data.ConnectionState.Open)) { - this.Adapter.DeleteCommand.Connection.Open(); - } - try { - int returnValue = this.Adapter.DeleteCommand.ExecuteNonQuery(); - return returnValue; - } - finally { - if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { - this.Adapter.DeleteCommand.Connection.Close(); - } - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] - [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)] - public virtual int Insert(string TriggerTable, string TriggerField, global::System.Nullable TriggerStatus, string Comment_FR, string Comment_NL, string Comment_EN) { - if ((TriggerTable == null)) { - this.Adapter.InsertCommand.Parameters[0].Value = global::System.DBNull.Value; - } - else { - this.Adapter.InsertCommand.Parameters[0].Value = ((string)(TriggerTable)); - } - if ((TriggerField == null)) { - this.Adapter.InsertCommand.Parameters[1].Value = global::System.DBNull.Value; - } - else { - this.Adapter.InsertCommand.Parameters[1].Value = ((string)(TriggerField)); - } - if ((TriggerStatus.HasValue == true)) { - this.Adapter.InsertCommand.Parameters[2].Value = ((bool)(TriggerStatus.Value)); - } - else { - this.Adapter.InsertCommand.Parameters[2].Value = global::System.DBNull.Value; - } - if ((Comment_FR == null)) { - this.Adapter.InsertCommand.Parameters[3].Value = global::System.DBNull.Value; - } - else { - this.Adapter.InsertCommand.Parameters[3].Value = ((string)(Comment_FR)); - } - if ((Comment_NL == null)) { - this.Adapter.InsertCommand.Parameters[4].Value = global::System.DBNull.Value; - } - else { - this.Adapter.InsertCommand.Parameters[4].Value = ((string)(Comment_NL)); - } - if ((Comment_EN == null)) { - this.Adapter.InsertCommand.Parameters[5].Value = global::System.DBNull.Value; - } - else { - this.Adapter.InsertCommand.Parameters[5].Value = ((string)(Comment_EN)); - } - global::System.Data.ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State; - if (((this.Adapter.InsertCommand.Connection.State & global::System.Data.ConnectionState.Open) - != global::System.Data.ConnectionState.Open)) { - this.Adapter.InsertCommand.Connection.Open(); - } - try { - int returnValue = this.Adapter.InsertCommand.ExecuteNonQuery(); - return returnValue; - } - finally { - if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { - this.Adapter.InsertCommand.Connection.Close(); - } - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] - [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)] - public virtual int Update(string TriggerTable, string TriggerField, global::System.Nullable TriggerStatus, string Comment_FR, string Comment_NL, string Comment_EN, int Original_ID_CommnentOnEvent, string Original_TriggerTable, string Original_TriggerField, global::System.Nullable Original_TriggerStatus, string Original_Comment_FR, string Original_Comment_NL, string Original_Comment_EN, int ID_CommnentOnEvent) { - if ((TriggerTable == null)) { - this.Adapter.UpdateCommand.Parameters[0].Value = global::System.DBNull.Value; - } - else { - this.Adapter.UpdateCommand.Parameters[0].Value = ((string)(TriggerTable)); - } - if ((TriggerField == null)) { - this.Adapter.UpdateCommand.Parameters[1].Value = global::System.DBNull.Value; - } - else { - this.Adapter.UpdateCommand.Parameters[1].Value = ((string)(TriggerField)); - } - if ((TriggerStatus.HasValue == true)) { - this.Adapter.UpdateCommand.Parameters[2].Value = ((bool)(TriggerStatus.Value)); - } - else { - this.Adapter.UpdateCommand.Parameters[2].Value = global::System.DBNull.Value; - } - if ((Comment_FR == null)) { - this.Adapter.UpdateCommand.Parameters[3].Value = global::System.DBNull.Value; - } - else { - this.Adapter.UpdateCommand.Parameters[3].Value = ((string)(Comment_FR)); - } - if ((Comment_NL == null)) { - this.Adapter.UpdateCommand.Parameters[4].Value = global::System.DBNull.Value; - } - else { - this.Adapter.UpdateCommand.Parameters[4].Value = ((string)(Comment_NL)); - } - if ((Comment_EN == null)) { - this.Adapter.UpdateCommand.Parameters[5].Value = global::System.DBNull.Value; - } - else { - this.Adapter.UpdateCommand.Parameters[5].Value = ((string)(Comment_EN)); - } - this.Adapter.UpdateCommand.Parameters[6].Value = ((int)(Original_ID_CommnentOnEvent)); - if ((Original_TriggerTable == null)) { - this.Adapter.UpdateCommand.Parameters[7].Value = ((object)(1)); - this.Adapter.UpdateCommand.Parameters[8].Value = global::System.DBNull.Value; - } - else { - this.Adapter.UpdateCommand.Parameters[7].Value = ((object)(0)); - this.Adapter.UpdateCommand.Parameters[8].Value = ((string)(Original_TriggerTable)); - } - if ((Original_TriggerField == null)) { - this.Adapter.UpdateCommand.Parameters[9].Value = ((object)(1)); - this.Adapter.UpdateCommand.Parameters[10].Value = global::System.DBNull.Value; - } - else { - this.Adapter.UpdateCommand.Parameters[9].Value = ((object)(0)); - this.Adapter.UpdateCommand.Parameters[10].Value = ((string)(Original_TriggerField)); - } - if ((Original_TriggerStatus.HasValue == true)) { - this.Adapter.UpdateCommand.Parameters[11].Value = ((object)(0)); - this.Adapter.UpdateCommand.Parameters[12].Value = ((bool)(Original_TriggerStatus.Value)); - } - else { - this.Adapter.UpdateCommand.Parameters[11].Value = ((object)(1)); - this.Adapter.UpdateCommand.Parameters[12].Value = global::System.DBNull.Value; - } - if ((Original_Comment_FR == null)) { - this.Adapter.UpdateCommand.Parameters[13].Value = ((object)(1)); - this.Adapter.UpdateCommand.Parameters[14].Value = global::System.DBNull.Value; - } - else { - this.Adapter.UpdateCommand.Parameters[13].Value = ((object)(0)); - this.Adapter.UpdateCommand.Parameters[14].Value = ((string)(Original_Comment_FR)); - } - if ((Original_Comment_NL == null)) { - this.Adapter.UpdateCommand.Parameters[15].Value = ((object)(1)); - this.Adapter.UpdateCommand.Parameters[16].Value = global::System.DBNull.Value; - } - else { - this.Adapter.UpdateCommand.Parameters[15].Value = ((object)(0)); - this.Adapter.UpdateCommand.Parameters[16].Value = ((string)(Original_Comment_NL)); - } - if ((Original_Comment_EN == null)) { - this.Adapter.UpdateCommand.Parameters[17].Value = ((object)(1)); - this.Adapter.UpdateCommand.Parameters[18].Value = global::System.DBNull.Value; - } - else { - this.Adapter.UpdateCommand.Parameters[17].Value = ((object)(0)); - this.Adapter.UpdateCommand.Parameters[18].Value = ((string)(Original_Comment_EN)); - } - this.Adapter.UpdateCommand.Parameters[19].Value = ((int)(ID_CommnentOnEvent)); - global::System.Data.ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State; - if (((this.Adapter.UpdateCommand.Connection.State & global::System.Data.ConnectionState.Open) - != global::System.Data.ConnectionState.Open)) { - this.Adapter.UpdateCommand.Connection.Open(); - } - try { - int returnValue = this.Adapter.UpdateCommand.ExecuteNonQuery(); - return returnValue; - } - finally { - if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) { - this.Adapter.UpdateCommand.Connection.Close(); - } - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] - [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] - [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Update, true)] - public virtual int Update(string TriggerTable, string TriggerField, global::System.Nullable TriggerStatus, string Comment_FR, string Comment_NL, string Comment_EN, int Original_ID_CommnentOnEvent, string Original_TriggerTable, string Original_TriggerField, global::System.Nullable Original_TriggerStatus, string Original_Comment_FR, string Original_Comment_NL, string Original_Comment_EN) { - return this.Update(TriggerTable, TriggerField, TriggerStatus, Comment_FR, Comment_NL, Comment_EN, Original_ID_CommnentOnEvent, Original_TriggerTable, Original_TriggerField, Original_TriggerStatus, Original_Comment_FR, Original_Comment_NL, Original_Comment_EN, Original_ID_CommnentOnEvent); - } } /// @@ -3736,8 +3411,6 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR private UpdateOrderOption _updateOrder; - private CommentOnEventTableAdapter _commentOnEventTableAdapter; - private bool _backupDataSetBeforeUpdate; private global::System.Data.IDbConnection _connection; @@ -3753,20 +3426,6 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR } } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] - [global::System.ComponentModel.EditorAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterManagerPropertyEditor, Microso" + - "ft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3" + - "a", "System.Drawing.Design.UITypeEditor")] - public CommentOnEventTableAdapter CommentOnEventTableAdapter { - get { - return this._commentOnEventTableAdapter; - } - set { - this._commentOnEventTableAdapter = value; - } - } - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] public bool BackupDataSetBeforeUpdate { @@ -3786,10 +3445,6 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR if ((this._connection != null)) { return this._connection; } - if (((this._commentOnEventTableAdapter != null) - && (this._commentOnEventTableAdapter.Connection != null))) { - return this._commentOnEventTableAdapter.Connection; - } return null; } set { @@ -3803,9 +3458,6 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR public int TableAdapterInstanceCount { get { int count = 0; - if ((this._commentOnEventTableAdapter != null)) { - count = (count + 1); - } return count; } } @@ -3817,15 +3469,6 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] private int UpdateUpdatedRows(DataSet1 dataSet, global::System.Collections.Generic.List allChangedRows, global::System.Collections.Generic.List allAddedRows) { int result = 0; - if ((this._commentOnEventTableAdapter != null)) { - global::System.Data.DataRow[] updatedRows = dataSet.CommentOnEvent.Select(null, null, global::System.Data.DataViewRowState.ModifiedCurrent); - updatedRows = this.GetRealUpdatedRows(updatedRows, allAddedRows); - if (((updatedRows != null) - && (0 < updatedRows.Length))) { - result = (result + this._commentOnEventTableAdapter.Update(updatedRows)); - allChangedRows.AddRange(updatedRows); - } - } return result; } @@ -3836,14 +3479,6 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] private int UpdateInsertedRows(DataSet1 dataSet, global::System.Collections.Generic.List allAddedRows) { int result = 0; - if ((this._commentOnEventTableAdapter != null)) { - global::System.Data.DataRow[] addedRows = dataSet.CommentOnEvent.Select(null, null, global::System.Data.DataViewRowState.Added); - if (((addedRows != null) - && (0 < addedRows.Length))) { - result = (result + this._commentOnEventTableAdapter.Update(addedRows)); - allAddedRows.AddRange(addedRows); - } - } return result; } @@ -3854,14 +3489,6 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")] private int UpdateDeletedRows(DataSet1 dataSet, global::System.Collections.Generic.List allChangedRows) { int result = 0; - if ((this._commentOnEventTableAdapter != null)) { - global::System.Data.DataRow[] deletedRows = dataSet.CommentOnEvent.Select(null, null, global::System.Data.DataViewRowState.Deleted); - if (((deletedRows != null) - && (0 < deletedRows.Length))) { - result = (result + this._commentOnEventTableAdapter.Update(deletedRows)); - allChangedRows.AddRange(deletedRows); - } - } return result; } @@ -3901,11 +3528,6 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR if ((dataSet.HasChanges() == false)) { return 0; } - if (((this._commentOnEventTableAdapter != null) - && (this.MatchTableAdapterConnection(this._commentOnEventTableAdapter.Connection) == false))) { - throw new global::System.ArgumentException("All TableAdapters managed by a TableAdapterManager must use the same connection s" + - "tring."); - } global::System.Data.IDbConnection workConnection = this.Connection; if ((workConnection == null)) { throw new global::System.ApplicationException("TableAdapterManager contains no connection information. Set each TableAdapterMana" + @@ -3938,15 +3560,6 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR try { // ---- Prepare for update ----------- // - if ((this._commentOnEventTableAdapter != null)) { - revertConnections.Add(this._commentOnEventTableAdapter, this._commentOnEventTableAdapter.Connection); - this._commentOnEventTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(workConnection)); - this._commentOnEventTableAdapter.Transaction = ((global::System.Data.SqlClient.SqlTransaction)(workTransaction)); - if (this._commentOnEventTableAdapter.Adapter.AcceptChangesDuringUpdate) { - this._commentOnEventTableAdapter.Adapter.AcceptChangesDuringUpdate = false; - adaptersWithAcceptChangesDuringUpdate.Add(this._commentOnEventTableAdapter.Adapter); - } - } // //---- Perform updates ----------- // @@ -4005,10 +3618,6 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR if (workConnOpened) { workConnection.Close(); } - if ((this._commentOnEventTableAdapter != null)) { - this._commentOnEventTableAdapter.Connection = ((global::System.Data.SqlClient.SqlConnection)(revertConnections[this._commentOnEventTableAdapter])); - this._commentOnEventTableAdapter.Transaction = null; - } if ((0 < adaptersWithAcceptChangesDuringUpdate.Count)) { global::System.Data.Common.DataAdapter[] adapters = new System.Data.Common.DataAdapter[adaptersWithAcceptChangesDuringUpdate.Count]; adaptersWithAcceptChangesDuringUpdate.CopyTo(adapters); diff --git a/eDosStation/DataSet1.xsd b/eDosStation/DataSet1.xsd index 92efef9..4419845 100644 --- a/eDosStation/DataSet1.xsd +++ b/eDosStation/DataSet1.xsd @@ -77,82 +77,15 @@ - - - - DELETE FROM [HPH_REMS_new].[dbo].[CommentOnEvent] WHERE (([ID_CommnentOnEvent] = @Original_ID_CommnentOnEvent) AND ((@IsNull_TriggerTable = 1 AND [TriggerTable] IS NULL) OR ([TriggerTable] = @Original_TriggerTable)) AND ((@IsNull_TriggerField = 1 AND [TriggerField] IS NULL) OR ([TriggerField] = @Original_TriggerField)) AND ((@IsNull_TriggerStatus = 1 AND [TriggerStatus] IS NULL) OR ([TriggerStatus] = @Original_TriggerStatus)) AND ((@IsNull_Comment_FR = 1 AND [Comment_FR] IS NULL) OR ([Comment_FR] = @Original_Comment_FR)) AND ((@IsNull_Comment_NL = 1 AND [Comment_NL] IS NULL) OR ([Comment_NL] = @Original_Comment_NL)) AND ((@IsNull_Comment_EN = 1 AND [Comment_EN] IS NULL) OR ([Comment_EN] = @Original_Comment_EN))) - - - - - - - - - - - - - - - - - - - - INSERT INTO [HPH_REMS_new].[dbo].[CommentOnEvent] ([TriggerTable], [TriggerField], [TriggerStatus], [Comment_FR], [Comment_NL], [Comment_EN]) VALUES (@TriggerTable, @TriggerField, @TriggerStatus, @Comment_FR, @Comment_NL, @Comment_EN); -SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR, Comment_NL, Comment_EN FROM CommentOnEvent WHERE (ID_CommnentOnEvent = SCOPE_IDENTITY()) - - - - - - - - - - + - - SELECT [ID_CommnentOnEvent] - ,[TriggerTable] - ,[TriggerField] - ,[TriggerStatus] - ,[Comment_FR] - ,[Comment_NL] - ,[Comment_EN] - FROM [HPH_REMS_new].[dbo].[CommentOnEvent] - + + dbo.CommentOnEventSelect + + + - - - UPDATE [HPH_REMS_new].[dbo].[CommentOnEvent] SET [TriggerTable] = @TriggerTable, [TriggerField] = @TriggerField, [TriggerStatus] = @TriggerStatus, [Comment_FR] = @Comment_FR, [Comment_NL] = @Comment_NL, [Comment_EN] = @Comment_EN WHERE (([ID_CommnentOnEvent] = @Original_ID_CommnentOnEvent) AND ((@IsNull_TriggerTable = 1 AND [TriggerTable] IS NULL) OR ([TriggerTable] = @Original_TriggerTable)) AND ((@IsNull_TriggerField = 1 AND [TriggerField] IS NULL) OR ([TriggerField] = @Original_TriggerField)) AND ((@IsNull_TriggerStatus = 1 AND [TriggerStatus] IS NULL) OR ([TriggerStatus] = @Original_TriggerStatus)) AND ((@IsNull_Comment_FR = 1 AND [Comment_FR] IS NULL) OR ([Comment_FR] = @Original_Comment_FR)) AND ((@IsNull_Comment_NL = 1 AND [Comment_NL] IS NULL) OR ([Comment_NL] = @Original_Comment_NL)) AND ((@IsNull_Comment_EN = 1 AND [Comment_EN] IS NULL) OR ([Comment_EN] = @Original_Comment_EN))); -SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR, Comment_NL, Comment_EN FROM CommentOnEvent WHERE (ID_CommnentOnEvent = @ID_CommnentOnEvent) - - - - - - - - - - - - - - - - - - - - - - - - @@ -174,7 +107,7 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR - + @@ -204,7 +137,7 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR - + @@ -266,7 +199,7 @@ SELECT ID_CommnentOnEvent, TriggerTable, TriggerField, TriggerStatus, Comment_FR - + diff --git a/eDosStation/DataSet1.xss b/eDosStation/DataSet1.xss index e88812e..370619c 100644 --- a/eDosStation/DataSet1.xss +++ b/eDosStation/DataSet1.xss @@ -4,10 +4,11 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. --> - + - - + + + \ No newline at end of file diff --git a/eDosStation/Decoder.cs b/eDosStation/Decoder.cs new file mode 100644 index 0000000..54879c5 --- /dev/null +++ b/eDosStation/Decoder.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; + +namespace eDosStation +{ + static class Decoder + { + static StackPanel sp; + + + private static void tb_Add( string s) + { + TextBlock x = new TextBlock(); + x.Text = s; + sp.Children.Add(x); + } + public static void AlarmToTextBox(StackPanel s,EpdBaseClr.Epd2 ep) + { + sp = s; + if (ep.DetectorsOn > 0) tb_Add("DetectorsOn"); + if (ep.EPDIssued > 0) tb_Add("EPD Issued"); + if (ep.EPDLocked > 0) tb_Add("EPD Locked"); + if (ep.EPDTesting > 0) tb_Add("EPD Detector test active"); + if (ep.EPDProcSec > 0) tb_Add("EPD Processing every second"); + if (ep.EPDFaulty > 0) tb_Add("EPD Faulty"); + + if (ep.EPDNewFault > 0) tb_Add("EPD New Fault in History"); + if (ep.EPDComFault > 0) tb_Add("EPD Communication fault"); + if (ep.EPDCalFault > 0) tb_Add("EPD Calibration factors faulty"); + if (ep.EPDDetFault > 0) tb_Add("EPD Detector faulty"); + if (ep.EPDEprFault > 0) tb_Add("EPD Eprom faulty"); + if (ep.EPDTrhFault > 0) tb_Add("EPD Tresholds faulty"); + if (ep.EPDOthFault > 0) tb_Add("EPD Other Fault"); + + if (ep.AlarmDoseHP101G > 0) tb_Add("Alarm Dose HP10"); + if (ep.AlarmDoseHP102G > 0) tb_Add("Alarm Dose HP10"); + if (ep.AlarmDoseHP07N > 0) tb_Add("Alarm Dose HP07"); + if (ep.AlarmRateHP101G > 0) tb_Add("Alarm RateHP10 "); + if (ep.AlarmRateHP102G > 0) tb_Add("Alarm RateHP10 "); + if (ep.AlarmRateHP07N > 0) tb_Add("Alarm Rate HP07"); + + if (ep.OtherAlarmRateHp101G > 0) tb_Add("Alarm Rate Hp10 /G"); + if (ep.OtherAlarmRateHp102G > 0) tb_Add("Alarm Rate Hp10 /G"); + if (ep.OtherAlarmRateHp07N > 0) tb_Add("Alarm Rate Hp07 /HPN"); + if (ep.OtherAlarmReturn > 0) tb_Add("Please Return"); + if (ep.OtherAlarmBatLow > 0) tb_Add("Battery Low"); + if (ep.OtherAlarmCarrier > 0) tb_Add("Carrier present"); + if (ep.OtherAlarmBatVolt > 0) tb_Add("Battery Volt"); + } + } +} diff --git a/eDosStation/EntryBadge.xaml.cs b/eDosStation/EntryBadge.xaml.cs index f07ba73..657a506 100644 --- a/eDosStation/EntryBadge.xaml.cs +++ b/eDosStation/EntryBadge.xaml.cs @@ -62,12 +62,24 @@ namespace eDosStation MessageBox.Show($"Entry GetStatus error {rva} {ep.GetStatusError}"); } System.Diagnostics.Debug.WriteLine($"LoadDoses: EPD {ep.EpdID} Type:{ep.epdType}"); + statusEPD.Text = $"EPD: {ep.EpdID}"; if (ep.Issued) { MessageBox.Show("EPD is currently issued\nPlease take an other", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification); this.Close(); return false; } + if (ep.alarmStatus != 0 || (ep.otherAlarms & 0x7f)!=0) + { + StringBuilder sb = new StringBuilder("EPD is in alarm status\n\n"); + if (ep.alarmStatus>0) sb.AppendLine("- Alarm dose"); + if (ep.OtherAlarmBatLow > 0) sb.AppendLine("- Battery Low"); + sb.AppendLine(); + sb.AppendLine("Please take another"); + MessageBox.Show(sb.ToString(), "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification); + this.Close(); + return false; + } bool isBG = (ep.epdType == 0); if (isBG != CurTaskRow.EPDRad.Equals("BG")) { @@ -75,7 +87,7 @@ namespace eDosStation this.Close(); return false; } - statusEPD.Text = $"EPD: {ep.EpdID}"; + rva = ep.ReadTresholds(); if (rva != 1) { @@ -91,7 +103,7 @@ namespace eDosStation dispatcherTimer.Stop(); ep.Close(); System.Threading.Thread.Sleep(200); - int rv= ep.Connect(); + int rv= ep.Connect(false); System.Diagnostics.Debug.WriteLine($"Connect {rv} error {ep.ConnectError}"); if (ep.DeviceCount >0 && ep.b.CurrentDeviceID>0) { @@ -118,31 +130,32 @@ namespace eDosStation if (LoadDoses()) { bool isBG = (ep.epdType != 3); //3 = zwarte 0=grijs - int? VisitID = null; + int? StationVisitID = null; using (var co = new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.RemoteSQL)) { using (var cmd1 = new SqlCommand("VisitInit", co)) { cmd1.CommandType = CommandType.StoredProcedure; - var pa = new SqlParameter("PersID", SqlDbType.Int, 4); pa.Value = _User.PersID; cmd1.Parameters.Add(pa); + var pa = new SqlParameter("ID_Station", SqlDbType.Int, 4); pa.Value = thisStation.ID_Station; cmd1.Parameters.Add(pa); + pa = new SqlParameter("PersID", SqlDbType.Int, 4); pa.Value = _User.PersID; cmd1.Parameters.Add(pa); pa = new SqlParameter("ID_Task", SqlDbType.Int, 4); pa.Value = CurTaskRow.ID_Task; cmd1.Parameters.Add(pa); pa = new SqlParameter("Inst_CODE", SqlDbType.Int, 4); pa.Value = CurTaskRow.Inst_CODE; cmd1.Parameters.Add(pa); pa = new SqlParameter("EPD_InternalID", SqlDbType.Int, 4); pa.Value = (int)ep.EpdID; cmd1.Parameters.Add(pa); pa = new SqlParameter("isBG", SqlDbType.Bit, 4); pa.Value = isBG; cmd1.Parameters.Add(pa); - pa = new SqlParameter("ID_Visit", SqlDbType.Int, 4); pa.Direction = ParameterDirection.Output; cmd1.Parameters.Add(pa); + pa = new SqlParameter("EPDVisitID", SqlDbType.Int, 4); pa.Direction = ParameterDirection.Output; cmd1.Parameters.Add(pa); co.Open(); cmd1.ExecuteNonQuery(); - VisitID = (int?)cmd1.Parameters["ID_Visit"].Value; + StationVisitID = (int?)cmd1.Parameters["EPDVisitID"].Value; co.Close(); } } - int rv= ep.PrepareForIssue(); + int rv = ep.PrepareForIssue(); if (rv != 1) { MessageBox.Show($"PrepareForIssue error {ep.PrepareForIssueError}"); } - ep.WearerID = VisitID.ToString(); + ep.WearerID = StationVisitID.ToString(); ep.WearerName = _User.PersID.ToString(); ep.Hp07RateOn = CurTaskRow.HP07RateON; @@ -195,12 +208,14 @@ namespace eDosStation } bEpdDone.Visibility = Visibility.Visible; } + else + ep.Close(); } private void GetEPD() { if (_User == null || CurTaskRow == null) return; - int ok = ep.Connect(); + int ok = ep.Connect(false); if (ok != 1) System.Diagnostics.Debug.WriteLine($"GetEpd {ok} ConnectError: {ep.ConnectError}"); if (ep.DeviceCount == 1 && ep.b.CurrentDeviceID>0) { @@ -287,6 +302,7 @@ namespace eDosStation if (_User.PersID == 0) { tReasonNoAccess.Text = getCommentUnknown(); + if (_User.Error > 0) tReasonNoAccess.Text = _User.ErrorMessage; tbNotAllowed.IsSelected = true; doCancel = true; } @@ -385,39 +401,6 @@ namespace eDosStation this.Dispatcher.Invoke(new Action(() => showBadge())); StopReadBadge = true; } - // 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())); - // StopReadBadge = true; - // } - // 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())); - // StopReadBadge = true; - // } - // 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}"); @@ -549,6 +532,7 @@ namespace eDosStation { t = null; a = null; + ep.Close(); //t.Abort(); } diff --git a/eDosStation/EpdExit.xaml b/eDosStation/EpdExit.xaml index ff3cb53..eb28d50 100644 --- a/eDosStation/EpdExit.xaml +++ b/eDosStation/EpdExit.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:eDosStation" mc:Ignorable="d" - Title="Exit" Height="450" Width="800" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen"> + Title="Exit" Height="450" Width="800" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen" Closing="Window_Closing"> diff --git a/eDosStation/EpdExit.xaml.cs b/eDosStation/EpdExit.xaml.cs index f4d75ce..10a0b12 100644 --- a/eDosStation/EpdExit.xaml.cs +++ b/eDosStation/EpdExit.xaml.cs @@ -55,7 +55,7 @@ namespace eDosStation dispatcherTimer.Tick -= DispatcherTimer_Tick; dispatcherTimer.Stop(); } - dispatcherTimer.Tick += DispatcherTimer_TickTO; ; + dispatcherTimer.Tick += DispatcherTimer_TickTimeOut; ; int rv= ep.GetStatus(); if (rv != 1) @@ -100,73 +100,88 @@ namespace eDosStation rv = ep.GetDoses(); if (rv != 1) { - MessageBox.Show($"GetDoses {rv} er:{ep.GetDosesError}"); + rv = ep.GetDoses(); //try again + if (rv != 1) + MessageBox.Show($"GetDoses {rv} er:{ep.GetDosesError}"); } + HpDose07.Text = $"Hp07: {ep.Hp07: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 EpdVisitID)) + { bool isBG = (ep.epdType == 3); - using (var co = new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.RemoteSQL)) + rv = ep.SetDeIssued(); //includes close + if (rv != 1) { - using (var cmd1 = new SqlCommand("VisitExit", co)) + MessageBox.Show($"DeIssueerror {rv}"); + } + + + var l = new SqlLog(); + try + { + using (var co = new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.RemoteSQL)) { - cmd1.CommandType = CommandType.StoredProcedure; - var pa = new SqlParameter("ID_Visit", SqlDbType.Int, 4); pa.Value = VisitID; cmd1.Parameters.Add(pa); - pa = new SqlParameter("HP07", SqlDbType.Float); pa.Value = ep.Hp07; cmd1.Parameters.Add(pa); - pa = new SqlParameter("HP10", SqlDbType.Float); pa.Value = ep.Hp10; cmd1.Parameters.Add(pa); + using (var cmd1 = new SqlCommand("VisitExit", co)) + { + cmd1.CommandType = CommandType.StoredProcedure; + var pa = new SqlParameter("EPDVisitID", SqlDbType.Int, 4); pa.Value = EpdVisitID; cmd1.Parameters.Add(pa); + pa = new SqlParameter("HP07", SqlDbType.Float); pa.Value = ep.Hp07; cmd1.Parameters.Add(pa); + pa = new SqlParameter("HP10", SqlDbType.Float); pa.Value = ep.Hp10; cmd1.Parameters.Add(pa); - pa = new SqlParameter("Hp07Total", SqlDbType.Float); pa.Value = ep.Hp07Total; cmd1.Parameters.Add(pa); - pa = new SqlParameter("Hp10Total", SqlDbType.Float); pa.Value = ep.Hp10Total; cmd1.Parameters.Add(pa); - //pa = new SqlParameter("Hp07Rate", SqlDbType.Float); pa.Value = ep.Hp07Rate; cmd1.Parameters.Add(pa); - //pa = new SqlParameter("Hp10Rate", SqlDbType.Float); pa.Value = ep.Hp10Rate; cmd1.Parameters.Add(pa); + pa = new SqlParameter("Hp07Total", SqlDbType.Float); pa.Value = ep.Hp07Total; cmd1.Parameters.Add(pa); + pa = new SqlParameter("Hp10Total", SqlDbType.Float); pa.Value = ep.Hp10Total; cmd1.Parameters.Add(pa); + //pa = new SqlParameter("Hp07Rate", SqlDbType.Float); pa.Value = ep.Hp07Rate; cmd1.Parameters.Add(pa); + //pa = new SqlParameter("Hp10Rate", SqlDbType.Float); pa.Value = ep.Hp10Rate; cmd1.Parameters.Add(pa); - pa = new SqlParameter("Hp07Peak", SqlDbType.Float); pa.Value = ep.Hp07Peak; cmd1.Parameters.Add(pa); - pa = new SqlParameter("Hp10Peak", SqlDbType.Float); pa.Value = ep.Hp10Peak; cmd1.Parameters.Add(pa); - pa = new SqlParameter("HP07PeakTime", SqlDbType.DateTime); cmd1.Parameters.Add(pa); - if (ep.Hp07PeakTime != null) pa.Value = ep.Hp07PeakTime; else pa.Value = DBNull.Value; - pa = new SqlParameter("HP10PeakTime", SqlDbType.DateTime); cmd1.Parameters.Add(pa); - if (ep.Hp10PeakTime != null) pa.Value = ep.Hp10PeakTime; else pa.Value = DBNull.Value; - pa = new SqlParameter("K1", SqlDbType.Int); pa.Value = ep.K1; cmd1.Parameters.Add(pa); - pa = new SqlParameter("K2", SqlDbType.Int); pa.Value = ep.K2; cmd1.Parameters.Add(pa); - pa = new SqlParameter("K3", SqlDbType.Int); pa.Value = ep.K3; cmd1.Parameters.Add(pa); - pa = new SqlParameter("K4", SqlDbType.Int); pa.Value = ep.K4; cmd1.Parameters.Add(pa); - pa = new SqlParameter("K5", SqlDbType.Int); pa.Value = ep.K5; cmd1.Parameters.Add(pa); - pa = new SqlParameter("K6", SqlDbType.Int); pa.Value = ep.K6; cmd1.Parameters.Add(pa); - pa = new SqlParameter("SG", SqlDbType.Int); pa.Value = ep.SG; cmd1.Parameters.Add(pa); - pa = new SqlParameter("BC", SqlDbType.Int); pa.Value = ep.BC; cmd1.Parameters.Add(pa); - pa = new SqlParameter("FB", SqlDbType.Int); pa.Value = ep.FB; cmd1.Parameters.Add(pa); - pa = new SqlParameter("HG", SqlDbType.Int); pa.Value = ep.HG; cmd1.Parameters.Add(pa); + pa = new SqlParameter("Hp07Peak", SqlDbType.Float); pa.Value = ep.Hp07Peak; cmd1.Parameters.Add(pa); + pa = new SqlParameter("Hp10Peak", SqlDbType.Float); pa.Value = ep.Hp10Peak; cmd1.Parameters.Add(pa); + pa = new SqlParameter("HP07PeakTime", SqlDbType.DateTime); cmd1.Parameters.Add(pa); + if (ep.Hp07PeakTime != null) pa.Value = ep.Hp07PeakTime; else pa.Value = DBNull.Value; + pa = new SqlParameter("HP10PeakTime", SqlDbType.DateTime); cmd1.Parameters.Add(pa); + if (ep.Hp10PeakTime != null) pa.Value = ep.Hp10PeakTime; else pa.Value = DBNull.Value; + pa = new SqlParameter("K1", SqlDbType.Int); pa.Value = ep.K1; cmd1.Parameters.Add(pa); + pa = new SqlParameter("K2", SqlDbType.Int); pa.Value = ep.K2; cmd1.Parameters.Add(pa); + pa = new SqlParameter("K3", SqlDbType.Int); pa.Value = ep.K3; cmd1.Parameters.Add(pa); + pa = new SqlParameter("K4", SqlDbType.Int); pa.Value = ep.K4; cmd1.Parameters.Add(pa); + pa = new SqlParameter("K5", SqlDbType.Int); pa.Value = ep.K5; cmd1.Parameters.Add(pa); + pa = new SqlParameter("K6", SqlDbType.Int); pa.Value = ep.K6; cmd1.Parameters.Add(pa); + pa = new SqlParameter("SG", SqlDbType.Int); pa.Value = ep.SG; cmd1.Parameters.Add(pa); + pa = new SqlParameter("BC", SqlDbType.Int); pa.Value = ep.BC; cmd1.Parameters.Add(pa); + pa = new SqlParameter("FB", SqlDbType.Int); pa.Value = ep.FB; cmd1.Parameters.Add(pa); + pa = new SqlParameter("HG", SqlDbType.Int); pa.Value = ep.HG; cmd1.Parameters.Add(pa); - pa = new SqlParameter("QualityData", SqlDbType.Int); pa.Value = ep.QualityData; cmd1.Parameters.Add(pa); + pa = new SqlParameter("QualityData", SqlDbType.Int); pa.Value = ep.QualityData; cmd1.Parameters.Add(pa); - pa = new SqlParameter("D1", SqlDbType.Int); pa.Value = ep.D1; cmd1.Parameters.Add(pa); - pa = new SqlParameter("D2", SqlDbType.Int); pa.Value = ep.D2; 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("D1", SqlDbType.Int); pa.Value = ep.D1; cmd1.Parameters.Add(pa); + pa = new SqlParameter("D2", SqlDbType.Int); pa.Value = ep.D2; 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("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("errorStatus", SqlDbType.Int); pa.Value = ep.errorStatus; cmd1.Parameters.Add(pa); - pa = new SqlParameter("operatingStatus", SqlDbType.Int); pa.Value = ep.operatingStatus; 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("errorStatus", SqlDbType.Int); pa.Value = ep.errorStatus; cmd1.Parameters.Add(pa); + pa = new SqlParameter("operatingStatus", SqlDbType.Int); pa.Value = ep.operatingStatus; cmd1.Parameters.Add(pa); - co.Open(); - cmd1.ExecuteNonQuery(); - co.Close(); + l.LogCommand(cmd1); + co.Open(); + cmd1.ExecuteNonQuery(); + co.Close(); + } } } + catch (System.Exception ex) + { + l.LogCommand(ex.Message); + MessageBox.Show(ex.Message); + } + l.Dispose(); } - - rv= ep.SetDeIssued(); - if (rv!=1) - { - MessageBox.Show($"DeIssueerror {rv}"); - } - dispatcherTimer.Start(); //Knop hide return; } - private void DispatcherTimer_TickTO(object sender, EventArgs e) + private void DispatcherTimer_TickTimeOut(object sender, EventArgs e) { dispatcherTimer.Stop(); this.Close(); @@ -177,9 +192,9 @@ namespace eDosStation { EpdFound = false; //ep = new EpdBaseClr.Epd2(thisStation.ComPort); - int rv = ep.Connect(); + int rv = ep.Connect(false); System.Diagnostics.Debug.WriteLine($"Connect {rv} error {ep.ConnectError}"); - if (ep.DeviceCount >0 && ep.b.CurrentDeviceID>0) + if (rv==1 && ep.DeviceCount >0 && ep.b.CurrentDeviceID>0) { EpdFound = true; statusEPD.Content = $"StartScan : EPD: {ep.b.CurrentDeviceID}"; @@ -207,7 +222,8 @@ namespace eDosStation { dispatcherTimer.Stop(); EpdFound = false; - int rv = ep.Connect(); + + int rv = ep.Connect(false); if (rv==1 && ep.DeviceCount > 0 && ep.b.CurrentDeviceID>0) { EpdFound = true; @@ -236,5 +252,11 @@ namespace eDosStation { this.Close(); } + + private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + if (dispatcherTimer?.IsEnabled == true) dispatcherTimer.IsEnabled = false; + dispatcherTimer = null; + } } } diff --git a/eDosStation/InstMessage.xaml b/eDosStation/InstMessage.xaml new file mode 100644 index 0000000..d6867f6 --- /dev/null +++ b/eDosStation/InstMessage.xaml @@ -0,0 +1,24 @@ + + + + + + +