ReasonNoAccess

This commit is contained in:
Luc Vandenbroucke 2019-09-02 09:16:58 +02:00
parent 3f5d860602
commit 4dceb5ce01
2 changed files with 29 additions and 9 deletions

View file

@ -100,10 +100,8 @@ namespace eDosStation
statusEPD.Text = $"Search Timeout"; statusEPD.Text = $"Search Timeout";
} }
} }
} }
private void DoEPD() private void DoEPD()
{ {
if (LoadDoses()) if (LoadDoses())
@ -237,12 +235,17 @@ namespace eDosStation
if (_User == null || _User.VisitIDLocked == true || _User.AccessAllow == false) if (_User == null || _User.VisitIDLocked == true || _User.AccessAllow == false)
{ {
tbNotAllowed.IsSelected = true; tbNotAllowed.IsSelected = true;
if (_User.VisitIDLocked == true) tReasonNoAccess.Text = "Alarm status not cleared"; if (_User.VisitIDLocked == true || _User.AccessAllow == false) tReasonNoAccess.Text = _User.ReasonNoAccess;
else if (_User.AccessAllow == false) tReasonNoAccess.Text = "Access not allowed";
else tReasonNoAccess.Text = "No identification"; else tReasonNoAccess.Text = "No identification";
} }
else else
{ {
if (!string.IsNullOrEmpty(_User.UserComment))
{
MessageBox.Show(_User.UserComment, "Comment", MessageBoxButton.OK, MessageBoxImage.Asterisk);
}
eDosStation.DataSet1 dataSet1 = ((eDosStation.DataSet1)(this.FindResource("dataSet1"))); eDosStation.DataSet1 dataSet1 = ((eDosStation.DataSet1)(this.FindResource("dataSet1")));
using (var dataSet1GetTaskInfoTableAdapter = new eDosStation.DataSet1TableAdapters.GetTaskInfoTableAdapter()) using (var dataSet1GetTaskInfoTableAdapter = new eDosStation.DataSet1TableAdapters.GetTaskInfoTableAdapter())
{ {
@ -257,10 +260,13 @@ namespace eDosStation
void CheckBadge() void CheckBadge()
{ {
_User = new User(CSN.Text, Code.Text); _User = new User(CSN.Text, Code.Text);
if (_User.AccessAllow == true) if (_User.Error==0)
AskTask(); AskTask();
else else
{
MessageBox.Show(_User.ErrorMessage);
Close(); Close();
}
} }
public void showBadge() public void showBadge()
{ {
@ -352,8 +358,14 @@ namespace eDosStation
System.Windows.Data.CollectionViewSource getTaskListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("getTaskListViewSource"))); System.Windows.Data.CollectionViewSource getTaskListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("getTaskListViewSource")));
var rv = getTaskListViewSource.View.CurrentItem as DataRowView; var rv = getTaskListViewSource.View.CurrentItem as DataRowView;
CurTaskRow = rv.Row as DataSet1.GetTaskInfoRow; CurTaskRow = rv.Row as DataSet1.GetTaskInfoRow;
if (CurTaskRow.MinWorkerDosisMargin > _User.Margin)
GetEPD(); {
MessageBox.Show("Margin exeeded");
}
else
{
GetEPD();
}
} }
} }
@ -490,7 +502,7 @@ namespace eDosStation
MessageBox.Show(_User.ErrorMessage, "DB Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); MessageBox.Show(_User.ErrorMessage, "DB Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
} else { } else {
Dispatcher.InvokeAsync(AskTask); Dispatcher.InvokeAsync(AskTask);
} }
} }
} }
} }

View file

@ -20,6 +20,12 @@ namespace eDosStation
public bool? VisitIDLocked {get;set; } public bool? VisitIDLocked {get;set; }
public string ReasonNoAccess { get; set; }
public string UserComment { get; set; }
public bool AllOk = false;
public int Error = 0; public int Error = 0;
public string ErrorMessage; public string ErrorMessage;
@ -50,7 +56,9 @@ namespace eDosStation
AccessAllow = Values[rs.GetOrdinal("AccessAllow")] as bool?; AccessAllow = Values[rs.GetOrdinal("AccessAllow")] as bool?;
Margin = Values[rs.GetOrdinal("AccessAllow")] as double?; Margin = Values[rs.GetOrdinal("AccessAllow")] as double?;
VisitIDLocked = Values[rs.GetOrdinal("VisitIDLocked")] as bool?; 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(); rs.Close();
} catch(System.Exception ex) } catch(System.Exception ex)