CSharp Example

From CDYNE Wiki
Jump to navigation Jump to search

Check Phone Number

 1 /*http://ws.cdyne.com/phoneverify/phoneverify.asmx?wsdl was added as Web Reference and given the name WSDL*/
 2 
 3 using System;
 4 using System.Collections.Generic;
 5 using System.Linq;
 6 using System.Text;
 7 using CheckPhoneNumber.WSDL;
 8 
 9 namespace CheckPhoneNumber
10 {
11     class Program
12     {
13         static void Main(string[] args)
14         {
15             WSDL.PhoneVerify PV = new WSDL.PhoneVerify();
16             WSDL.PhoneReturn PR = new WSDL.PhoneReturn();
17 
18             PR = PV.CheckPhoneNumber("17575449510", "YOUR LICENSE KEY");
19 
20             Console.WriteLine("Company: " + (string.IsNullOrEmpty(PR.Company) ? "No Information Found" : PR.Company));
21             Console.WriteLine("Valid: " + PR.Valid);
22             Console.WriteLine("Use: " + (string.IsNullOrEmpty(PR.Use) ? "No Information Found" : PR.Use));
23             Console.WriteLine("State: " + (string.IsNullOrEmpty(PR.State) ? "No Information Found" : PR.State));
24             Console.WriteLine("Switch: " + (string.IsNullOrEmpty(PR.Switch) ? "No Information Found" : PR.Switch));
25             Console.WriteLine("RC: " + (string.IsNullOrEmpty(PR.RC) ? "No Information Found" : PR.RC));
26             Console.WriteLine("OCN: " + (string.IsNullOrEmpty(PR.OCN) ? "No Information Found" : PR.OCN));
27             Console.WriteLine("Original Number: " + (string.IsNullOrEmpty(PR.OriginalNumber) ? "No Information Found" : PR.OriginalNumber));
28             Console.WriteLine("Clean Number: " + (string.IsNullOrEmpty(PR.CleanNumber) ? "No Information Found" : PR.CleanNumber));
29             Console.WriteLine("Switch Name: " + (string.IsNullOrEmpty(PR.SwitchName) ? "No Information Found" : PR.SwitchName));
30             Console.WriteLine("Switch Type: " + (string.IsNullOrEmpty(PR.SwitchType) ? "No Information Found" : PR.SwitchType));
31             Console.WriteLine("Country: " + (string.IsNullOrEmpty(PR.Country) ? "No Information Found" : PR.Country));
32             Console.WriteLine("CLLI: " + (string.IsNullOrEmpty(PR.CLLI) ? "No Information Found" : PR.CLLI));
33             Console.WriteLine("Prefix Type: " + (string.IsNullOrEmpty(PR.PrefixType) ? "No Information Found" : PR.PrefixType));
34             Console.WriteLine("LATA: " + (string.IsNullOrEmpty(PR.LATA) ? "No Information Found" : PR.LATA));
35             Console.WriteLine("SMS: " + (string.IsNullOrEmpty(PR.sms) ? "No Information Found" : PR.sms));
36             Console.WriteLine("Date Assigned: " + (string.IsNullOrEmpty(PR.AssignDate) ? "No Information Found" : PR.AssignDate));
37             Console.WriteLine("Telecom City: " + (string.IsNullOrEmpty(PR.TelecomCity) ? "No Information Found" : PR.TelecomCity));
38             Console.WriteLine("Telecom County: " + (string.IsNullOrEmpty(PR.TelecomCounty) ? "No Information Found" : PR.TelecomCounty));
39             Console.WriteLine("Telecom State: " + (string.IsNullOrEmpty(PR.TelecomState) ? "No Information Found" : PR.TelecomState));
40             Console.WriteLine("Telecom Zip: " + (string.IsNullOrEmpty(PR.TelecomZip) ? "No Information Found" : PR.TelecomZip));
41             Console.WriteLine("Time Zone: " + (string.IsNullOrEmpty(PR.TimeZone) ? "No Information Found" : PR.TimeZone));
42             Console.WriteLine("Latitude: " + (string.IsNullOrEmpty(PR.Lat) ? "No Information Found" : PR.Lat)); 
43             Console.WriteLine("Longitude: " + (string.IsNullOrEmpty(PR.Long) ? "No Information Found" : PR.Long));
44             Console.WriteLine("Wireless: " + PR.Wireless);
45 
46             Console.ReadLine();
47         }
48     }
49 }

Check Phone Numbers

 1 /*http://ws.cdyne.com/phoneverify/phoneverify.asmx?wsdl was added as Web Reference and given the name WSDL*/
 2 
 3 using System;
 4 using System.Collections.Generic;
 5 using System.Linq;
 6 using System.Text;
 7 using CheckPhoneNumbers.WSDL;
 8 
 9 namespace CheckPhoneNumbers
10 {
11     class Program
12     {
13         static void Main(string[] args)
14         {
15             WSDL.PhoneVerify PV = new WSDL.PhoneVerify();
16 
17             String PhoneNumbers = "17575449510, 18009843710";
18             string[] PhoneNumbersArray = PhoneNumbers.Split(',');
19             const string LicenseKey = "YOUR LICENSE KEY";
20 
21             Array Numbers = PV.CheckPhoneNumbers(PhoneNumbersArray, LicenseKey);
22 
23             foreach (WSDL.PhoneReturn PR in Numbers)
24             {
25             Console.WriteLine("Company: " + (string.IsNullOrEmpty(PR.Company) ? "No Information Found" : PR.Company));
26             Console.WriteLine("Valid: " + PR.Valid);
27             Console.WriteLine("Use: " + (string.IsNullOrEmpty(PR.Use) ? "No Information Found" : PR.Use));
28             Console.WriteLine("State: " + (string.IsNullOrEmpty(PR.State) ? "No Information Found" : PR.State));
29             Console.WriteLine("Switch: " + (string.IsNullOrEmpty(PR.Switch) ? "No Information Found" : PR.Switch));
30             Console.WriteLine("RC: " + (string.IsNullOrEmpty(PR.RC) ? "No Information Found" : PR.RC));
31             Console.WriteLine("OCN: " + (string.IsNullOrEmpty(PR.OCN) ? "No Information Found" : PR.OCN));
32             Console.WriteLine("Original Number: " + (string.IsNullOrEmpty(PR.OriginalNumber) ? "No Information Found" : PR.OriginalNumber));
33             Console.WriteLine("Clean Number: " + (string.IsNullOrEmpty(PR.CleanNumber) ? "No Information Found" : PR.CleanNumber));
34             Console.WriteLine("Switch Name: " + (string.IsNullOrEmpty(PR.SwitchName) ? "No Information Found" : PR.SwitchName));
35             Console.WriteLine("Switch Type: " + (string.IsNullOrEmpty(PR.SwitchType) ? "No Information Found" : PR.SwitchType));
36             Console.WriteLine("Country: " + (string.IsNullOrEmpty(PR.Country) ? "No Information Found" : PR.Country));
37             Console.WriteLine("CLLI: " + (string.IsNullOrEmpty(PR.CLLI) ? "No Information Found" : PR.CLLI));
38             Console.WriteLine("Prefix Type: " + (string.IsNullOrEmpty(PR.PrefixType) ? "No Information Found" : PR.PrefixType));
39             Console.WriteLine("LATA: " + (string.IsNullOrEmpty(PR.LATA) ? "No Information Found" : PR.LATA));
40             Console.WriteLine("SMS: " + (string.IsNullOrEmpty(PR.sms) ? "No Information Found" : PR.sms));
41             Console.WriteLine("Date Assigned: " + (string.IsNullOrEmpty(PR.AssignDate) ? "No Information Found" : PR.AssignDate));
42             Console.WriteLine("Telecom City: " + (string.IsNullOrEmpty(PR.TelecomCity) ? "No Information Found" : PR.TelecomCity));
43             Console.WriteLine("Telecom County: " + (string.IsNullOrEmpty(PR.TelecomCounty) ? "No Information Found" : PR.TelecomCounty));
44             Console.WriteLine("Telecom State: " + (string.IsNullOrEmpty(PR.TelecomState) ? "No Information Found" : PR.TelecomState));
45             Console.WriteLine("Telecom Zip: " + (string.IsNullOrEmpty(PR.TelecomZip) ? "No Information Found" : PR.TelecomZip));
46             Console.WriteLine("Time Zone: " + (string.IsNullOrEmpty(PR.TimeZone) ? "No Information Found" : PR.TimeZone));
47             Console.WriteLine("Latitude: " + (string.IsNullOrEmpty(PR.Lat) ? "No Information Found" : PR.Lat)); 
48             Console.WriteLine("Longitude: " + (string.IsNullOrEmpty(PR.Long) ? "No Information Found" : PR.Long));
49             Console.WriteLine("Wireless: " + PR.Wireless + "\n\n");
50             }
51             Console.ReadLine();
52         }
53     }
54 }