This commit is contained in:
parent
fb1243a519
commit
88a8609b3e
|
|
@ -84,4 +84,26 @@ public class ClsConstants
|
||||||
{
|
{
|
||||||
dctScheduler[TaskName] = theTime;
|
dctScheduler[TaskName] = theTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static bool CanWeGo(byte whichLevel)
|
||||||
|
{
|
||||||
|
var rv = true;
|
||||||
|
lock (Program.objSync2)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var cn = new SqlConnection(kmCommonLibsCore.Constants.cnCommon))
|
||||||
|
{
|
||||||
|
rv = (Convert.ToInt32(cn.ExecuteScalar($"Select dbo.rdbCanWeGo({whichLevel})")) == 1) ? true : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch // Something is wrong with SQL, so don't let anything run
|
||||||
|
{
|
||||||
|
rv = false;
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rv;
|
||||||
|
} //CanWeGo
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ internal class ServiceMain : ServiceControl
|
||||||
while (!Program.isExiting)
|
while (!Program.isExiting)
|
||||||
{
|
{
|
||||||
Thread.Sleep(rn.Next(250, 1500));
|
Thread.Sleep(rn.Next(250, 1500));
|
||||||
if (dtNext < DateTimeOffset.Now)
|
if (ClsConstants.CanWeGo(1) && dtNext < DateTimeOffset.Now)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@ internal class Program
|
||||||
internal static string AppName = AppDomain.CurrentDomain.FriendlyName.Trim();
|
internal static string AppName = AppDomain.CurrentDomain.FriendlyName.Trim();
|
||||||
internal static string MachineName = Environment.MachineName.Trim();
|
internal static string MachineName = Environment.MachineName.Trim();
|
||||||
|
|
||||||
public static bool isExiting = false;
|
internal static bool isExiting = false;
|
||||||
|
internal static object objSync2 = new(); // used by the CanWeGo proc in Constants
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue