protected static OperatorNodeCollection GetOperators(bool filter, int status) { OperatorNodeCollection operators = new OperatorNodeCollection(); SqlStoredProcedureAccessor sp = null; SqlDataReaderAccessor data = null; try { sp = new SqlStoredProcedureAccessor("UI_operatorsList_get"); if (filter && -1 != status) { sp.Parameters.Add("@StatusID", SqlDbType.TinyInt); sp.Parameters.SetInt("@StatusID", status); } data = sp.ExecuteReader(); while (data.Read()) { operators.Add(data.GetString("OperatorKey"), (OperatorStatus)data.GetInt("OperatorStatusID"), data.GetString("Name"), data.GetString("soapReplicationUrl")); } } finally { if (null != data) { data.Close(); } if (null != sp) { sp.Close(); } } return(operators); }
static void Main(string[] args) { Console.WriteLine("Microsoft (R) UDDI Monitor Utility"); Console.WriteLine("Copyright (C) Microsoft Corp. 2002. All rights reserved.\r\n"); try { ProcessCommandLine(args); ArrayList results = new ArrayList(); ConnectionManager.Open(false, false); // // Get the list of known operatorNodes. // OperatorNodeCollection operatorNodes = new OperatorNodeCollection(); operatorNodes.Get(); // // Get the last notification message status for each operator. // foreach (OperatorNode operatorNode in operatorNodes) { ReplicationResult result = new ReplicationResult(); result.GetLast(operatorNode.OperatorNodeID, true); results.Add(result); } // // Monitor changes to operator status every 5 seconds. // while (true) { Console.WriteLine("Polling for new notifications: {0}. Press Ctrl+C to stop.", DateTime.Now); for (int i = 0; i < operatorNodes.Count; i++) { ReplicationResult lastResult = (ReplicationResult)results[i]; ReplicationResult result = new ReplicationResult(); result.GetLast(operatorNodes[i].OperatorNodeID, true); // // Check to see if a notification message has been received // if (result.LastChange > lastResult.LastChange) { DateTime time = new DateTime(result.LastChange); Console.WriteLine( "\r\n\tnotify_changeRecordsAvailable detected\r\n\t\tNode: {0}\r\n\t\tTime: {1}", result.OperatorNodeID, time); // // Execute the specified file. // Console.WriteLine( "\t\tStarting: {0} -o {1}", Program, result.OperatorNodeID); Process process = Process.Start(Program, "-o " + result.OperatorNodeID); process.WaitForExit(); Console.WriteLine( "\t\tReturn code: {0}\r\n", process.ExitCode); // // Save the current notify result so that we don't // reprocess. // results[i] = result; } } System.Threading.Thread.Sleep(PollInterval); } } catch (CommandLineException e) { if (null != e.Message && e.Message.Length > 0) { Console.WriteLine(e.Message); Console.WriteLine(); } else { DisplayUsage(); } } catch (Exception e) { Console.WriteLine("Exception: {0}", e.ToString()); } finally { ConnectionManager.Close(); } return; }