public void TestMethod1() { var ops = new ClientOperations(); var dt = ops.GetCustomersWithContains("Fr"); Assert.IsTrue(dt.Rows.Count == 2, "Expected two for SqlClient test"); }
private void WaitForSocketClientConnect() { bool LBoolReturn = true; string LStrReturn = string.Empty; FileLog.WriteInfo("WaitForSocketClientConnect()", ""); try { while (IBoolCanContinue) { if (!ITcpListener.Pending()) { Thread.Sleep(200); continue; } TcpClient LTcpClient = ITcpListener.AcceptTcpClient(); if (!IBoolCanContinue) { return; } IBoolIsBusing = true; ClientOperations LClientOperations = new ClientOperations(LTcpClient); Thread LClientThread = new Thread(new ThreadStart(LClientOperations.ClientMessageOperation)); FileLog.WriteInfo("WaitForSocketClientConnect()", "1"); AddConnectedClientAndThread(LClientOperations, LClientThread, ref LBoolReturn, ref LStrReturn); if (LBoolReturn) { LClientThread.Start(); } else { FileLog.WriteError("WaitForSocketClientConnect()", LStrReturn); } Thread.Sleep(100); IBoolIsBusing = false; } } catch (Exception ex) { IBoolCanContinue = false; FileLog.WriteInfo("WaitForSocketClientConnect()", "Failed\n" + ex.ToString()); } }
private void WaitForSocketClientConnect() { bool LBoolReturn = true; string LStrReturn = string.Empty; try { while (IBoolCanContinue) { if (!ITcpListener.Pending()) { Thread.Sleep(200); continue; } TcpClient LTcpClient = ITcpListener.AcceptTcpClient(); if (!IBoolCanContinue) { return; } IBoolIsBusing = true; ClientOperations LClientOperations = new ClientOperations(LTcpClient); Thread LClientThread = new Thread(new ThreadStart(LClientOperations.ClientMessageOperation)); // BIsServiceStart = true; //UMPService00.IEventLog.WriteEntry("BIsServiceStart = " + BIsServiceStart, EventLogEntryType.Warning); AddConnectedClientAndThread(LClientOperations, LClientThread, ref LBoolReturn, ref LStrReturn); if (LBoolReturn) { LClientThread.Start(); } else { WriteEntryLog(LStrReturn, EventLogEntryType.Error); } Thread.Sleep(100); IBoolIsBusing = false; } } catch (Exception ex) { IBoolCanContinue = false; WriteEntryLog("WaitForSocketClientConnect() Failed\n" + ex.ToString(), EventLogEntryType.Error); } }
private void AddConnectedClientAndThread(ClientOperations AClientOperation, Thread AClientThread, ref bool ABoolReturn, ref string AStrReturn) { try { ABoolReturn = true; AStrReturn = string.Empty; lock (ILockObject) { GlobalListConnectedClient.Add(AClientOperation); GlobalListClientThread.Add(AClientThread); WriteEntryLog("AddConnectedClientAndThread() GlobalListClientThread.Count = " + GlobalListClientThread.Count.ToString() + " GlobalListConnectedClient.Count = " + GlobalListConnectedClient.Count.ToString(), EventLogEntryType.Information); } } catch (Exception ex) { ABoolReturn = false; AStrReturn = "AddConnectedClientAndThread()\n" + ex.Message; } }
private void AddConnectedClientAndThread(ClientOperations AClientOperation, Thread AClientThread, ref bool ABoolReturn, ref string AStrReturn) { try { ABoolReturn = true; AStrReturn = string.Empty; lock (ILockObjectCheckThread) { GlobalListConnectedClient.Add(AClientOperation); GlobalListClientThread.Add(AClientThread); FileLog.WriteInfo("AddConnectedClientAndThread()", "AddConnectedClientAndThread() GlobalListClientThread.Count = " + GlobalListClientThread.Count.ToString() + " GlobalListConnectedClient.Count = " + GlobalListConnectedClient.Count.ToString()); } } catch (Exception ex) { ABoolReturn = false; AStrReturn = "AddConnectedClientAndThread()\n" + ex.Message; FileLog.WriteError("AddConnectedClientAndThread()", ex.Message.ToString()); } }
protected override void OnConfigurationUpdated(IConfigurationRequestContext context, ClientOperations clientOps, MyConfiguration oldConfiguration) { SysUtils.ReportInfoToEventLog($"Updated (simple) configuration is:\r\n{this.Configuration}"); }