static int Main(string[] args) { Logger.EnableLogger(); if (args.Length < 1 || args.Length > 2) { Console.WriteLine("Usage: HydrometNotifications.exe alarm_group [\"m/d/yyyy hh:mm\"]"); Console.WriteLine("Where: alarm_group argument is required"); Console.WriteLine("[m/d/yyyy] is an optional date argument the default is now"); Console.WriteLine(""); return(-1); } Performance perf = new Performance(); var alarms = new AlarmGroup(args[0]); DateTime t = DateTime.Now; if (args.Length == 2) { t = DateTime.Parse(args[1]); } else if (alarms.Interval.ToLower() == "d") { t = DateTime.Now.Date.AddDays(-1); // hydromet daily } alarms.ProcessGroup(t); perf.Report(); PostgreSQL.ClearAllPools(); return(0); }
static void Main(string[] args) { Logger.EnableLogger(true); try { string fileName = GetFileName(args); HydrometInfoUtility.SetDefaultHydrometServer(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadExit += new EventHandler(Application_ThreadExit); Application.ApplicationExit += new EventHandler(Application_ApplicationExit); piscesForm1 = new PiscesForm(fileName); piscesForm1.FormClosed += new FormClosedEventHandler(explorerForm1_FormClosed); Application.Run(piscesForm1); PostgreSQL.ClearAllPools(); FileUtility.CleanTempPath(); } catch (Exception exc) { MessageBox.Show(exc.ToString()); } }
private static void Cleanup() { try { HydrometTools.ssh.Utility.Close(); PostgreSQL.ClearAllPools(); } catch (Exception) { } }
private static void UpdateSequences(PostgreSQL svr) { // fix sequences string sql = "" + "SELECT setval('datapresentationidseq', (SELECT MAX(id) FROM datapresentation)); " + "SELECT setval('datasourceidseq', (SELECT MAX(id) FROM datasource));" + "SELECT setval('datatypeidseq', (SELECT MAX(id) FROM datatype)); " + "SELECT setval('decodesscriptidseq', (SELECT MAX(id) FROM decodesscript)); " + "SELECT setval('enumidseq', (SELECT MAX(id) FROM enum)); " + "SELECT setval('equipmentidseq', (SELECT MAX(id) FROM equipmentmodel)); " + "SELECT setval('networklistidseq', (SELECT MAX(id) FROM networklist)); " + "SELECT setval('platformconfigidseq', (SELECT MAX(id) FROM platformconfig)); " + "SELECT setval('platformidseq', (SELECT MAX(id) FROM platform)); " + "SELECT setval('presentationgroupidseq', (SELECT MAX(id) FROM presentationgroup)); " + "SELECT setval('routingspecidseq', (SELECT MAX(id) FROM routingspec)); " + "SELECT setval('siteidseq', (SELECT MAX(id) FROM site)); " + "SELECT setval('unitconverteridseq', (SELECT MAX(id) FROM unitconverter)); "; Console.WriteLine(sql); svr.RunSqlCommand(sql); PostgreSQL.ClearAllPools(); }
static void Main(string[] args) { Logger.EnableLogger(true); var x = HdbPoet.Hdb.Instance; // force this assembly to load. try { string fileName = ""; if (args.Length == 1) { fileName = args[0]; if (!File.Exists(fileName)) { MessageBox.Show("Could not open file '" + fileName + "'"); return; } } else if (UserPreference.Lookup("fileName") != "" && File.Exists(UserPreference.Lookup("fileName")) && Path.GetExtension(UserPreference.Lookup("fileName")) != ".sdf") { fileName = UserPreference.Lookup("fileName"); } else {// open default database fileName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\tsdatabase.pdb"; } if (!File.Exists(fileName)) { SQLiteServer.CreateNewDatabase(fileName); } HydrometInfoUtility.SetDefaultHydrometServer(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadExit += new EventHandler(Application_ThreadExit); Application.ApplicationExit += new EventHandler(Application_ApplicationExit); //Application.Idle += new EventHandler(Application_Idle); //Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); explorer = new PiscesSettings(new ExplorerView()); // explorer.Database explorer.Open(fileName); db = explorer.Database; piscesForm1 = new PiscesForm(explorer); piscesForm1.FormClosed += new FormClosedEventHandler(explorerForm1_FormClosed); //Pisces2 p2 = new Pisces2(explorer); //p2.FormClosed += new FormClosedEventHandler(explorerForm1_FormClosed); Application.Run(piscesForm1); explorer.Database.SaveSettingsToDatabase(explorer.TimeWindow); //db.SaveSettingsToDatabase(explorer.TimeWindow); PostgreSQL.ClearAllPools(); FileUtility.CleanTempPath(); } catch (Exception exc) { MessageBox.Show(exc.ToString()); } }