コード例 #1
0
        public static dynamic CreateE911Address(FlowrouteNumbersAndMessagingClient client)
        {
            E911Controller e911s = client.E911s;
            E911           body  = new E911();

            body.StreetName        = "3rd Ave";
            body.StreetNumber      = "1111";
            body.AddressType       = "Suite";
            body.AddressTypeNumber = "200";
            body.City      = "Seattle";
            body.State     = "WA";
            body.Country   = "US";
            body.FirstName = "John";
            body.LastName  = "Doe";
            body.Label     = "Potbelly";
            body.Zip       = "98101";

            try
            {
                dynamic result = e911s.CreateE911Address(body);
                Console.WriteLine(result);
                return(result);
            } catch (FlowrouteNumbersAndMessaging.Standard.Exceptions.ErrorException e) {
                Console.WriteLine(e);
                return(null);
            }
        }
コード例 #2
0
        public static dynamic ListE911Details(FlowrouteNumbersAndMessagingClient client, string id)
        {
            // User the E911 Controller from our Client
            E911Controller e911s = client.E911s;

            Console.WriteLine("---------------------------\nList E911 Details:\n");
            dynamic result = e911s.E911Details(id);

            Console.WriteLine(result);
            return(result);
        }
コード例 #3
0
        public static dynamic AssociateE911(FlowrouteNumbersAndMessagingClient client, string number_id, string e911_id)
        {
            E911Controller e911s = client.E911s;

            try
            {
                dynamic result = e911s.AssociateE911(number_id, e911_id);
                Console.WriteLine(result);
                return(result);
            } catch (FlowrouteNumbersAndMessaging.Standard.Exceptions.ErrorException e) {
                Console.WriteLine(e);
                return(null);
            }
        }
コード例 #4
0
        public static dynamic GetE911Records(FlowrouteNumbersAndMessagingClient client)
        {
            ArrayList return_list = new ArrayList();

            // List all E911 records in our account paging through them 1 at a time
            //  If you have several phone numbers, change the 'limit' variable below
            //  This example is intended to show how to page through a list of resources

            int?limit  = 100;
            int?offset = 0;

            E911Controller e911s = client.E911s;

            do
            {
                dynamic e911_data = e911s.ListE911s(limit, offset);

                // Iterate through each number item
                foreach (var item in e911_data.data)
                {
                    Console.WriteLine("---------------------------\nE911 Record:\n");
                    Console.WriteLine("Attributes:{0}\nId:{1}\nLinks:{2}\nType:{3}\n", item.attributes, item.id, item.links, item.type);
                    return_list.Add((string)item.id);
                }

                // See if there is more data to process
                var links = e911_data.links;
                if (links.next != null)
                {
                    // more data to pull
                    offset += limit;
                }
                else
                {
                    break;   // no more data
                }
            }while (true);

            Console.WriteLine("Processing Complete");
            return(return_list);
        }
コード例 #5
0
        public static dynamic ValidateE911(FlowrouteNumbersAndMessagingClient client)
        {
            E911Controller e911s = client.E911s;
            E911           body  = new E911();

            body.StreetName        = "N Vassault";
            body.StreetNumber      = "3901";
            body.AddressType       = null;
            body.AddressTypeNumber = null;
            body.City      = "Tacoma";
            body.State     = "WA";
            body.Country   = "US";
            body.FirstName = "John";
            body.LastName  = "Doe";
            body.Label     = "Home";
            body.Zip       = "98407";

            dynamic result = e911s.ValidateE911(body);

            Console.WriteLine(result);
            return(result);
        }
コード例 #6
0
        public static dynamic UpdateE911Address(FlowrouteNumbersAndMessagingClient client, string e911_id, string new_label)
        {
            E911Controller e911s  = client.E911s;
            dynamic        result = e911s.E911Details(e911_id);

            string jsonstring = result.ToString();

            Newtonsoft.Json.Linq.JObject j = Newtonsoft.Json.Linq.JObject.Parse(jsonstring);
            string old_label = (string)j["data"]["attributes"]["label"];
            E911   body      = new E911();

            body.AddressType       = (string)j["data"]["attributes"]["address_type"];
            body.AddressTypeNumber = (string)j["data"]["attributes"]["address_type_number"];
            body.AdressNumber      = (string)j["data"]["attributes"]["street_number"];
            body.City         = (string)j["data"]["attributes"]["city"];
            body.Country      = (string)j["data"]["attributes"]["country"];
            body.FirstName    = (string)j["data"]["attributes"]["first_name"];
            body.Id           = (string)j["data"]["id"];
            body.LastName     = (string)j["data"]["attributes"]["last_name"];
            body.State        = (string)j["data"]["attributes"]["state"];
            body.StreetName   = (string)j["data"]["attributes"]["street_name"];
            body.StreetNumber = (string)j["data"]["attributes"]["street_number"];
            body.Zip          = (string)j["data"]["attributes"]["zip"];
            body.Label        = (string)new_label;

            try
            {
                dynamic submissin_result = e911s.UpdateE911Address(body);
                Console.WriteLine(result);
                return(result);
            }
            catch (FlowrouteNumbersAndMessaging.Standard.Exceptions.ErrorException e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }