CheckClientsSql

This commit is contained in:
Luc Vandenbroucke 2022-02-22 07:50:04 +01:00
parent 8272124703
commit 7a7e7aa485
10 changed files with 206 additions and 10 deletions

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>CheckRemoteeDosLocal</RootNamespace>
<AssemblyName>CheckRemoteeDosLocal</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CheckRemoteeDosLocal
{
class Program
{
static System.Net.NetworkInformation.Ping nip;
static System.Data.SqlClient.SqlConnectionStringBuilder cb;
static System.Data.SqlClient.SqlConnection coeDosLocal;
static void init()
{
cb = new System.Data.SqlClient.SqlConnectionStringBuilder()
{
DataSource = "192.168.113.160",
InitialCatalog = "eDosLocal",
IntegratedSecurity = false,
NetworkLibrary = "dbmssocn",
TrustServerCertificate = true,
Authentication = System.Data.SqlClient.SqlAuthenticationMethod.SqlPassword,
UserID = "sa",
Password = "HPHEdos"
};
}
static bool openCon(int ipLastByte)
{
bool rv = false;
cb.DataSource = $"192.168.113.{ipLastByte}";
nip = new System.Net.NetworkInformation.Ping();
var pr = nip.Send(cb.DataSource);
if (pr.Status == System.Net.NetworkInformation.IPStatus.Success)
{
coeDosLocal = new System.Data.SqlClient.SqlConnection(cb.ConnectionString);
try
{
coeDosLocal.Open();
rv = true;
}
catch (System.Exception ex)
{
System.Console.WriteLine($"No sql open from ${cb.DataSource} : {ex.Message}");
}
}
else
System.Console.WriteLine($"No answer from ${cb.DataSource}");
return rv;
}
static void Main(string[] args)
{
init();
for (int ix = 160; ix <= 170; ix++)
{
if (openCon(ix))
{
System.Console.WriteLine($"sql ok from ${cb.DataSource} ");
coeDosLocal.Close();
}
}
}
}
}

View file

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CheckRemoteeDosLocal")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CheckRemoteeDosLocal")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("41fcbaff-5fc7-49a1-9a97-23b8f0742f59")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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")]

View file

@ -31,6 +31,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Epd3Base", "EpdBase3\EpdBas
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eDosPrep", "eDosPrep\eDosPrep.vcxproj", "{294068AF-EA7B-4851-97B2-2AB5F64167D9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheckRemoteeDosLocal", "CheckRemoteeDosLocal\CheckRemoteeDosLocal.csproj", "{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -261,6 +263,26 @@ Global
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Release|x64.Build.0 = Release|x64
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Release|x86.ActiveCfg = Release|Win32
{294068AF-EA7B-4851-97B2-2AB5F64167D9}.Release|x86.Build.0 = Release|Win32
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Debug|ARM.ActiveCfg = Debug|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Debug|ARM.Build.0 = Debug|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Debug|ARM64.Build.0 = Debug|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Debug|x64.ActiveCfg = Debug|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Debug|x64.Build.0 = Debug|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Debug|x86.ActiveCfg = Debug|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Debug|x86.Build.0 = Debug|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Release|Any CPU.Build.0 = Release|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Release|ARM.ActiveCfg = Release|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Release|ARM.Build.0 = Release|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Release|ARM64.ActiveCfg = Release|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Release|ARM64.Build.0 = Release|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Release|x64.ActiveCfg = Release|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Release|x64.Build.0 = Release|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Release|x86.ActiveCfg = Release|Any CPU
{41FCBAFF-5FC7-49A1-9A97-23B8F0742F59}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -7,7 +7,7 @@
x:Class="eDosStation.EntryBadge"
mc:Ignorable="d"
Title="EntryBadge"
Height="980" Width="1820" ResizeMode="NoResize" FontFamily="Segoe UI" FontSize="36"
Height="980" Width="1820" ResizeMode="NoResize" FontFamily="Segoe UI" FontSize="36"
Loaded="Window_Loaded"
WindowStartupLocation="CenterScreen" WindowState="Maximized" Closing="Window_Closing"
>

View file

@ -785,7 +785,6 @@ namespace eDosStation
this.Dispatcher.InvokeAsync(new Action(() => endPage()),DispatcherPriority.Normal);
}
private bool SelectTask(string id_task)
{
System.Windows.Data.CollectionViewSource getTaskListViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("getTaskListViewSource")));
@ -825,7 +824,6 @@ namespace eDosStation
numPanel.Visibility = Visibility.Collapsed;
//getTaskListViewSource
//var x = this.findvie
break;
}
}
@ -838,7 +836,9 @@ namespace eDosStation
numPanel.Visibility = Visibility.Visible;
scrollTask.Visibility = Visibility.Collapsed;
numPanel1.Focus();
} else {
}
else
{
scrollTask.Visibility = Visibility.Visible;
numPanel.Visibility = Visibility.Collapsed;
}
@ -847,9 +847,9 @@ namespace eDosStation
private void DFReader_Badged(LSWDesfirePublic.CCard Sender, LSWDesfirePublic.BadgeEventArgs e)
{
if (e.PersID > 0)
{
this.Dispatcher.InvokeAsync(new Action(() => showBadge(e.PersID, e.UID)),DispatcherPriority.Background);
}
this.Dispatcher.InvokeAsync(new Action(() => showBadge(e.PersID, e.UID)), DispatcherPriority.Background);
else
MessageBox.Show("No PersID found on badge " + e.UID, "Error", MessageBoxButton.OK);
}
}
}

View file

@ -156,7 +156,7 @@ namespace eDosStation
Wait.IsSelected = true;
dispatcherTimer.Start();
ResultTime = DateTime.Now.AddMilliseconds(thisStation.EPDTimeOut);
Dispatcher.InvokeAsync(() => ep.Wait(thisStation.EPDTimeOut, 1), DispatcherPriority.Background);
Dispatcher.InvokeAsync(() => ep.Wait(thisStation.EPDTimeOut, thisStation.EPDRetries), DispatcherPriority.Background);
}
private void BCloseExit_Click(object sender, RoutedEventArgs e)

View file

@ -29,6 +29,7 @@ namespace eDosStation
public bool checkUser { get; internal set; }
public int EPDTimeOut { get; internal set; }
public int EPDRetries { get; internal set; }
public bool Changed = false;
public int Error = 0;
public string ErrorMessage;
@ -65,6 +66,7 @@ namespace eDosStation
tbComments.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
tbComments.TextAlignment = System.Windows.TextAlignment.Center;
EPDTimeOut = 10000; //ms
EPDRetries = 2;
beepMk3Map = new Dictionary<byte, ushort>();
beepMk3Map.Add(0b00010111, 0b1001110011100001);
@ -134,6 +136,12 @@ namespace eDosStation
if (rs.IsDBNull(c)) EPDTimeOut = 10000; else EPDTimeOut= (int)Values[c];
}
catch { EPDTimeOut= 10000; }
try
{
c = rs.GetOrdinal("EPDRetries");
if (rs.IsDBNull(c)) EPDRetries = 2; else EPDRetries = (int)Values[c];
}
catch { EPDRetries = 2; }
}
else
{
@ -148,6 +156,7 @@ namespace eDosStation
Reader = System.Configuration.ConfigurationManager.AppSettings["Reader"];
checkUser = false;
EPDTimeOut = 10000;
EPDRetries = 2;
}
rs.Close();
}
@ -238,6 +247,7 @@ namespace eDosStation
cmd.Parameters.AddWithValue("checkUser", checkUser);
cmd.Parameters.AddWithValue("useBeep", useBeep);
cmd.Parameters.AddWithValue("EPDTimeout", EPDTimeOut);
cmd.Parameters.AddWithValue("EPDRetries", EPDRetries);
try
{

View file

@ -103,10 +103,10 @@ namespace syncEdosLocal
static LSWLib.Bulker Bulker;
static cResult Result;
public static int? CreateStationID (SqlConnection eDosLocalCon, SqlConnection eDosCon )
{
var c1 = eDosCon.State;
if (c1 != ConnectionState.Open) eDosCon.Open();
var c2 = eDosLocalCon.State;
@ -288,12 +288,12 @@ namespace syncEdosLocal
}
static void Main(string[] args)
{
spLog = new spl("SynceDosLocal");
Bulker = new LSWLib.Bulker(spLog, true);
messages = Bulker.messages;
messages.AppendLine(spLog.GetStartInfoString());
//Sync need both
var SourceCoStr = new SqlConnectionStringBuilder(System.Configuration.ConfigurationManager.ConnectionStrings["eDosConnectionString"].ConnectionString);
var LocalCoStr = new SqlConnectionStringBuilder(System.Configuration.ConfigurationManager.ConnectionStrings["LocalConnectionString"].ConnectionString);