public void TestMercuryDestinations()
        {
            var mercury = new MercuryDestinations {
                DestinationType = "CALLROUTING_EMAIL"
            };

            Assert.IsTrue(mercury.Execute(), mercury.LastError);

            var results = mercury.Results;

            Assert.IsTrue(results != null);
            var table = results.Tables[0];

            for (var i = 0; i <= table.Rows.Count - 1; i++)
            {
                Console.WriteLine("{0} {1}",
                                  table.Rows[i][0],
                                  results.Tables[0].Rows[i][1]);
            }
        }
Exemple #2
0
        /// <summary>
        /// GetMercuryDestinations
        /// Returns all email addresses from MERCURY table for type type
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public static string GetMercuryDestinations(string type)
        {
            var destinations = String.Empty;

            try
            {
                var mercury = new MercuryDestinations {
                    DestinationType = type
                };

                Assert.Test(mercury.Execute(), mercury.LastError);

                var results = mercury.Results;
                Assert.Test(results != null, "no records returned.");

                DataTable table = null;
                if (results != null)
                {
                    table = results.Tables[0];
                }
                if (table != null)
                {
                    for (var i = 0; i <= table.Rows.Count - 1; i++)
                    {
                        if (destinations.Length > 0)
                        {
                            destinations += ", ";
                        }

                        destinations += table.Rows[i][0].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogError("GetMercuryDestinations(): ERROR: " + ex.Message, Component);
            }
            return(destinations);
        }