Files
feanor/Maser.Feanor.Biz/SQLmethods.cs
Martijn Dijkstra 6a44bd4fd2 Add project files.
2025-05-08 09:10:15 +02:00

50 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Maser.Feanor.Model;
namespace Maser.Feanor.Biz
{
public static class SQLMethods
{
public static string FormatSQL(this DateTime? dt)
{
if (dt == null)
return null;
// SQL format is '2016-12-15 12:24:32.427'
return String.Format("{0:yyyy-MM-dd HH:mm:ss:fff}", dt);
}
public static string FormatSQL(this DateTime dt)
{
// SQL format is '2016-12-15 12:24:32.427'
return String.Format("{0:yyyy-MM-dd HH:mm:ss:fff}", dt);
}
public static bool DatabaseOnline(Int32 TimeOutSec)
{
DateTime dtTimeout = DateTime.Now.AddSeconds(TimeOutSec);
while (DateTime.Now < dtTimeout)
{
try
{
new Chambers().GetAllActive();
return true;
}
catch { }
System.Threading.Thread.Sleep(1000);
}
return false;
}
}
}