sync ok
This commit is contained in:
parent
ad0a7d6371
commit
461ea83d4a
14 changed files with 181 additions and 284 deletions
|
|
@ -2,7 +2,6 @@
|
|||
<!--For more information on using transformations see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<connectionStrings>
|
||||
<add name="eDosStation.Properties.Settings.eDosConnectionString" connectionString="Data Source=HPHDB;Initial Catalog=eDosx;User ID=eDosStation;Password=Infopla+8;TrustServerCertificate=True;Application Name=eDosStation" xdt:Locator="Match(name)" xdt:Transform="Replace"/>
|
||||
<add name="eDosStation.Properties.Settings.localConnectionString" connectionString="Data Source=HPHDB;Initial Catalog=eDosLocal;User ID=eDosStation;Password=Infopla+8;TrustServerCertificate=True;Application Name=eDosStation" xdt:Locator="Match(name)" xdt:Transform="Replace"/>
|
||||
</connectionStrings>
|
||||
<appSettings >
|
||||
|
|
|
|||
|
|
@ -6,12 +6,6 @@
|
|||
</sectionGroup>
|
||||
</configSections>
|
||||
<connectionStrings>
|
||||
<add name="eDosStation.Properties.Settings.masterConnectionString"
|
||||
connectionString="Data Source=scksrv23;Initial Catalog=master;Integrated Security=True;TrustServerCertificate=True;Application Name=eDosStation"
|
||||
providerName="System.Data.SqlClient" />
|
||||
<add name="eDosStation.Properties.Settings.eDosConnectionString"
|
||||
connectionString="Data Source=HPHDB;Initial Catalog=eDosx;User ID=eDosStation;Password=Infopla+8;TrustServerCertificate=True;Application Name=eDosStation"
|
||||
providerName="System.Data.SqlClient" />
|
||||
<add name="eDosStation.Properties.Settings.localConnectionString"
|
||||
connectionString="Data Source=HPHDB;Initial Catalog=eDosLocal;User ID=eDosStation;Password=Infopla+8;TrustServerCertificate=True;Application Name=eDosStation"
|
||||
providerName="System.Data.SqlClient" />
|
||||
|
|
|
|||
|
|
@ -9,21 +9,17 @@ using System.Windows.Navigation;
|
|||
|
||||
namespace eDosStation
|
||||
{
|
||||
public static class LocalRemote
|
||||
public class DataInterface
|
||||
{
|
||||
static public int ID_Station;
|
||||
static public bool isLocal = false;
|
||||
static public string serverConstr;
|
||||
static public string serverTestConstr;
|
||||
static public string localConstr;
|
||||
static public string currentConStr;
|
||||
static public System.Data.SqlClient.SqlConnection Connection;
|
||||
static public System.Data.SqlClient.SqlConnection SequenceConnection;
|
||||
static public System.Data.SqlClient.SqlCommand VisitInitCommand;
|
||||
public int ID_Station;
|
||||
public bool isLocal = false;
|
||||
private string currentConStr;
|
||||
public System.Data.SqlClient.SqlConnection localConnection;
|
||||
public System.Data.SqlClient.SqlCommand VisitInitCommand;
|
||||
public static SqlCommand VisitExitCommand;
|
||||
public static SqlCommand NextIDCommand;
|
||||
public static SqlCommand LastLocalIDCommand;
|
||||
static public DataSet1.CommentOnEventDataTable dtCOE;
|
||||
public static SqlCommand LastIDCommand;
|
||||
public DataSet1.CommentOnEventDataTable dtCOE;
|
||||
|
||||
public static int? NextID()
|
||||
{
|
||||
|
|
@ -36,62 +32,44 @@ namespace eDosStation
|
|||
public static int? LastID()
|
||||
{
|
||||
int? lastValue = null;
|
||||
if (NextIDCommand.Connection.State == ConnectionState.Closed) LastLocalIDCommand.Connection.Open();
|
||||
lastValue = LastLocalIDCommand.ExecuteScalar() as int?;
|
||||
if (NextIDCommand.Connection.State == ConnectionState.Closed) LastIDCommand.Connection.Open();
|
||||
lastValue = LastIDCommand.ExecuteScalar() as int?;
|
||||
return lastValue;
|
||||
}
|
||||
static public bool checkCon(bool leaveOpen = false)
|
||||
/// <summary>
|
||||
/// Check connenction. If closed then open oand optianly leave open.
|
||||
/// </summary>
|
||||
/// <param name="leaveOpen">If opened leave it open</param>
|
||||
/// <returns>true if connection ok</returns>
|
||||
public bool checkCon(bool leaveOpen = false)
|
||||
{
|
||||
if (Connection != null && Connection.State == System.Data.ConnectionState.Open) return true;
|
||||
|
||||
bool rv = false;
|
||||
var cs = new System.Data.SqlClient.SqlConnectionStringBuilder(serverTestConstr);
|
||||
#if DEBUG
|
||||
cs.ConnectTimeout = 10;
|
||||
#endif
|
||||
isLocal = false;
|
||||
Connection = new System.Data.SqlClient.SqlConnection(cs.ConnectionString);
|
||||
if (localConnection != null && localConnection.State == System.Data.ConnectionState.Open) return true;
|
||||
try
|
||||
{
|
||||
Connection.Open();
|
||||
}
|
||||
catch { }
|
||||
if (Connection.State != System.Data.ConnectionState.Open)
|
||||
{
|
||||
switchLocal(true); //wijzigt currentConStr als isLocal niet al gezet is.
|
||||
}
|
||||
else
|
||||
{
|
||||
currentConStr = serverConstr;
|
||||
isLocal = false;
|
||||
if (localConnection == null || string.IsNullOrEmpty(localConnection.ConnectionString)) localConnection = new SqlConnection(currentConStr);
|
||||
|
||||
localConnection.Open();
|
||||
rv = true;
|
||||
}
|
||||
if (!rv)
|
||||
try
|
||||
{
|
||||
Connection.ConnectionString = currentConStr;
|
||||
Connection.Open();
|
||||
rv = true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
Connection.Dispose();
|
||||
Connection = null;
|
||||
}
|
||||
if (rv && !leaveOpen) Connection?.Close();
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
System.Windows.MessageBox.Show($"Opening '{currentConStr}' error :{ex.Message}");
|
||||
}
|
||||
if (rv && !leaveOpen) localConnection?.Close();
|
||||
return rv;
|
||||
}
|
||||
|
||||
internal static void SetStation(int curIDStation)
|
||||
internal void SetStation(int curIDStation)
|
||||
{
|
||||
ID_Station = curIDStation;
|
||||
LastLocalIDCommand.Parameters["ID_Station"].Value = curIDStation;
|
||||
LastIDCommand.Parameters["ID_Station"].Value = curIDStation;
|
||||
VisitInitCommand.Parameters["ID_Station"].Value = curIDStation;
|
||||
}
|
||||
|
||||
static public void first()
|
||||
{
|
||||
var cb = new System.Data.SqlClient.SqlConnectionStringBuilder(Properties.Settings.Default.eDosConnectionString);
|
||||
var cb = new System.Data.SqlClient.SqlConnectionStringBuilder(Properties.Settings.Default.localConnectionString);
|
||||
if (string.IsNullOrEmpty(cb.Password))
|
||||
{
|
||||
var f = new AskPwd();
|
||||
|
|
@ -103,71 +81,56 @@ namespace eDosStation
|
|||
}
|
||||
}
|
||||
|
||||
static public void init()
|
||||
private void init()
|
||||
{
|
||||
first();
|
||||
localConstr = System.Configuration.ConfigurationManager.ConnectionStrings["eDosStation.Properties.Settings.localConnectionString"].ConnectionString;
|
||||
SequenceConnection = new SqlConnection(localConstr);
|
||||
NextIDCommand = new SqlCommand("SELECT NEXT VALUE FOR VisitSequence as VisitID", SequenceConnection);
|
||||
serverConstr = System.Configuration.ConfigurationManager.ConnectionStrings["eDosStation.Properties.Settings.eDosConnectionString"].ConnectionString;
|
||||
var cb = new System.Data.SqlClient.SqlConnectionStringBuilder(serverConstr);
|
||||
cb.ConnectTimeout = 5;
|
||||
serverTestConstr = cb.ConnectionString;
|
||||
checkCon(false);
|
||||
currentConStr = System.Configuration.ConfigurationManager.ConnectionStrings["eDosStation.Properties.Settings.localConnectionString"].ConnectionString;
|
||||
localConnection = new SqlConnection(currentConStr);
|
||||
NextIDCommand = new SqlCommand("SELECT NEXT VALUE FOR VisitSequence as VisitID", localConnection);
|
||||
isLocal = true;
|
||||
MakeCommands();
|
||||
bool rv= checkCon(false);
|
||||
}
|
||||
|
||||
static void switchLocal(bool force=false)
|
||||
public DataInterface()
|
||||
{
|
||||
if (force || !isLocal)
|
||||
{
|
||||
isLocal = true;
|
||||
currentConStr = localConstr;
|
||||
}
|
||||
init();
|
||||
}
|
||||
static void switchServer()
|
||||
{
|
||||
if (isLocal)
|
||||
{
|
||||
isLocal = false;
|
||||
currentConStr = System.Configuration.ConfigurationManager.ConnectionStrings["eDosStation.Properties.Settings.eDosConnectionString"].ConnectionString;
|
||||
}
|
||||
}
|
||||
|
||||
static DataSet1TableAdapters.GetTaskInfoTableAdapter TaskInfoTa()
|
||||
|
||||
DataSet1TableAdapters.GetTaskInfoTableAdapter TaskInfoTa()
|
||||
{
|
||||
var ta = new DataSet1TableAdapters.GetTaskInfoTableAdapter();
|
||||
ta.Connection.ConnectionString = currentConStr;
|
||||
return ta;
|
||||
}
|
||||
|
||||
static DataSet1TableAdapters.GetTaskListTableAdapter TaskListTA()
|
||||
DataSet1TableAdapters.GetTaskListTableAdapter TaskListTA()
|
||||
{
|
||||
var ta = new DataSet1TableAdapters.GetTaskListTableAdapter();
|
||||
ta.Connection.ConnectionString = currentConStr;
|
||||
return ta;
|
||||
}
|
||||
|
||||
static DataSet1TableAdapters.CommentOnEventTableAdapter CommentTA()
|
||||
DataSet1TableAdapters.CommentOnEventTableAdapter CommentTA()
|
||||
{
|
||||
var ta = new DataSet1TableAdapters.CommentOnEventTableAdapter();
|
||||
ta.Connection.ConnectionString = currentConStr;
|
||||
return ta;
|
||||
}
|
||||
|
||||
static public System.Data.SqlClient.SqlConnection getCon(bool LeaveOpen)
|
||||
public System.Data.SqlClient.SqlConnection getCon(bool LeaveOpen)
|
||||
{
|
||||
checkCon(LeaveOpen);
|
||||
return Connection;
|
||||
return localConnection;
|
||||
}
|
||||
|
||||
static void MakeCommands()
|
||||
void MakeCommands()
|
||||
{
|
||||
LastLocalIDCommand = new SqlCommand("VisitIDLast", SequenceConnection);
|
||||
LastLocalIDCommand.CommandType = CommandType.StoredProcedure;
|
||||
var pa = new System.Data.SqlClient.SqlParameter("ID_Station", SqlDbType.Int, 4); LastLocalIDCommand.Parameters.Add(pa);
|
||||
LastIDCommand = new SqlCommand("VisitIDLast", localConnection);
|
||||
LastIDCommand.CommandType = CommandType.StoredProcedure;
|
||||
var pa = new System.Data.SqlClient.SqlParameter("ID_Station", SqlDbType.Int, 4); LastIDCommand.Parameters.Add(pa);
|
||||
|
||||
VisitInitCommand = new System.Data.SqlClient.SqlCommand("VisitInit", Connection);
|
||||
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);
|
||||
pa = new System.Data.SqlClient.SqlParameter("ID_Visit", SqlDbType.Int, 4); pa.Direction = ParameterDirection.Input; VisitInitCommand.Parameters.Add(pa);
|
||||
|
|
@ -179,7 +142,7 @@ namespace eDosStation
|
|||
pa = new System.Data.SqlClient.SqlParameter("ENTRY_EPD_CLOCK", SqlDbType.Int, 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 = new SqlCommand("VisitExit", localConnection);
|
||||
VisitExitCommand.CommandType = CommandType.StoredProcedure;
|
||||
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);
|
||||
|
|
@ -210,10 +173,9 @@ namespace eDosStation
|
|||
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);
|
||||
pa = new System.Data.SqlClient.SqlParameter("EXIT_EPD_CLOCK", SqlDbType.Int, 4); VisitExitCommand.Parameters.Add(pa);
|
||||
|
||||
}
|
||||
|
||||
static public void VisitExit(int EpdVisitID, EpdBaseClr.Epd2 ep)
|
||||
public void VisitExit(int EpdVisitID, EpdBaseClr.Epd2 ep)
|
||||
{
|
||||
VisitExitCommand.Parameters["EPDVisitID"].Value = EpdVisitID;
|
||||
VisitExitCommand.Parameters["HP07"].Value = ep.Hp07;
|
||||
|
|
@ -258,12 +220,12 @@ namespace eDosStation
|
|||
VisitExitCommand.Parameters["EXIT_EPD_CLOCK"].Value = ep.CountsClock;
|
||||
|
||||
checkCon(true);
|
||||
VisitExitCommand.Connection = Connection;
|
||||
VisitExitCommand.Connection = localConnection;
|
||||
VisitExitCommand.ExecuteNonQuery();
|
||||
Connection.Close();
|
||||
localConnection.Close();
|
||||
}
|
||||
|
||||
static public void FillComment()
|
||||
public void FillComment()
|
||||
{
|
||||
if (dtCOE == null) dtCOE = new DataSet1.CommentOnEventDataTable();
|
||||
using (var dt = new DataSet1TableAdapters.CommentOnEventTableAdapter())
|
||||
|
|
@ -273,12 +235,12 @@ namespace eDosStation
|
|||
}
|
||||
}
|
||||
|
||||
static public DataSet1.CommentOnEventRow GetCommentOnEventRow(int id)
|
||||
public DataSet1.CommentOnEventRow GetCommentOnEventRow(int id)
|
||||
{
|
||||
return dtCOE.FindByID_CommnentOnEvent(id);
|
||||
}
|
||||
|
||||
static public void FillTaskInfo(User _User, DataSet1 dataSet1)
|
||||
public void FillTaskInfo(User _User, DataSet1 dataSet1)
|
||||
{
|
||||
using (var dataSet1GetTaskInfoTableAdapter = new eDosStation.DataSet1TableAdapters.GetTaskInfoTableAdapter())
|
||||
{
|
||||
|
|
@ -287,19 +249,19 @@ namespace eDosStation
|
|||
}
|
||||
}
|
||||
|
||||
static public User GetUser( string CSN, string Code)
|
||||
public User GetUser( string CSN, string Code)
|
||||
{
|
||||
User u = new User();
|
||||
object[] Values = null;
|
||||
if (int.TryParse(Code,out int PersID))
|
||||
using (var cmd = new SqlCommand("GetPersonInfo", Connection))
|
||||
using (var cmd = new SqlCommand("GetPersonInfo", localConnection))
|
||||
{
|
||||
cmd.CommandType = System.Data.CommandType.StoredProcedure;
|
||||
cmd.Parameters.AddWithValue("csn", CSN);
|
||||
cmd.Parameters.AddWithValue("PersID", PersID);
|
||||
//if (!string.IsNullOrWhiteSpace(Code)) cmd.Parameters.AddWithValue("Badge", Code);
|
||||
checkCon(true);
|
||||
cmd.Connection = Connection;
|
||||
cmd.Connection = localConnection;
|
||||
var rs = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow);
|
||||
if (rs.HasRows && rs.Read())
|
||||
{
|
||||
46
eDosStation/DataSet1.Designer.cs
generated
46
eDosStation/DataSet1.Designer.cs
generated
|
|
@ -854,6 +854,7 @@ namespace eDosStation {
|
|||
this.columnID_Task.ReadOnly = true;
|
||||
this.columnID_Task.Unique = true;
|
||||
this.columnTask_Name.MaxLength = 2147483647;
|
||||
this.columnTaskDescription.AllowDBNull = false;
|
||||
this.columnTaskDescription.ReadOnly = true;
|
||||
this.columnTaskDescription.MaxLength = 50;
|
||||
this.columnEPDRad.AllowDBNull = false;
|
||||
|
|
@ -1194,6 +1195,7 @@ namespace eDosStation {
|
|||
this.columnID_Task.ReadOnly = true;
|
||||
this.columnID_Task.Unique = true;
|
||||
this.columnTask_Name.MaxLength = 2147483647;
|
||||
this.columnTaskDescription.AllowDBNull = false;
|
||||
this.columnTaskDescription.ReadOnly = true;
|
||||
this.columnTaskDescription.MaxLength = 50;
|
||||
this.columnEPDRad.AllowDBNull = false;
|
||||
|
|
@ -1752,12 +1754,7 @@ namespace eDosStation {
|
|||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
|
||||
public string TaskDescription {
|
||||
get {
|
||||
try {
|
||||
return ((string)(this[this.tableGetTaskInfo.TaskDescriptionColumn]));
|
||||
}
|
||||
catch (global::System.InvalidCastException e) {
|
||||
throw new global::System.Data.StrongTypingException("The value for column \'TaskDescription\' in table \'GetTaskInfo\' is DBNull.", e);
|
||||
}
|
||||
return ((string)(this[this.tableGetTaskInfo.TaskDescriptionColumn]));
|
||||
}
|
||||
set {
|
||||
this[this.tableGetTaskInfo.TaskDescriptionColumn] = value;
|
||||
|
|
@ -2131,18 +2128,6 @@ namespace eDosStation {
|
|||
this[this.tableGetTaskInfo.Task_NameColumn] = global::System.Convert.DBNull;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
|
||||
public bool IsTaskDescriptionNull() {
|
||||
return this.IsNull(this.tableGetTaskInfo.TaskDescriptionColumn);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
|
||||
public void SetTaskDescriptionNull() {
|
||||
this[this.tableGetTaskInfo.TaskDescriptionColumn] = global::System.Convert.DBNull;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
|
||||
public bool IsID_AlarmEPDNull() {
|
||||
|
|
@ -2461,12 +2446,7 @@ namespace eDosStation {
|
|||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
|
||||
public string TaskDescription {
|
||||
get {
|
||||
try {
|
||||
return ((string)(this[this.tableGetTaskList.TaskDescriptionColumn]));
|
||||
}
|
||||
catch (global::System.InvalidCastException e) {
|
||||
throw new global::System.Data.StrongTypingException("The value for column \'TaskDescription\' in table \'GetTaskList\' is DBNull.", e);
|
||||
}
|
||||
return ((string)(this[this.tableGetTaskList.TaskDescriptionColumn]));
|
||||
}
|
||||
set {
|
||||
this[this.tableGetTaskList.TaskDescriptionColumn] = value;
|
||||
|
|
@ -2519,18 +2499,6 @@ namespace eDosStation {
|
|||
public void SetTask_NameNull() {
|
||||
this[this.tableGetTaskList.Task_NameColumn] = global::System.Convert.DBNull;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
|
||||
public bool IsTaskDescriptionNull() {
|
||||
return this.IsNull(this.tableGetTaskList.TaskDescriptionColumn);
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
|
||||
public void SetTaskDescriptionNull() {
|
||||
this[this.tableGetTaskList.TaskDescriptionColumn] = global::System.Convert.DBNull;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -2987,7 +2955,7 @@ namespace eDosStation.DataSet1TableAdapters {
|
|||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
|
||||
private void InitConnection() {
|
||||
this._connection = new global::System.Data.SqlClient.SqlConnection();
|
||||
this._connection.ConnectionString = global::eDosStation.Properties.Settings.Default.eDosConnectionString;
|
||||
this._connection.ConnectionString = global::eDosStation.Properties.Settings.Default.localConnectionString;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
|
|
@ -3186,7 +3154,7 @@ namespace eDosStation.DataSet1TableAdapters {
|
|||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
|
||||
private void InitConnection() {
|
||||
this._connection = new global::System.Data.SqlClient.SqlConnection();
|
||||
this._connection.ConnectionString = global::eDosStation.Properties.Settings.Default.eDosConnectionString;
|
||||
this._connection.ConnectionString = global::eDosStation.Properties.Settings.Default.localConnectionString;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
|
|
@ -3360,7 +3328,7 @@ namespace eDosStation.DataSet1TableAdapters {
|
|||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")]
|
||||
private void InitConnection() {
|
||||
this._connection = new global::System.Data.SqlClient.SqlConnection();
|
||||
this._connection.ConnectionString = global::eDosStation.Properties.Settings.Default.eDosConnectionString;
|
||||
this._connection.ConnectionString = global::eDosStation.Properties.Settings.Default.localConnectionString;
|
||||
}
|
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
|
|
|
|||
|
|
@ -2,14 +2,15 @@
|
|||
<xs:schema id="DataSet1" targetNamespace="http://tempuri.org/DataSet1.xsd" xmlns:mstns="http://tempuri.org/DataSet1.xsd" xmlns="http://tempuri.org/DataSet1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
|
||||
<xs:annotation>
|
||||
<xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<DataSource DefaultConnectionIndex="1" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<Connections>
|
||||
<Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="eDosConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="eDosConnectionString (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.eDosStation.Properties.Settings.GlobalReference.Default.eDosConnectionString" Provider="System.Data.SqlClient" />
|
||||
<Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="localConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="localConnectionString (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.eDosStation.Properties.Settings.GlobalReference.Default.localConnectionString" Provider="System.Data.SqlClient" />
|
||||
</Connections>
|
||||
<Tables>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="GetTaskInfoTableAdapter" GeneratorDataComponentClassName="GetTaskInfoTableAdapter" Name="GetTaskInfo" UserDataComponentName="GetTaskInfoTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="eDosConnectionString (Settings)" DbObjectName="eDos.dbo.GetTaskInfo" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<DbSource ConnectionRef="localConnectionString (Settings)" DbObjectName="eDosLocal.dbo.GetTaskInfo" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>dbo.GetTaskInfo</CommandText>
|
||||
|
|
@ -54,7 +55,7 @@
|
|||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="GetTaskListTableAdapter" GeneratorDataComponentClassName="GetTaskListTableAdapter" Name="GetTaskList" UserDataComponentName="GetTaskListTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="eDosConnectionString (Settings)" DbObjectName="eDos.dbo.GetTaskList" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<DbSource ConnectionRef="localConnectionString (Settings)" DbObjectName="eDosLocal.dbo.GetTaskList" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>dbo.GetTaskList</CommandText>
|
||||
|
|
@ -77,7 +78,7 @@
|
|||
</TableAdapter>
|
||||
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="CommentOnEventTableAdapter" GeneratorDataComponentClassName="CommentOnEventTableAdapter" Name="CommentOnEvent" UserDataComponentName="CommentOnEventTableAdapter">
|
||||
<MainSource>
|
||||
<DbSource ConnectionRef="eDosConnectionString (Settings)" DbObjectName="eDos.dbo.CommentOnEventSelect" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<DbSource ConnectionRef="localConnectionString (Settings)" DbObjectName="eDosLocal.dbo.CommentOnEventSelect" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
|
||||
<SelectCommand>
|
||||
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
|
||||
<CommandText>dbo.CommentOnEventSelect</CommandText>
|
||||
|
|
@ -107,7 +108,7 @@
|
|||
<xs:element name="DataSet1" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="DataSet1" msprop:Generator_UserDSName="DataSet1">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="GetTaskInfo" msprop:Generator_TableClassName="GetTaskInfoDataTable" msprop:Generator_TableVarName="tableGetTaskInfo" msprop:Generator_TablePropName="GetTaskInfo" msprop:Generator_RowDeletingName="GetTaskInfoRowDeleting" msprop:Generator_RowChangingName="GetTaskInfoRowChanging" msprop:Generator_RowEvHandlerName="GetTaskInfoRowChangeEventHandler" msprop:Generator_RowDeletedName="GetTaskInfoRowDeleted" msprop:Generator_UserTableName="GetTaskInfo" msprop:Generator_RowChangedName="GetTaskInfoRowChanged" msprop:Generator_RowEvArgName="GetTaskInfoRowChangeEvent" msprop:Generator_RowClassName="GetTaskInfoRow">
|
||||
<xs:element name="GetTaskInfo" msprop:Generator_TableClassName="GetTaskInfoDataTable" msprop:Generator_TableVarName="tableGetTaskInfo" msprop:Generator_RowChangedName="GetTaskInfoRowChanged" msprop:Generator_TablePropName="GetTaskInfo" msprop:Generator_RowDeletingName="GetTaskInfoRowDeleting" msprop:Generator_RowChangingName="GetTaskInfoRowChanging" msprop:Generator_RowEvHandlerName="GetTaskInfoRowChangeEventHandler" msprop:Generator_RowDeletedName="GetTaskInfoRowDeleted" msprop:Generator_RowClassName="GetTaskInfoRow" msprop:Generator_UserTableName="GetTaskInfo" msprop:Generator_RowEvArgName="GetTaskInfoRowChangeEvent">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="ID_Task" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnID_Task" msprop:Generator_ColumnPropNameInRow="ID_Task" msprop:Generator_ColumnPropNameInTable="ID_TaskColumn" msprop:Generator_UserColumnName="ID_Task" type="xs:int" />
|
||||
|
|
@ -120,7 +121,7 @@
|
|||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="TaskDescription" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnTaskDescription" msprop:Generator_ColumnPropNameInRow="TaskDescription" msprop:Generator_ColumnPropNameInTable="TaskDescriptionColumn" msprop:Generator_UserColumnName="TaskDescription" minOccurs="0">
|
||||
<xs:element name="TaskDescription" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnTaskDescription" msprop:Generator_ColumnPropNameInRow="TaskDescription" msprop:Generator_ColumnPropNameInTable="TaskDescriptionColumn" msprop:Generator_UserColumnName="TaskDescription">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
|
|
@ -169,7 +170,7 @@
|
|||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="GetTaskList" msprop:Generator_TableClassName="GetTaskListDataTable" msprop:Generator_TableVarName="tableGetTaskList" msprop:Generator_TablePropName="GetTaskList" msprop:Generator_RowDeletingName="GetTaskListRowDeleting" msprop:Generator_RowChangingName="GetTaskListRowChanging" msprop:Generator_RowEvHandlerName="GetTaskListRowChangeEventHandler" msprop:Generator_RowDeletedName="GetTaskListRowDeleted" msprop:Generator_UserTableName="GetTaskList" msprop:Generator_RowChangedName="GetTaskListRowChanged" msprop:Generator_RowEvArgName="GetTaskListRowChangeEvent" msprop:Generator_RowClassName="GetTaskListRow">
|
||||
<xs:element name="GetTaskList" msprop:Generator_TableClassName="GetTaskListDataTable" msprop:Generator_TableVarName="tableGetTaskList" msprop:Generator_RowChangedName="GetTaskListRowChanged" msprop:Generator_TablePropName="GetTaskList" msprop:Generator_RowDeletingName="GetTaskListRowDeleting" msprop:Generator_RowChangingName="GetTaskListRowChanging" msprop:Generator_RowEvHandlerName="GetTaskListRowChangeEventHandler" msprop:Generator_RowDeletedName="GetTaskListRowDeleted" msprop:Generator_RowClassName="GetTaskListRow" msprop:Generator_UserTableName="GetTaskList" msprop:Generator_RowEvArgName="GetTaskListRowChangeEvent">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="ID_Task" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnID_Task" msprop:Generator_ColumnPropNameInRow="ID_Task" msprop:Generator_ColumnPropNameInTable="ID_TaskColumn" msprop:Generator_UserColumnName="ID_Task" type="xs:int" />
|
||||
|
|
@ -182,7 +183,7 @@
|
|||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<xs:element name="TaskDescription" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnTaskDescription" msprop:Generator_ColumnPropNameInRow="TaskDescription" msprop:Generator_ColumnPropNameInTable="TaskDescriptionColumn" msprop:Generator_UserColumnName="TaskDescription" minOccurs="0">
|
||||
<xs:element name="TaskDescription" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnTaskDescription" msprop:Generator_ColumnPropNameInRow="TaskDescription" msprop:Generator_ColumnPropNameInTable="TaskDescriptionColumn" msprop:Generator_UserColumnName="TaskDescription">
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:maxLength value="50" />
|
||||
|
|
@ -199,7 +200,7 @@
|
|||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="CommentOnEvent" msprop:Generator_TableClassName="CommentOnEventDataTable" msprop:Generator_TableVarName="tableCommentOnEvent" msprop:Generator_TablePropName="CommentOnEvent" msprop:Generator_RowDeletingName="CommentOnEventRowDeleting" msprop:Generator_RowChangingName="CommentOnEventRowChanging" msprop:Generator_RowEvHandlerName="CommentOnEventRowChangeEventHandler" msprop:Generator_RowDeletedName="CommentOnEventRowDeleted" msprop:Generator_UserTableName="CommentOnEvent" msprop:Generator_RowChangedName="CommentOnEventRowChanged" msprop:Generator_RowEvArgName="CommentOnEventRowChangeEvent" msprop:Generator_RowClassName="CommentOnEventRow">
|
||||
<xs:element name="CommentOnEvent" msprop:Generator_TableClassName="CommentOnEventDataTable" msprop:Generator_TableVarName="tableCommentOnEvent" msprop:Generator_RowChangedName="CommentOnEventRowChanged" msprop:Generator_TablePropName="CommentOnEvent" msprop:Generator_RowDeletingName="CommentOnEventRowDeleting" msprop:Generator_RowChangingName="CommentOnEventRowChanging" msprop:Generator_RowEvHandlerName="CommentOnEventRowChangeEventHandler" msprop:Generator_RowDeletedName="CommentOnEventRowDeleted" msprop:Generator_RowClassName="CommentOnEventRow" msprop:Generator_UserTableName="CommentOnEvent" msprop:Generator_RowEvArgName="CommentOnEventRowChangeEvent">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="ID_CommnentOnEvent" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnID_CommnentOnEvent" msprop:Generator_ColumnPropNameInRow="ID_CommnentOnEvent" msprop:Generator_ColumnPropNameInTable="ID_CommnentOnEventColumn" msprop:Generator_UserColumnName="ID_CommnentOnEvent" type="xs:int" />
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ namespace eDosStation
|
|||
int Search, UserSeconds;
|
||||
Boolean Inst1 = false, Inst2 = false;
|
||||
|
||||
private DataInterface dataInterface;
|
||||
|
||||
public static LSWDesfirePublic.CCard dfReader;
|
||||
//System.Threading.Thread t;
|
||||
//bool nextCSN = false;
|
||||
|
|
@ -41,6 +43,7 @@ namespace eDosStation
|
|||
|
||||
public EntryBadge(EpdBaseClr.Epd2 curEP, Station curStation)
|
||||
{
|
||||
dataInterface = curStation.dataInterface;
|
||||
ep=curEP;
|
||||
thisStation = curStation;
|
||||
InitializeComponent();
|
||||
|
|
@ -126,34 +129,34 @@ namespace eDosStation
|
|||
private void DoEPD()
|
||||
{
|
||||
int? StationVisitID = null;
|
||||
int? ID_Visit= LocalRemote.NextID();
|
||||
int? ID_Visit= DataInterface.NextID();
|
||||
if (ID_Visit.HasValue && LoadDoses())
|
||||
{
|
||||
bool isBG = (ep.epdType != 3); //3 = zwarte 0=grijs
|
||||
var co = LocalRemote.getCon(true);
|
||||
LocalRemote.VisitInitCommand.Connection = co;
|
||||
LocalRemote.VisitInitCommand.Parameters["ID_Station"].Value = thisStation.ID_Station;
|
||||
LocalRemote.VisitInitCommand.Parameters["ID_Visit"].Value = ID_Visit;
|
||||
LocalRemote.VisitInitCommand.Parameters["PersID"].Value = _User.PersID;
|
||||
LocalRemote.VisitInitCommand.Parameters["ID_Task"].Value = CurTaskRow.ID_Task;
|
||||
LocalRemote.VisitInitCommand.Parameters["Inst_CODE"].Value = CurTaskRow.Inst_CODE;
|
||||
LocalRemote.VisitInitCommand.Parameters["EPD_InternalID"].Value = (int)ep.EpdID;
|
||||
LocalRemote.VisitInitCommand.Parameters["isBG"].Value = isBG;
|
||||
LocalRemote.VisitInitCommand.Parameters["ENTRY_EPD_CLOCK"].Value = ep.CountsClock;
|
||||
var co = dataInterface.getCon(true);
|
||||
dataInterface.VisitInitCommand.Connection = co;
|
||||
dataInterface.VisitInitCommand.Parameters["ID_Station"].Value = thisStation.ID_Station;
|
||||
dataInterface.VisitInitCommand.Parameters["ID_Visit"].Value = ID_Visit;
|
||||
dataInterface.VisitInitCommand.Parameters["PersID"].Value = _User.PersID;
|
||||
dataInterface.VisitInitCommand.Parameters["ID_Task"].Value = CurTaskRow.ID_Task;
|
||||
dataInterface.VisitInitCommand.Parameters["Inst_CODE"].Value = CurTaskRow.Inst_CODE;
|
||||
dataInterface.VisitInitCommand.Parameters["EPD_InternalID"].Value = (int)ep.EpdID;
|
||||
dataInterface.VisitInitCommand.Parameters["isBG"].Value = isBG;
|
||||
dataInterface.VisitInitCommand.Parameters["ENTRY_EPD_CLOCK"].Value = ep.CountsClock;
|
||||
|
||||
|
||||
using (var l = new SqlLog())
|
||||
try
|
||||
{
|
||||
LocalRemote.VisitInitCommand.ExecuteNonQuery();
|
||||
l.LogCommand(LocalRemote.VisitInitCommand);
|
||||
dataInterface.VisitInitCommand.ExecuteNonQuery();
|
||||
l.LogCommand(dataInterface.VisitInitCommand);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
l.LogCommand(ex.Message);
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
StationVisitID = (int?)LocalRemote.VisitInitCommand.Parameters["EPDVisitID"].Value;
|
||||
StationVisitID = (int?)dataInterface.VisitInitCommand.Parameters["EPDVisitID"].Value;
|
||||
co.Close();
|
||||
|
||||
int rv = ep.PrepareForIssue();
|
||||
|
|
@ -266,7 +269,7 @@ namespace eDosStation
|
|||
public string getCommentUnknown()
|
||||
{
|
||||
StringBuilder res = new StringBuilder();
|
||||
var r = LocalRemote.GetCommentOnEventRow(3);
|
||||
var r = dataInterface.GetCommentOnEventRow(3);
|
||||
res.AppendLine(r.Comment_NL).Replace("\\n", "\n");
|
||||
res.AppendLine("---");
|
||||
res.AppendLine(r.Comment_FR).Replace("\\n", "\n");
|
||||
|
|
@ -280,7 +283,7 @@ namespace eDosStation
|
|||
{
|
||||
string res=string.Empty;
|
||||
if (!string.IsNullOrWhiteSpace(prefix)) res = prefix + "\n";
|
||||
var r = LocalRemote.GetCommentOnEventRow(id);
|
||||
var r = dataInterface.GetCommentOnEventRow(id);
|
||||
string l = _User?.Language ?? "E";
|
||||
if (r!=null)
|
||||
switch (l)
|
||||
|
|
@ -356,14 +359,14 @@ namespace eDosStation
|
|||
{
|
||||
Naam.Text = _User.FirstName + " " + _User.LastName;
|
||||
eDosStation.DataSet1 dataSet1 = ((eDosStation.DataSet1)(this.FindResource("dataSet1")));
|
||||
LocalRemote.FillTaskInfo(_User, dataSet1);
|
||||
dataInterface.FillTaskInfo(_User, dataSet1);
|
||||
tbTask.IsSelected = true;
|
||||
bool isAlara = (cbAlara.IsChecked == true);
|
||||
SetFilter(isAlara);
|
||||
}
|
||||
void CheckBadge()
|
||||
{
|
||||
_User = LocalRemote.GetUser(CSN.Text, Code.Text);
|
||||
_User = dataInterface.GetUser(CSN.Text, Code.Text);
|
||||
ShowUserInfo(); //AskTask();
|
||||
}
|
||||
public void showBadge(int persID, string csn)
|
||||
|
|
@ -492,7 +495,7 @@ namespace eDosStation
|
|||
private void BTestPerson_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Button b = sender as Button;
|
||||
_User = LocalRemote.GetUser("TP"+b.Tag.ToString().ToUpper(), "");
|
||||
_User = dataInterface.GetUser("TP"+b.Tag.ToString().ToUpper(), "");
|
||||
ShowUserInfo(); //AskTask();
|
||||
}
|
||||
|
||||
|
|
@ -530,7 +533,7 @@ namespace eDosStation
|
|||
}
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LocalRemote.checkCon();
|
||||
dataInterface.checkCon();
|
||||
EpdFound = false;
|
||||
initialising = true;
|
||||
tbEntry.IsSelected = true;
|
||||
|
|
@ -548,7 +551,7 @@ namespace eDosStation
|
|||
cbInst2.IsChecked = Inst2;
|
||||
}
|
||||
|
||||
LocalRemote.FillComment();
|
||||
dataInterface.FillComment();
|
||||
|
||||
//string TestCSN = null; // thisStation.TestCSN;
|
||||
initialising = false;
|
||||
|
|
@ -568,9 +571,9 @@ namespace eDosStation
|
|||
}
|
||||
else
|
||||
{
|
||||
StringBuilder er = new StringBuilder($"Badgelezer \"{thisStation.Reader}\" niet gevonden!.\nDeze zijn beschikbaar:\n");
|
||||
StringBuilder er = new StringBuilder($"Badgelezer \"{thisStation.Reader}\" niet gevonden!.\nDeze lezers zijn beschikbaar:\n");
|
||||
dfReader.GetReaderList();
|
||||
foreach (string r in dfReader.readersList) er.AppendLine(r);
|
||||
foreach (string r in dfReader.readersList) er.AppendLine($"-> {r}");
|
||||
MessageBox.Show(er.ToString(), "Badge Lezer", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
dfReader.Dispose(); dfReader = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ namespace eDosStation
|
|||
/// </summary>
|
||||
public partial class EpdExit: Window
|
||||
{
|
||||
DataInterface dataInterface;
|
||||
Station thisStation;
|
||||
EpdBaseClr.Epd2 ep;
|
||||
bool EpdFound = false;
|
||||
|
|
@ -38,6 +39,7 @@ namespace eDosStation
|
|||
InitializeComponent();
|
||||
ep = curEP;
|
||||
thisStation = curStation;
|
||||
dataInterface = curStation.dataInterface;
|
||||
}
|
||||
|
||||
private void ShowAlarm()
|
||||
|
|
@ -142,8 +144,8 @@ namespace eDosStation
|
|||
var l = new SqlLog();
|
||||
try
|
||||
{
|
||||
LocalRemote.VisitExit(EpdVisitID, ep);
|
||||
l.LogCommand(LocalRemote.VisitExitCommand);
|
||||
dataInterface.VisitExit(EpdVisitID, ep);
|
||||
l.LogCommand(DataInterface.VisitExitCommand);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ namespace eDosStation
|
|||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public Station thisStation ;
|
||||
public EpdBaseClr.Epd2 ep=null;
|
||||
public DataInterface dataInterface;
|
||||
public Station thisStation;
|
||||
public EpdBaseClr.Epd2 ep = null;
|
||||
|
||||
#if SimulateEPD
|
||||
public SimulateData simulData = new SimulateData();
|
||||
|
|
@ -59,14 +60,14 @@ namespace eDosStation
|
|||
|
||||
private void MenuItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Settings s = new Settings();
|
||||
Settings s = new Settings( thisStation);
|
||||
s.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
private void setLocalStatus()
|
||||
{
|
||||
if (LocalRemote.isLocal)
|
||||
if (dataInterface.isLocal)
|
||||
{
|
||||
Status.Content = "*** Offline ***";
|
||||
Status.Foreground = Brushes.Yellow;
|
||||
|
|
@ -79,75 +80,73 @@ namespace eDosStation
|
|||
Status.Background = Brushes.White;
|
||||
}
|
||||
}
|
||||
|
||||
private void setErrorStatus(string errMsg)
|
||||
{
|
||||
Status.Content = $"*** Error {errMsg} ***";
|
||||
Status.Foreground = Brushes.Yellow;
|
||||
Status.Background = Brushes.Red;
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var cb = new System.Data.SqlClient.SqlConnectionStringBuilder(Properties.Settings.Default.eDosConnectionString);
|
||||
if (string.IsNullOrEmpty(cb.Password))
|
||||
bool ok = true;
|
||||
string errMsg = string.Empty;
|
||||
|
||||
dataInterface = new DataInterface();
|
||||
try
|
||||
{
|
||||
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);
|
||||
Close();
|
||||
thisStation = new Station(dataInterface, string.Empty);
|
||||
}
|
||||
else
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
bool ok = true;
|
||||
LocalRemote.init();
|
||||
|
||||
errMsg = $"Startup error {ex.Message} ";
|
||||
MessageBox.Show(errMsg);
|
||||
ok = false;
|
||||
}
|
||||
if (ok && thisStation.Error > 0)
|
||||
{
|
||||
errMsg = $"Startup error {thisStation.ErrorMessage} ";
|
||||
MessageBox.Show(errMsg);
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
try
|
||||
{
|
||||
thisStation = new Station(string.Empty);
|
||||
LocalRemote.SetStation(thisStation.ID_Station);
|
||||
//var sp = new System.IO.Ports.SerialPort($"com{thisStation.ComPort}");
|
||||
//sp.BaudRate = 9600;
|
||||
//sp.Parity = System.IO.Ports.Parity.None;
|
||||
//sp.StopBits = System.IO.Ports.StopBits.One;
|
||||
//sp.Open();
|
||||
//sp.DiscardInBuffer();
|
||||
//sp.Close();
|
||||
#if SimulateEPD
|
||||
thisStation.ComPort = 0;
|
||||
#endif
|
||||
ep = new EpdBaseClr.Epd2(thisStation.ComPort);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Startup error {ex.Message} ");
|
||||
errMsg = $"Edp software error {ex.Message}";
|
||||
MessageBox.Show(errMsg);
|
||||
ok = false;
|
||||
}
|
||||
if (ok && thisStation.Error > 0)
|
||||
if (ok)
|
||||
{
|
||||
if (thisStation.insComments.Length > 2)
|
||||
{
|
||||
MessageBox.Show($"Startup error {thisStation.ErrorMessage} ");
|
||||
ok = false;
|
||||
InstMessage w = new InstMessage(thisStation.tbComments);
|
||||
w.ShowDialog();
|
||||
ibComment.Child = thisStation.tbComments;
|
||||
ibComment.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (ok)
|
||||
try
|
||||
{
|
||||
//var sp = new System.IO.Ports.SerialPort($"com{thisStation.ComPort}");
|
||||
//sp.BaudRate = 9600;
|
||||
//sp.Parity = System.IO.Ports.Parity.None;
|
||||
//sp.StopBits = System.IO.Ports.StopBits.One;
|
||||
//sp.Open();
|
||||
//sp.DiscardInBuffer();
|
||||
//sp.Close();
|
||||
#if SimulateEPD
|
||||
thisStation.ComPort = 0;
|
||||
#endif
|
||||
ep = new EpdBaseClr.Epd2(thisStation.ComPort);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Edp software error {ex.Message}");
|
||||
ok = false;
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
if (thisStation.insComments.Length > 2)
|
||||
{
|
||||
InstMessage w = new InstMessage(thisStation.tbComments);
|
||||
w.ShowDialog();
|
||||
ibComment.Child = thisStation.tbComments;
|
||||
ibComment.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
ibComment.Visibility = Visibility.Hidden;
|
||||
}
|
||||
// nog niet in db
|
||||
|
||||
else
|
||||
ibComment.Visibility = Visibility.Hidden;
|
||||
setLocalStatus();
|
||||
}
|
||||
setLocalStatus();
|
||||
else
|
||||
setErrorStatus(errMsg);
|
||||
}
|
||||
|
||||
private void MEnc_Click(object sender, RoutedEventArgs e)
|
||||
|
|
|
|||
22
eDosStation/Properties/Settings.Designer.cs
generated
22
eDosStation/Properties/Settings.Designer.cs
generated
|
|
@ -107,28 +107,6 @@ namespace eDosStation.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=scksrv23;Initial Catalog=master;Integrated Security=True;TrustServerC" +
|
||||
"ertificate=True;Application Name=eDosStation")]
|
||||
public string masterConnectionString {
|
||||
get {
|
||||
return ((string)(this["masterConnectionString"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=HPHDB;Initial Catalog=eDosx;User ID=eDosStation;Password=Infopla+8;Tr" +
|
||||
"ustServerCertificate=True;Application Name=eDosStation")]
|
||||
public string eDosConnectionString {
|
||||
get {
|
||||
return ((string)(this["eDosConnectionString"]));
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
|
||||
|
|
|
|||
|
|
@ -23,22 +23,6 @@
|
|||
<Setting Name="useTestButtons" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="masterConnectionString" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<ConnectionString>Data Source=scksrv23;Initial Catalog=master;Integrated Security=True;TrustServerCertificate=True;Application Name=eDosStation</ConnectionString>
|
||||
<ProviderName>System.Data.SqlClient</ProviderName>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=scksrv23;Initial Catalog=master;Integrated Security=True;TrustServerCertificate=True;Application Name=eDosStation</Value>
|
||||
</Setting>
|
||||
<Setting Name="eDosConnectionString" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<ConnectionString>Data Source=HPHDB;Initial Catalog=eDosx;User ID=eDosStation;Password=Infopla+8;TrustServerCertificate=True;Application Name=eDosStation</ConnectionString>
|
||||
<ProviderName>System.Data.SqlClient</ProviderName>
|
||||
</SerializableConnectionString></DesignTimeValue>
|
||||
<Value Profile="(Default)">Data Source=HPHDB;Initial Catalog=eDosx;User ID=eDosStation;Password=Infopla+8;TrustServerCertificate=True;Application Name=eDosStation</Value>
|
||||
</Setting>
|
||||
<Setting Name="localConnectionString" Type="(Connection string)" Scope="Application">
|
||||
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?>
|
||||
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ namespace eDosStation
|
|||
public partial class Settings : Window
|
||||
{
|
||||
Station thisStation;
|
||||
public Settings()
|
||||
public Settings( Station tStation)
|
||||
{
|
||||
thisStation = tStation;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
|
@ -33,7 +34,7 @@ namespace eDosStation
|
|||
thisStation.Inst_Name1= tInsName1.Text;
|
||||
thisStation.Inst_Name2 = tInsName2.Text;
|
||||
thisStation.TestCSN = tTestCSN.Text;
|
||||
thisStation.Reader = cbReaders.Text;
|
||||
thisStation.Reader = cbReaders.Text;
|
||||
thisStation.Update();
|
||||
this.Close();
|
||||
if (thisStation.Error>0)
|
||||
|
|
@ -49,7 +50,6 @@ namespace eDosStation
|
|||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
thisStation = new Station(string.Empty);
|
||||
tComPort.Text = thisStation.ComPort.ToString();
|
||||
tInsCode1.Text = thisStation.Inst_CODE1.ToString();
|
||||
tInsCode2.Text = thisStation.Inst_CODE2.ToString();
|
||||
|
|
@ -57,6 +57,7 @@ namespace eDosStation
|
|||
tInsName2.Text = thisStation.Inst_Name2.ToString();
|
||||
tTestCSN.Text = thisStation.TestCSN;
|
||||
|
||||
bool rv = thisStation.dataInterface.checkCon(false);
|
||||
var a = new LSWDesfirePublic.CCard();
|
||||
a.GetReaderList();
|
||||
cbReaders.Items.Clear();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ namespace eDosStation
|
|||
{
|
||||
public class Station
|
||||
{
|
||||
|
||||
public int ID_Station { get; set; }
|
||||
public int ComPort { get; set; }
|
||||
public int Inst_CODE1 { get; set; }
|
||||
|
|
@ -27,9 +26,11 @@ namespace eDosStation
|
|||
public string ErrorMessage;
|
||||
public StringBuilder insComments;
|
||||
public TextBlock tbComments;
|
||||
public DataInterface dataInterface;
|
||||
|
||||
public Station(string Station)
|
||||
public Station(DataInterface mDataInterface, string Station)
|
||||
{
|
||||
dataInterface = mDataInterface;
|
||||
Error = 0;
|
||||
ErrorMessage = string.Empty;
|
||||
ComPort = 0;
|
||||
|
|
@ -45,7 +46,7 @@ namespace eDosStation
|
|||
tbComments.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
|
||||
tbComments.TextAlignment = System.Windows.TextAlignment.Center;
|
||||
|
||||
using (var co = LocalRemote.getCon(true))
|
||||
var co = dataInterface.getCon(true); // No dispose
|
||||
{
|
||||
using (var cmd = new SqlCommand("StationSettingsSelect", co))
|
||||
{
|
||||
|
|
@ -87,6 +88,7 @@ namespace eDosStation
|
|||
}
|
||||
}
|
||||
|
||||
dataInterface.SetStation(ID_Station);
|
||||
|
||||
if (Error == 0) using (var cmd2 = new SqlCommand("GetInstallationsComments", co))
|
||||
{
|
||||
|
|
@ -119,20 +121,19 @@ namespace eDosStation
|
|||
ErrorMessage = ex.Message;
|
||||
}
|
||||
}
|
||||
co.Close();
|
||||
co?.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
using (var co = new SqlConnection(Properties.Settings.Default.eDosConnectionString))
|
||||
var co = dataInterface.getCon(true);
|
||||
{
|
||||
using (var cmd = new SqlCommand("StationSettingsUpdate", co))
|
||||
{
|
||||
cmd.CommandType = System.Data.CommandType.StoredProcedure;
|
||||
co.Open();
|
||||
cmd.Parameters.AddWithValue("ComPort", ComPort);
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(Inst_Name1) && Inst_CODE1 > 0)
|
||||
{
|
||||
cmd.Parameters.AddWithValue("Inst_CODE1", Inst_CODE1);
|
||||
|
|
@ -147,6 +148,9 @@ namespace eDosStation
|
|||
if (!string.IsNullOrEmpty(TestCSN))
|
||||
cmd.Parameters.AddWithValue("TestCSN", TestCSN);
|
||||
|
||||
if (!string.IsNullOrEmpty(Reader))
|
||||
cmd.Parameters.AddWithValue("@Reader", Reader);
|
||||
|
||||
try
|
||||
{
|
||||
cmd.ExecuteNonQuery();
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@
|
|||
<Compile Include="InstMessage.xaml.cs">
|
||||
<DependentUpon>InstMessage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LocalRemote.cs" />
|
||||
<Compile Include="DataInterface.cs" />
|
||||
<Compile Include="Settings.cs" />
|
||||
<Compile Include="Settings.xaml.cs">
|
||||
<DependentUpon>Settings.xaml</DependentUpon>
|
||||
|
|
|
|||
|
|
@ -96,7 +96,8 @@ namespace syncEdosLocal
|
|||
foreach (DataRow rtr in dtTables.Rows)
|
||||
{
|
||||
ucmd.Parameters["OBJECT_ID"].Value = (int)rtr[0];
|
||||
dest = rtr[1].ToString();
|
||||
string src=rtr[1].ToString();
|
||||
dest = rtr[2].ToString();
|
||||
var x = rtr.GetChildRows(dtActions.ParentRelations[0]);
|
||||
Task = $"Table {dest}";
|
||||
System.Console.WriteLine($"*** Step {rtr[1].ToString()}");
|
||||
|
|
@ -139,7 +140,7 @@ namespace syncEdosLocal
|
|||
}
|
||||
|
||||
int cnt = 0;
|
||||
qry = LSWLib.SqlCommands.getColumnsQry(fromConnection, dest);
|
||||
qry = LSWLib.SqlCommands.getColumnsQry(fromConnection, src);
|
||||
SqlConnection[] curDests = new SqlConnection[] { toConnection };
|
||||
cnt = Bulker.Execute(Task, fromConnection, curDests, qry, CommandType.Text, dest, 0, ref error, ref messages);
|
||||
ucmd.Parameters["lastRecords"].Value = cnt;
|
||||
|
|
@ -178,6 +179,7 @@ namespace syncEdosLocal
|
|||
}
|
||||
static void Main(string[] args)
|
||||
{
|
||||
//Sync need both
|
||||
var SourceCoStr = System.Configuration.ConfigurationManager.ConnectionStrings["eDosConnectionString"].ConnectionString;
|
||||
var LocalCoStr = System.Configuration.ConfigurationManager.ConnectionStrings["LocalConnectionString"].ConnectionString;
|
||||
spLog = new spl("SynceDosLocal");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue