From 4dceb5ce01cf73d9ed3d5ba686774e5b0ed59272 Mon Sep 17 00:00:00 2001 From: Luc Vandenbroucke Date: Mon, 2 Sep 2019 09:16:58 +0200 Subject: [PATCH] ReasonNoAccess --- eDosStation/EntryBadge.xaml.cs | 28 ++++++++++++++++++++-------- eDosStation/User.cs | 10 +++++++++- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/eDosStation/EntryBadge.xaml.cs b/eDosStation/EntryBadge.xaml.cs index 363fbff..99db6b3 100644 --- a/eDosStation/EntryBadge.xaml.cs +++ b/eDosStation/EntryBadge.xaml.cs @@ -100,10 +100,8 @@ namespace eDosStation statusEPD.Text = $"Search Timeout"; } } - } - private void DoEPD() { if (LoadDoses()) @@ -237,12 +235,17 @@ namespace eDosStation if (_User == null || _User.VisitIDLocked == true || _User.AccessAllow == false) { tbNotAllowed.IsSelected = true; - if (_User.VisitIDLocked == true) tReasonNoAccess.Text = "Alarm status not cleared"; - else if (_User.AccessAllow == false) tReasonNoAccess.Text = "Access not allowed"; + if (_User.VisitIDLocked == true || _User.AccessAllow == false) tReasonNoAccess.Text = _User.ReasonNoAccess; else tReasonNoAccess.Text = "No identification"; } else { + + if (!string.IsNullOrEmpty(_User.UserComment)) + { + MessageBox.Show(_User.UserComment, "Comment", MessageBoxButton.OK, MessageBoxImage.Asterisk); + } + eDosStation.DataSet1 dataSet1 = ((eDosStation.DataSet1)(this.FindResource("dataSet1"))); using (var dataSet1GetTaskInfoTableAdapter = new eDosStation.DataSet1TableAdapters.GetTaskInfoTableAdapter()) { @@ -257,10 +260,13 @@ namespace eDosStation void CheckBadge() { _User = new User(CSN.Text, Code.Text); - if (_User.AccessAllow == true) + if (_User.Error==0) AskTask(); else + { + MessageBox.Show(_User.ErrorMessage); Close(); + } } public void showBadge() { @@ -352,8 +358,14 @@ namespace eDosStation System.Windows.Data.CollectionViewSource getTaskListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("getTaskListViewSource"))); var rv = getTaskListViewSource.View.CurrentItem as DataRowView; CurTaskRow = rv.Row as DataSet1.GetTaskInfoRow; - - GetEPD(); + if (CurTaskRow.MinWorkerDosisMargin > _User.Margin) + { + MessageBox.Show("Margin exeeded"); + } + else + { + GetEPD(); + } } } @@ -490,7 +502,7 @@ namespace eDosStation MessageBox.Show(_User.ErrorMessage, "DB Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } else { Dispatcher.InvokeAsync(AskTask); - } + } } } } diff --git a/eDosStation/User.cs b/eDosStation/User.cs index fe68237..f65a938 100644 --- a/eDosStation/User.cs +++ b/eDosStation/User.cs @@ -20,6 +20,12 @@ namespace eDosStation public bool? VisitIDLocked {get;set; } + public string ReasonNoAccess { get; set; } + + public string UserComment { get; set; } + + public bool AllOk = false; + public int Error = 0; public string ErrorMessage; @@ -50,7 +56,9 @@ namespace eDosStation AccessAllow = Values[rs.GetOrdinal("AccessAllow")] as bool?; Margin = Values[rs.GetOrdinal("AccessAllow")] as double?; VisitIDLocked = Values[rs.GetOrdinal("VisitIDLocked")] as bool?; - + ReasonNoAccess = Values[rs.GetOrdinal("ReasonNoAccess")].ToString(); + UserComment = Values[rs.GetOrdinal("Comment")].ToString(); + AllOk = (AccessAllow == true & VisitIDLocked == true); } rs.Close(); } catch(System.Exception ex)