stability

This commit is contained in:
Luc 2021-04-28 11:48:31 +02:00
parent 984343d84b
commit ef5ab74270
5 changed files with 34 additions and 9 deletions

View file

@ -19,6 +19,7 @@ namespace eDosStation
public static SqlCommand VisitExitCommand;
public static SqlCommand NextIDCommand;
public static SqlCommand LastIDCommand;
public static SqlCommand CheckStatus;
public DataSet1.CommentOnEventDataTable dtCOE;
public static int? NextID()
@ -83,6 +84,19 @@ namespace eDosStation
ID_Station = curIDStation;
LastIDCommand.Parameters["ID_Station"].Value = curIDStation;
VisitInitCommand.Parameters["ID_Station"].Value = curIDStation;
CheckStatus.Parameters["ID_Station"].Value = curIDStation;
}
public bool isOnline()
{
bool? online = false;
if (checkCon(true))
{
online = CheckStatus.ExecuteScalar() as bool?;
if (!online.HasValue) online = false;
}
isLocal = !online.Value;
return online.Value;
}
static public void first()
@ -161,6 +175,10 @@ namespace eDosStation
LastIDCommand.CommandType = CommandType.StoredProcedure;
var pa = new System.Data.SqlClient.SqlParameter("ID_Station", SqlDbType.Int, 4); LastIDCommand.Parameters.Add(pa);
CheckStatus = new SqlCommand("[syncLoc].[SyncStatusIsOK]",localConnection);
CheckStatus.CommandType = CommandType.StoredProcedure;
pa = new System.Data.SqlClient.SqlParameter("ID_Station", SqlDbType.Int, 4); CheckStatus.Parameters.Add(pa);
VisitInitCommand = new System.Data.SqlClient.SqlCommand("VisitInit", localConnection);
VisitInitCommand.CommandType = System.Data.CommandType.StoredProcedure;
pa = new System.Data.SqlClient.SqlParameter("ID_Station", SqlDbType.Int, 4); VisitInitCommand.Parameters.Add(pa);
@ -294,8 +312,9 @@ namespace eDosStation
using (var cmd = new SqlCommand("GetPersonInfo", localConnection))
{
cmd.CommandType = System.Data.CommandType.StoredProcedure;
if (int.TryParse(Code, out int PersID) ) cmd.Parameters.AddWithValue("PersID", PersID);
else cmd.Parameters.AddWithValue("csn", CSN);
if (int.TryParse(Code, out int PersID) ) cmd.Parameters.AddWithValue("PersID", PersID);
if (!string.IsNullOrEmpty(CSN)) cmd.Parameters.AddWithValue("csn", CSN);
//if (!string.IsNullOrWhiteSpace(Code)) cmd.Parameters.AddWithValue("Badge", Code);
checkCon(true);
cmd.Connection = localConnection;

View file

@ -302,6 +302,11 @@ namespace eDosStation
}
return res.Replace("\\n","\n");
}
/// <summary>
/// Get User data
/// </summary>
/// <returns>doCancel</returns>
bool ShowUserInfo()
{
bool doCancel = false;
@ -375,7 +380,7 @@ namespace eDosStation
void CheckBadge()
{
_User = dataInterface.GetUser(CSN.Text, Code.Text);
if (!ShowUserInfo()) endPage();
if (ShowUserInfo()) endPage();
}
public void showBadge(int persID, string csn)
{
@ -387,6 +392,7 @@ namespace eDosStation
public void endPage()
{
dfReader.Dispose();
this.Close();
}
@ -620,7 +626,6 @@ namespace eDosStation
{
if (e.PersID > 0)
{
Sender.WaitEnd();
this.Dispatcher.Invoke(new Action(() => showBadge(e.PersID, e.UID)));
}
}

View file

@ -67,7 +67,8 @@ namespace eDosStation
private void setLocalStatus()
{
if (dataInterface.isLocal)
if (!dataInterface.isOnline())
{
Status.Content = "*** Offline ***";
Status.Foreground = Brushes.Yellow;

View file

@ -12,7 +12,7 @@ using System.Windows;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("eDosStation")]
[assembly: AssemblyCopyright("Copyright © 2019 Luc Vandenbroucke")]
[assembly: AssemblyCopyright("Copyright © 2019-2021 Luc Vandenbroucke")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]

View file

@ -44,7 +44,7 @@ namespace syncEdosLocal
pa = new SqlParameter("Entries", SqlDbType.Int, 4); cmd.Parameters.Add(pa);
pa = new SqlParameter("Exits", SqlDbType.Int, 4); cmd.Parameters.Add(pa);
pa = new SqlParameter("Skipped", SqlDbType.Int, 4); cmd.Parameters.Add(pa);
pa = new SqlParameter("ErrorMessage", SqlDbType.VarChar, 50); cmd.Parameters.Add(pa);
pa = new SqlParameter("ErrorMessage", SqlDbType.VarChar, 512); cmd.Parameters.Add(pa);
pa = new SqlParameter("ID_Visit_Min", SqlDbType.Int, 4); cmd.Parameters.Add(pa);
pa = new SqlParameter("ID_Visit_Max", SqlDbType.Int, 4); cmd.Parameters.Add(pa);
pa = new SqlParameter("Persons", SqlDbType.Int, 4); cmd.Parameters.Add(pa);