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; } } }