private BComRateCenterInventoryResponse rateCenterStatus(string state) { // Create an HTTPS_ Interface. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Create SipPeer Request BComRateCenterInventoryRequest request = new BComRateCenterInventoryRequest(); // Load the request. try { request.State = state.SafeToString(); } catch (Exception ex) { throw new ApplicationException("Failed loading the state code: " + ex.Message); } // Send the request and get the response. BComRateCenterInventoryResponse response = httpsInterface.rateCenterResponse(request); // Return the response. return(response); }
public static BComOrderStatusResponse OrderStatus(DataRow orderRow) { // Create an HTTPS_ Interface. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Create SipPeer Request BComOrderStatusRequest request = new BComOrderStatusRequest(); // Load the request. try { request.OrderId = orderRow["OrderId"].SafeToString(); } catch (Exception ex) { throw new ApplicationException("Failed loading Aviator data into order: " + ex.Message); } // Send the request and get the response. BComOrderStatusResponse response = httpsInterface.OrderStatus(request); // Return the response. return(response); }
private BComDiscoOrderResponse DisconnectSingleTN(string coid, string name, TelephoneNumberList tnList) { // Create an HTTPS_ Interface. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Create Disconnect Request BComDiscoOrderRequest request = new BComDiscoOrderRequest(); // Load the request. request.DisconnectTelephoneNumberOrder = new DisconnectTelephoneNumberOrder(); request.DisconnectTelephoneNumberOrder.CustomerOrderId = coid; request.DisconnectTelephoneNumberOrder.name = name; request.DisconnectTelephoneNumberOrder.DisconnectTelephoneNumberOrderType = new DisconnectTelephoneNumberOrderType(); request.DisconnectTelephoneNumberOrder.DisconnectTelephoneNumberOrderType.TelephoneNumberList = tnList; // Make a copy of the requests raw xml. this.requestXML = request.ToXml(); // Send the request and get the response. BComDiscoOrderResponse response = httpsInterface.DisconnectSingleTN(request); // Return the response. return(response); }
private BComGetPortOutsResponse lnpResponseWrapperStatus() { // Create an HTTPS_ Interface. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Send the request and get the response. BComGetPortOutsResponse response = httpsInterface.lnpResponseWrapper(); // Return the response. return(response); }
private BComSiteResponse CreateNewSiteID(DataTable aviatorData) { // Create an HTTPS_ Interface. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Create Site Request BComSiteRequest request = new BComSiteRequest(); request.Site = new Site(); request.Site.Address = new Address(); // Load the request. try { request.Site.CustomerProvidedId = this.cpid.ToString(); request.Site.Name = aviatorData.Rows[0]["BCOM_AcctName"].SafeToString(); request.Site.CustomerName = aviatorData.Rows[0]["AcctName"].SafeToString(); request.Site.Description = aviatorData.Rows[0]["AcctDescription"].SafeToString(); request.Site.Address.AddressType = "Service"; request.Site.Address.HouseNumber = aviatorData.Rows[0]["HouseNumber"].SafeToString(); request.Site.Address.StreetName = aviatorData.Rows[0]["StreetName"].SafeToString(); request.Site.Address.City = aviatorData.Rows[0]["City"].SafeToString(); request.Site.Address.StateCode = aviatorData.Rows[0]["StateCode"].SafeToString(); request.Site.Address.ZipCode = aviatorData.Rows[0]["Zip"].SafeToString(); } catch (Exception ex) { throw new ApplicationException("Failed loading Aviator data into order: " + ex.Message); } // Send the request and get the response. BComSiteResponse siteResponse = httpsInterface.CreateSite(request); // Did the request succeed? if (siteResponse.Status == "Success") { // Update Site information. try { this.db.UpdateSitesTable(request, siteResponse); } catch (Exception ex) { throw new ApplicationException("Failed update the Sites table with the new account: " + ex.Message); } } // Return the response. return(siteResponse); }
private BComOrderResponse OrderTN() { // Create an HTTPS_ Interface. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Create Order Request BComOrderRequest request = new BComOrderRequest(); request.Order = new Order(); request.Order.ExistingTelephoneNumberOrderType = new ExistingTelephoneNumberOrderType(); request.Order.ExistingTelephoneNumberOrderType.TelephoneNumberList = new TelephoneNumberList(); // Generate a pseudo oppid from coid. this.oppid = PseudoOppid(coid); // Load the request. try { request.Order.CustomerOrderId = this.coid.ToString(); request.Order.SiteId = this.siteid.ToString(); request.Order.PeerId = this.peerid.ToString(); request.Order.Name = Settings.GenerateOrderName(this.oppid, "PCO"); request.Order.ExistingTelephoneNumberOrderType.TelephoneNumberList.Add(TN); request.Order.PartialAllowed = "true"; // Set to true to allow error messages. } catch (Exception ex) { throw new ApplicationException("Failed creating order from details: " + ex.Message); } // Send the request and get the response. BComOrderResponse response = httpsInterface.OrderTNs(request); // Do not update NativeOrders here as the TN needs to be extracted. // Instead make a copy of the requests raw xml. this.requestXML = request.ToXml(); // Return the response. return(response); }
private BComOrderResponse OrderTN(DataTable aviatorData) { // Create an HTTPS_ Interface. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Create SipPeer Request BComOrderRequest request = new BComOrderRequest(); request.Order = new Order(); request.Order.ExistingTelephoneNumberOrderType = new ExistingTelephoneNumberOrderType(); // Load the request. try { request.Order.CustomerOrderId = this.coid.ToString(); request.Order.SiteId = this.siteid.ToString(); request.Order.PeerId = this.peerid.ToString(); request.Order.Name = Settings.GenerateOrderName( aviatorData.Rows[0]["oppid"].SafeToString(), "OMNL"); for (int i = 0; i < aviatorData.Rows.Count; i++) { request.Order.ExistingTelephoneNumberOrderType.TelephoneNumberList.Add(aviatorData.Rows[i]["TN"].ToString()); } request.Order.PartialAllowed = "true"; // Set to true to allow error messages. } catch (Exception ex) { throw new ApplicationException("Failed loading Aviator data into order: " + ex.Message); } // Send the request and get the response. BComOrderResponse response = httpsInterface.OrderTNs(request); // Do not update NativeOrders here as the TN needs to be extracted. // Instead make a copy of the requests raw xml. this.requestXML = request.ToXml(); // Return the response. return(response); }
private BComOrderResponse OrderTN(DataRow aviatorData) { // Create an HTTPS_ Interface. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Create SipPeer Request BComOrderRequest request = new BComOrderRequest(); request.Order = new Order(); request.Order.RateCenterSearchAndOrderType = new RateCenterSearchAndOrderType(); // Load the request. try { request.Order.CustomerOrderId = this.coid.ToString(); request.Order.SiteId = this.siteid.ToString(); request.Order.PeerId = this.peerid.ToString(); request.Order.Name = Settings.GenerateOrderName( aviatorData["oppid"].SafeToString(), "OSNL"); request.Order.RateCenterSearchAndOrderType.EnableLCA = "false"; request.Order.RateCenterSearchAndOrderType.Quantity = "1"; request.Order.RateCenterSearchAndOrderType.RateCenter = this.rc; request.Order.RateCenterSearchAndOrderType.State = this.rcState; request.Order.PartialAllowed = "true"; // Set to true to allow error messages. } catch (Exception ex) { throw new ApplicationException("Failed loading Aviator data into order: " + ex.Message); } // Send the request and get the response. BComOrderResponse response = httpsInterface.OrderTNs(request); // Do not update NativeOrders here as the TN needs to be extracted. // Instead make a copy of the requests raw xml. this.requestXML = request.ToXml(); // Return the response. return(response); }
public static BComLnpOrderResponse CancelTN(string order_id) { // Create an HTTPS_ Interface. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Create Cancel Request BComLnpCancelRequest request = new BComLnpCancelRequest(); // Load the request. request.OrderId = order_id; // Make a copy of the requests raw xml. //this.requestXML = request.ToXml(); // Send the request and get the response. BComLnpOrderResponse response = httpsInterface.CancelOrder(request); // Return the response. return(response); }
private BcomPortTriggerResponse TriggerLnpPort(string orderid) { // Create an HTTPS_ Interface. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Create Trigger Request BComPortTriggerRequest request = new BComPortTriggerRequest(); request.ActivationStatus = new ActivationStatus(); // Load OrderId into the request. request.OrderId = this.orderid; // Set the date for immediate activation. request.ActivationStatus.SetImmediateActivateDate(); // Send the request and get the response. BcomPortTriggerResponse response = httpsInterface.TriggerPort(request); // Return the response. return(response); }
protected void Page_Load(object sender, EventArgs e) { // Clear the page. Response.Clear(); // Set the type to text. //Response.ContentType = "text/plain"; Response.ContentType = "text/xml"; // Set the content to UTF-8 Response.ContentEncoding = System.Text.Encoding.UTF8; var testInterface = new HTTPS_Interface(); // Test TnStatus. var testTnRequest = new BComTnStatusRequest(); testTnRequest.TN = "6625062070"; BComTnStatusResponse testTnResponse = null; testTnResponse = testInterface.TnStatus(testTnRequest); string testTnResponseString = Serializer.SerializeObject(testTnResponse, typeof(BComTnStatusResponse)); Response.Write(testTnResponseString); /* * // Test the Serializer. * var siteRequest = new BComSiteRequest(); * siteRequest.Site.Name = "Big River Telephone Co."; * siteRequest.Site.Description = "Test Site 1"; * siteRequest.Site.CustomerName = "BRT"; * siteRequest.Site.CustomerProvidedId = "1234567890"; * siteRequest.Site.Address.HouseNumber = "24"; * siteRequest.Site.Address.StreetName = "S. Minnesota St."; * siteRequest.Site.Address.City = "Cape Girardeau"; * siteRequest.Site.Address.StateCode = "MO"; * siteRequest.Site.Address.ZipCode = "63702"; * siteRequest.Site.Address.AddressType = "Service"; * * string siteRequestXML = serializer.SerializeObject(siteRequest, typeof(BComSiteRequest)); * * Response.Write(siteRequestXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); * * // Test the create site code. * var siteResponse = testInterface.CreateSite(siteRequest); * * string siteResponseXML = serializer.SerializeObject(siteResponse, typeof(BComSiteResponse)); * * Response.Write(siteResponseXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); */ // Test the create sip peer code. /* * var sipPeerRequest = new BComSipPeerRequest(); * sipPeerRequest.SiteID = "2054"; // siteResponse.SiteID; * sipPeerRequest.SipPeer.PeerName = "BRTNAT1"; * sipPeerRequest.SipPeer.Description = "Big River Telephone National SIP Peer"; * sipPeerRequest.SipPeer.VoiceHosts = new Host[] { new Host("BWBRT.bigrivernational.com") }; * sipPeerRequest.SipPeer.IsDefaultPeer = "true"; * * string sipPeerRequestXML = BCom_Interface.Serializer.SerializeObject(sipPeerRequest, typeof(BComSipPeerRequest)); * * Response.Write(sipPeerRequestXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); * * var sipPeerResponse = testInterface.CreateSipPeer(sipPeerRequest); * * string sipPeerResponseXML = BCom_Interface.Serializer.SerializeObject(sipPeerResponse, typeof(BComSipPeerResponse)); * * Response.Write(sipPeerResponseXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); */ ///////////////////////////////////////////////////////////////////////// /* * // Test the search tn by rate center code. * var testTnByRcRequest = new BComTnByRateCenterRequest(); * testTnByRcRequest.RateCenter = "PASOROBLES"; * testTnByRcRequest.State = "CA"; * * string testTnByRcRequestXML = Serializer.SerializeObject(testTnByRcRequest, typeof(BComTnByRateCenterRequest)); * * Response.Write(testTnByRcRequestXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); * * testInterface = new HTTPS_Interface(); * var testTnByRcResponse = testInterface.SearchTnByRateCenter(testTnByRcRequest); * * string testTnByRcXMLresponse = Serializer.SerializeObject(testTnByRcResponse, typeof(BComTnSearchResponse)); * * Response.Write(testTnByRcXMLresponse); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); */ ///////////////////////////////////////////////////////////////////////// /* * // Test the search tn by zip code. * var tnByZipRequest = new BComTnByZipRequest(); * tnByZipRequest.Zip = "63701"; * * string tnByZipRequestXML = Serializer.SerializeObject(tnByZipRequest, typeof(BComTnByZipRequest)); * * Response.Write(tnByZipRequestXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); * * testInterface = new HTTPS_Interface(); * var tnByZipResponse = testInterface.SearchTnByZip(tnByZipRequest); * * string tnByZipResponseXML = Serializer.SerializeObject(tnByZipResponse, typeof(BComTnSearchResponse)); * * Response.Write(tnByZipResponseXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); */ ///////////////////////////////////////////////////////////////////////// /* * var testOrderRequest = new BComOrderRequest(); * testOrderRequest.Order.Name = "Test Order 1"; * testOrderRequest.Order.SiteId = testResponse.SiteID; * testOrderRequest.Order.CustomerOrderId = "TestOppid"; * testOrderRequest.Order.PartialAllowed = "FALSE"; * testOrderRequest.Order.ExistingTelephoneNumberOrderType = new ExistingTelephoneNumberOrderType(); * testOrderRequest.Order.ExistingTelephoneNumberOrderType.TelephoneNumberList = new string[] { "5733351234" }; * * string testOrderRequestXML = Serializer.SerializeObject(testOrderRequest, typeof(BComOrderRequest)); * * Response.Write(testOrderRequestXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); * * testInterface = new HTTPS_Interface(); * var testOrderResponse = testInterface.OrderTNs(testOrderRequest); * * string testOrderXMLresponse = Serializer.SerializeObject(testOrderResponse, typeof(BComOrderResponse)); * * Response.Write(testOrderXMLresponse); */ ///////////////////////////////////////////////////////////////////////// /* * var lnpCheckRequest = new BComLnpCheckRequest(); * lnpCheckRequest.NumberPortabilityRequest.TnList = new TnList { "5735871009","5737755023" }; * * string lnpCheckRequestXML = Serializer.SerializeObject(lnpCheckRequest, typeof(BComLnpCheckRequest)); * * Response.Write(lnpCheckRequestXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); * * testInterface = new HTTPS_Interface(); * var lnpCheckResponse = testInterface.LnpCheck(lnpCheckRequest); * * string lnpCheckResponseXML = Serializer.SerializeObject(lnpCheckResponse, typeof(BComLnpCheckResponse)); * * Response.Write(lnpCheckResponseXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); */ ///////////////////////////////////////////////////////////////////////// /* * var lnpOrderRequest = new BComLnpOrderRequest(); * lnpOrderRequest.LnpOrder.CustomerOrderId = "TestOppid2"; * lnpOrderRequest.LnpOrder.RequestedFocDateParsed = DateTime.Now.AddDays(7.0); * lnpOrderRequest.LnpOrder.BillingTelephoneNumber = "5735871009"; * lnpOrderRequest.LnpOrder.Subscriber = new Subscriber(); * lnpOrderRequest.LnpOrder.Subscriber.SubscriberType = "RESIDENTIAL"; * lnpOrderRequest.LnpOrder.Subscriber.FirstName = "Jacob"; * lnpOrderRequest.LnpOrder.Subscriber.MiddleInitial = "D"; * lnpOrderRequest.LnpOrder.Subscriber.LastName = "Proctor"; * lnpOrderRequest.LnpOrder.Subscriber.ServiceAddress = new Address(); * lnpOrderRequest.LnpOrder.Subscriber.ServiceAddress.HouseNumber = "1111"; * lnpOrderRequest.LnpOrder.Subscriber.ServiceAddress.StreetName = "Themis St. Apt. 2"; * lnpOrderRequest.LnpOrder.Subscriber.ServiceAddress.City = "Cape Girardeau"; * lnpOrderRequest.LnpOrder.Subscriber.ServiceAddress.StateCode = "MO"; * lnpOrderRequest.LnpOrder.Subscriber.ServiceAddress.Zip = "63701"; * lnpOrderRequest.LnpOrder.Subscriber.ServiceAddress.Country = "USA"; * lnpOrderRequest.LnpOrder.LoaAuthorizingPerson = "Jacob D. Proctor"; * lnpOrderRequest.LnpOrder.ListOfPhoneNumbers = new ListOfPhoneNumbers() { "5735871009" }; * lnpOrderRequest.LnpOrder.SiteId = "423";//siteResponse.SiteID; * lnpOrderRequest.LnpOrder.PeerId = "1881";//sipPeerResponse.SipPeerID; * * string lnpOrderRequestXMl = Serializer.SerializeObject(lnpOrderRequest, typeof(BComLnpOrderRequest)); * * Response.Write(lnpOrderRequestXMl); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); * * testInterface = new HTTPS_Interface(); * var lnpOrderResponse = testInterface.LnpOrder(lnpOrderRequest); * * string lnpOrderResponseXML = Serializer.SerializeObject(lnpOrderResponse, typeof(BComLnpOrderResponse)); * * Response.Write(lnpOrderResponseXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); */ ///////////////////////////////////////////////////////////////////////// /* * var oppidOrderStatusRequest = new BComOrderStatusRequest(); * oppidOrderStatusRequest.OppId = "TestOppid2";//lnpOrderRequest.LnpOrder.CustomerOrderId; * * string oppidOrderStatusRequestXMl = Serializer.SerializeObject(oppidOrderStatusRequest, typeof(BComOrderStatusRequest)); * * Response.Write(oppidOrderStatusRequestXMl); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); * * testInterface = new HTTPS_Interface(); * var oppidOrderStatusResponse = testInterface.OrderStatus(oppidOrderStatusRequest); * * string oppidOrderStatusResponseXML = Serializer.SerializeObject(oppidOrderStatusResponse, typeof(BComOrderStatusResponse)); * * Response.Write(oppidOrderStatusResponseXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); */ ///////////////////////////////////////////////////////////////////////// /* * var orderidOrderStatusRequest = new BComOrderStatusRequest(); * orderidOrderStatusRequest.OrderId = "64a5ca1b-3c1a-45d1-90cb-d8e372c6e4a7";//lnpOrderResponse.LnpOrderResponse.OrderId; * * string orderidOrderStatusRequestXMl = Serializer.SerializeObject(orderidOrderStatusRequest, typeof(BComOrderStatusRequest)); * * Response.Write(orderidOrderStatusRequestXMl); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); * * testInterface = new HTTPS_Interface(); * var orderidOrderStatusResponse = testInterface.OrderStatus(orderidOrderStatusRequest); * * string orderidOrderStatusResponseXML = Serializer.SerializeObject(orderidOrderStatusResponse, typeof(BComOrderStatusResponse)); * * Response.Write(orderidOrderStatusResponseXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); */ ///////////////////////////////////////////////////////////////////////// /* * var lnpCancelRequest = new BComLnpCancelRequest(); * lnpCancelRequest.OrderId = "64a5ca1b-3c1a-45d1-90cb-d8e372c6e4a7";//lnpOrderResponse.LnpOrderResponse.OrderId; * * string lnpCancelRequestXMl = Serializer.SerializeObject(lnpCancelRequest, typeof(BComLnpCancelRequest)); * * Response.Write(lnpCancelRequestXMl); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); * * testInterface = new HTTPS_Interface(); * var lnpCancelResponse = testInterface.CancelOrder(lnpCancelRequest); * * string lnpCancelResponseXML = Serializer.SerializeObject(lnpCancelResponse, typeof(BComLnpOrderResponse)); * * Response.Write(lnpCancelResponseXML); * * Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); */ }
protected void Page_Load(object sender, EventArgs e) { // Clear the page. Response.Clear(); // Set the type to XML. Response.ContentType = "text/xml"; //Response.ContentType = "text/plain"; CheckServiceRequest request = null; CheckServiceResponse response = new CheckServiceResponse(); // Build the request from the query string try { request = new CheckServiceRequest(Request.QueryString); } catch (Exception ex) { response.SetJeop( "Unable to build request from query string: " + ex.Message); Response.Write(response.ToXml()); return; } // Debug, test write request. //Response.Write(request.ToXml()); //Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); // Neither tns or zip? if (string.IsNullOrEmpty(request.oppid) && string.IsNullOrEmpty(Request.QueryString["tns"]) && string.IsNullOrEmpty(request.zip)) { response.Action = "Error"; response.Message = "No parameters. " + "'oppid' loads the parameters from the database. " + "'tns' is a list of semicolon delimited porting tns. " + "'zip' is a zipcode to check for available tns. " + "Zipcode must be in the XXXXX or XXXXX-XXXX format."; Response.Write(response.ToXml()); return; } // If the oppid is set, try to get the tns or zip from the database. DB db = new DB(); if (!string.IsNullOrEmpty(request.oppid)) { try { request = db.LoadCheckServiceRequest(request.oppid); } catch (Exception ex) { response.SetJeop("Error loading request parameters from database: " + ex.Message); Response.Write(response.ToXml()); return; } } // Still no tns or zip? if (request.tns == null && request.zip == null) { response.SetJeop("Error loading request parameters from database. No tns or zip returned."); Response.Write(response.ToXml()); return; } // To allow both zip check and LNP check error messages, declare flag and jeop message. bool jeopFlag = false; string jeopMessage = string.Empty; // Any TNs? Do lnp check. if (request.tns != null && request.tns.Length > 0) { // Check with BCom BComLnpCheckResponse bcomResponse = null; try { bcomResponse = new HTTPS_Interface().LnpCheck( new BComLnpCheckRequest( request.tns)); } catch (Exception ex) { response.SetJeop("Error during LNP Check: " + ex.Message); Response.Write(response.ToXml()); return; } // Debug, Print out response. //Response.Write(Serializer.SerializeObject(bcomResponse, typeof(BComLnpCheckResponse))); //Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); // Success? if (bcomResponse.Status == "Success") { // Unsupported rate centers, aka LNP Check said no? if (bcomResponse.NumberPortabilityResponse != null && bcomResponse.NumberPortabilityResponse.UnsupportedRateCenters != null && bcomResponse.NumberPortabilityResponse.UnsupportedRateCenters.Length > 0) { // Build a list of each unsupported TN string tnList = string.Empty; // For each Ratecenter Group foreach (RateCenterGroup rcg in bcomResponse.NumberPortabilityResponse.UnsupportedRateCenters) { // If there's a tn list if (rcg.TnList != null) { // Add each unsupported TN. foreach (string tn in rcg.TnList) { tnList += tn + " "; } } } // Trim the list tnList = tnList.Trim(); // Set Jeop flag and message. jeopFlag = true; jeopMessage = "The following TNs cannot be ported: " + tnList; } } else { // Get error message string errorMessage = string.Empty; try { errorMessage = bcomResponse.ErrorCode + " - " + bcomResponse.ErrorMessage; } catch { errorMessage = "Error: Unable to parse error response."; } // Return error response.SetJeop(errorMessage); Response.Write(response.ToXml()); return; } } // Zip code? Do a number check. if (!string.IsNullOrEmpty(request.zip)) { // Check with BCom BComTnSearchResponse bcomResponse = null; try { var bcomRequest = new BComTnByZipRequest(request.zip); bcomRequest.Quantity = "1"; bcomResponse = new HTTPS_Interface().SearchTnByZip( bcomRequest); } catch (Exception ex) { response.SetJeop("Error during Zip Check: " + ex.Message); Response.Write(response.ToXml()); return; } // Debug, Print out response. //Response.Write(Serializer.SerializeObject(bcomResponse, typeof(BComTnSearchResponse))); //Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); // Success? if (bcomResponse.Status == "Success") { // No results? aka Zip check said no? if (bcomResponse.SearchResult == null || bcomResponse.SearchResult.ResultCount == null || HTTPS_Interface.LooseStringToInteger( bcomResponse.SearchResult.ResultCount) < 1) { // Set Jeop flag and message. jeopFlag = true; jeopMessage = "No TNs available for " + request.zip + "."; } } else { // Get error message string errorMessage = string.Empty; try { errorMessage = bcomResponse.ErrorCode + " - " + bcomResponse.ErrorMessage; } catch { errorMessage = "Error: Unable to parse error response."; } // Return error response.SetJeop(errorMessage); Response.Write(response.ToXml()); return; } } // Jeop? if (jeopFlag) { response.SetJeop(jeopMessage); } // Complete! else { response.SetComplete(); } // Return result. Response.Write(response.ToXml()); return; }
protected void Page_Load(object sender, EventArgs e) { // Clear the page. Response.Clear(); // Set the type to XML. Response.ContentType = "text/xml"; //Response.ContentType = "text/plain"; SearchTNsRequest request = null; SearchTNsResponse response = new SearchTNsResponse(); // Build the request from the query string try { request = new SearchTNsRequest(Request.QueryString); } catch (Exception ex) { response.SetJeop( "Unable to build request from query string: " + ex.Message); Response.Write(response.ToXml()); return; } // Debug, test write request. //Response.Write(request.ToXml()); //Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); // Neither ratecenter nor state? if (string.IsNullOrEmpty(request.rc) || string.IsNullOrEmpty(request.state)) { response.Action = "Error"; response.Message = "No parameters. " + "Requires 'rc' and its 'state'." + "Include 'quanitity' if a specific number of TNs is wanted."; Response.Write(response.ToXml()); return; } // Declare a list of TNs. List <string> tnList = new List <string>(); // Rate center and state? if (!string.IsNullOrEmpty(request.rc) && !string.IsNullOrEmpty(request.state)) { // Check with BCom BComTnSearchResponse bcomResponse = null; try { bcomResponse = new HTTPS_Interface().SearchTnByRateCenter( new BComTnByRateCenterRequest( request.rc, request.state)); } catch (Exception ex) { response.SetJeop("Error during Tn By Ratecenter Search: " + ex.Message); Response.Write(response.ToXml()); return; } // Debug, Print out response. //Response.Write(Serializer.SerializeObject(bcomResponse, typeof(BComTnSearchResponse))); //Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); // Success? if (bcomResponse.Status == "Success") { // Check for an returned TNs. if (bcomResponse.SearchResult != null && bcomResponse.SearchResult.TelephoneNumberList != null && bcomResponse.SearchResult.TelephoneNumberList.Count > 0 && HTTPS_Interface.LooseStringToInteger( bcomResponse.SearchResult.ResultCount) > 0) { // Add to the list, if not already there. foreach (string tn in bcomResponse.SearchResult.TelephoneNumberList) { if (!tnList.Contains(tn)) { tnList.Add(tn); } } } } else { // Get error message string errorMessage = string.Empty; try { errorMessage = bcomResponse.ErrorCode + " - " + bcomResponse.ErrorMessage; } catch { errorMessage = "Error: Unable to parse error response."; } // Return error response.SetJeop(errorMessage); Response.Write(response.ToXml()); return; } } // Any TNs? if (tnList.Count < 1) { response.SetError("No TNs were returned."); } // Complete! else { response.SetComplete(); // Add Tn list response.tns = tnList.ToArray(); } // Return result. Response.Write(response.ToXml()); return; }
protected void Page_Load(object sender, EventArgs e) { // Clear the page. Response.Clear(); // Set the type to XML. Response.ContentType = "text/xml"; //Response.ContentType = "text/plain"; SearchTNsRequest request = null; SearchTNsResponse response = new SearchTNsResponse(); // Build the request from the query string try { request = new SearchTNsRequest(Request.QueryString); } catch (Exception ex) { response.SetJeop( "Unable to build request from query string: " + ex.Message); Response.Write(response.ToXml()); return; } // Debug, test write request. //Response.Write(request.ToXml()); //Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); // Neither oppid, npanxx, ratecenter, nor zip? if (string.IsNullOrEmpty(request.oppid) && string.IsNullOrEmpty(request.npanxx) && (string.IsNullOrEmpty(request.rc) || string.IsNullOrEmpty(request.state)) && string.IsNullOrEmpty(request.zip)) { response.Action = "Error"; response.Message = "No parameters. " + "'oppid' loads the parameters from the database. " + "Include a combination of: 'npanxx' or 'npa' and 'nxx', " + "'rc' and its 'state', and 'zip'. " + "Zipcode must be in the XXXXX or XXXXX-XXXX format."; Response.Write(response.ToXml()); return; } // If the oppid is set, try to get the rc or zip from the database. DB db = new DB(); if (!string.IsNullOrEmpty(request.oppid)) { try { request = db.LoadSearchTNsRequest(request.oppid); } catch (Exception ex) { response.SetJeop("Error loading request parameters from database: " + ex.Message); Response.Write(response.ToXml()); return; } } // Still no rc or zip? if ((string.IsNullOrEmpty(request.rc) && string.IsNullOrEmpty(request.state)) || string.IsNullOrEmpty(request.zip)) { response.SetJeop("Error loading request parameters from database. No ratecenter or zip returned."); Response.Write(response.ToXml()); return; } // Declare a list of TNs. List <string> tnList = new List <string>(); // NPANXX? if (!string.IsNullOrEmpty(request.npanxx)) { // Check with BCom BComTnSearchResponse bcomResponse = null; try { bcomResponse = new HTTPS_Interface().SearchTnByNpaNxx( new BComTnByNpaNxxRequest( request.npa, request.nxx)); } catch (Exception ex) { response.SetError("Error during Tn By NpaNxx Search: " + ex.Message); Response.Write(response.ToXml()); return; } // Debug, Print out response. //Response.Write(Serializer.SerializeObject(bcomResponse, typeof(BComTnSearchResponse))); //Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); // Success? if (bcomResponse.Status == "Success") { // Check for an returned TNs. if (bcomResponse.SearchResult != null && bcomResponse.SearchResult.TelephoneNumberList != null && bcomResponse.SearchResult.TelephoneNumberList.Count > 0 && HTTPS_Interface.LooseStringToInteger( bcomResponse.SearchResult.ResultCount) > 0) { // Add to the list, if not already there. foreach (string tn in bcomResponse.SearchResult.TelephoneNumberList) { if (!tnList.Contains(tn)) { tnList.Add(tn); } } } } else { // Get error message string errorMessage = string.Empty; try { errorMessage = bcomResponse.ErrorCode + " - " + bcomResponse.ErrorMessage; } catch { errorMessage = "Error: Unable to parse error response."; } // Return error response.SetJeop(errorMessage); Response.Write(response.ToXml()); return; } } // Rate center and state? if (!string.IsNullOrEmpty(request.rc) && !string.IsNullOrEmpty(request.state)) { // Check with BCom BComTnSearchResponse bcomResponse = null; try { bcomResponse = new HTTPS_Interface().SearchTnByRateCenter( new BComTnByRateCenterRequest( request.rc, request.state)); } catch (Exception ex) { response.SetJeop("Error during Tn By Ratecenter Search: " + ex.Message); Response.Write(response.ToXml()); return; } // Debug, Print out response. //Response.Write(Serializer.SerializeObject(bcomResponse, typeof(BComTnSearchResponse))); //Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); // Success? if (bcomResponse.Status == "Success") { // Check for an returned TNs. if (bcomResponse.SearchResult != null && bcomResponse.SearchResult.TelephoneNumberList != null && bcomResponse.SearchResult.TelephoneNumberList.Count > 0 && HTTPS_Interface.LooseStringToInteger( bcomResponse.SearchResult.ResultCount) > 0) { // Add to the list, if not already there. foreach (string tn in bcomResponse.SearchResult.TelephoneNumberList) { if (!tnList.Contains(tn)) { tnList.Add(tn); } } } } else { // Get error message string errorMessage = string.Empty; try { errorMessage = bcomResponse.ErrorCode + " - " + bcomResponse.ErrorMessage; } catch { errorMessage = "Error: Unable to parse error response."; } // Return error response.SetJeop(errorMessage); Response.Write(response.ToXml()); return; } } // Zip? if (!string.IsNullOrEmpty(request.zip)) { // Check with BCom BComTnSearchResponse bcomResponse = null; try { bcomResponse = new HTTPS_Interface().SearchTnByZip( new BComTnByZipRequest( request.zip)); } catch (Exception ex) { response.SetJeop("Error during Tn By Zip Search: " + ex.Message); Response.Write(response.ToXml()); return; } // Debug, Print out response. //Response.Write(Serializer.SerializeObject(bcomResponse, typeof(BComTnSearchResponse))); //Response.Write(Environment.NewLine + Environment.NewLine + Environment.NewLine); // Success? if (bcomResponse.Status == "Success") { // Check for an returned TNs. if (bcomResponse.SearchResult != null && bcomResponse.SearchResult.TelephoneNumberList != null && bcomResponse.SearchResult.TelephoneNumberList.Count > 0 && HTTPS_Interface.LooseStringToInteger( bcomResponse.SearchResult.ResultCount) > 0) { // Add to the list, if not already there. foreach (string tn in bcomResponse.SearchResult.TelephoneNumberList) { if (!tnList.Contains(tn)) { tnList.Add(tn); } } } } else { // Get error message string errorMessage = string.Empty; try { errorMessage = bcomResponse.ErrorCode + " - " + bcomResponse.ErrorMessage; } catch { errorMessage = "Error: Unable to parse error response."; } // Return error response.SetJeop(errorMessage); Response.Write(response.ToXml()); return; } } // Any TNs? if (tnList.Count < 1) { response.SetError("No TNs were returned."); } // Complete! else { response.SetComplete(); // Add Tn list response.tns = tnList.ToArray(); } // Return result. Response.Write(response.ToXml()); return; }
private BComLnpOrderResponse LnpOrder(DataTable aviatorData) { // Create an HTTPS_ Interface. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Create Lnp Order Request BComLnpOrderRequest request = new BComLnpOrderRequest(); request.LnpOrder = new LnpOrder(); request.LnpOrder.Subscriber = new Subscriber(); request.LnpOrder.Subscriber.ServiceAddress = new Address(); request.LnpOrder.ListOfPhoneNumbers = new ListOfPhoneNumbers(); // Load the request. try { string subscriberType = aviatorData.Rows[0]["SubscriberType"].SafeToString(); if (string.IsNullOrEmpty(subscriberType)) { throw new ApplicationException("Account Subscriber Type not set."); } request.LnpOrder.CustomerOrderId = this.coid.SafeToString(); request.LnpOrder.RequestedFocDate = aviatorData.Rows[0]["RequestedFocDate"].SafeToString(); request.LnpOrder.BillingTelephoneNumber = aviatorData.Rows[0]["BillingTelephoneNumber"].SafeToString(); request.LnpOrder.LoaAuthorizingPerson = aviatorData.Rows[0]["LoaAuthorizingPerson"].SafeToString(); request.LnpOrder.SiteId = aviatorData.Rows[0]["SiteId"].SafeToString(); request.LnpOrder.Triggered = aviatorData.Rows[0]["Triggered"].SafeToString(); request.LnpOrder.Subscriber.SubscriberType = aviatorData.Rows[0]["SubscriberType"].SafeToString(); request.LnpOrder.Subscriber.ServiceAddress.HouseNumber = aviatorData.Rows[0]["HouseNumber"].SafeToString(); request.LnpOrder.Subscriber.ServiceAddress.StreetName = aviatorData.Rows[0]["StreetName"].SafeToString(); request.LnpOrder.Subscriber.ServiceAddress.City = aviatorData.Rows[0]["City"].SafeToString(); request.LnpOrder.Subscriber.ServiceAddress.StateCode = aviatorData.Rows[0]["StateCode"].SafeToString(); request.LnpOrder.Subscriber.ServiceAddress.Zip = aviatorData.Rows[0]["Zip"].SafeToString(); request.LnpOrder.Subscriber.ServiceAddress.Country = aviatorData.Rows[0]["Country"].SafeToString(); // Determine if a business name is used or not. if (subscriberType == "RESIDENTIAL") { request.LnpOrder.Subscriber.FirstName = aviatorData.Rows[0]["FirstName"].SafeToString(); request.LnpOrder.Subscriber.LastName = aviatorData.Rows[0]["LastName"].SafeToString(); } else if (subscriberType == "BUSINESS") { request.LnpOrder.Subscriber.BusinessName = aviatorData.Rows[0]["BusinessName"].SafeToString(); } else { throw new ApplicationException("Unknown Subscriber Type: " + subscriberType); } // If Wireless info is provided, then set it. if (!string.IsNullOrEmpty(aviatorData.Rows[0]["Wireless_Account"].SafeToString()) || !string.IsNullOrEmpty(aviatorData.Rows[0]["Wireless_PIN"].SafeToString())) { request.LnpOrder.WirelessInfo = new WirelessInfo(); // Add account number if present. if (!string.IsNullOrEmpty(aviatorData.Rows[0]["Wireless_Account"].SafeToString())) { request.LnpOrder.WirelessInfo.AccountNumber = aviatorData.Rows[0]["Wireless_Account"].SafeToString(); } // Add PIN if present. if (!string.IsNullOrEmpty(aviatorData.Rows[0]["Wireless_PIN"].SafeToString())) { request.LnpOrder.WirelessInfo.PinNumber = aviatorData.Rows[0]["Wireless_PIN"].SafeToString(); } } } catch (Exception ex) { throw new ApplicationException("Failed loading Aviator data into order: " + ex.Message); } foreach (DataRow r in aviatorData.Rows) { string tn = r["PhoneNumber"].SafeToString(); if (!string.IsNullOrEmpty(tn)) { request.LnpOrder.ListOfPhoneNumbers.Add(tn); } } // Make a copy of the requests raw xml. this.requestXML = request.ToXml(); // Send the request and get the response. BComLnpOrderResponse response = httpsInterface.LnpOrder(request); // Return the response. return(response); }
protected void Page_Load(object sender, EventArgs e) { // Clear the page. Response.Clear(); // Set the type to XML. Response.ContentType = "text/xml"; //Response.ContentType = "text/plain"; // For debuggin purposes. // Declare a response. this.response = new CheckTNsResponse(); // OPen an interface if BCom. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Create request. BComTnStatusRequest request = new BComTnStatusRequest(); // No Tn? if (string.IsNullOrEmpty(Request.QueryString["tn"])) { response.Action = "Error"; response.Message = "No parameters. " + "'tn' must be a ten digit telephone number."; Response.Write(response.ToXml()); return; } // Bad TN? else if (Request.QueryString["tn"].Length != 10 || !System.Text.RegularExpressions.Regex.IsMatch(Request.QueryString["tn"], @"\d{10}")) { response.Action = "Error"; response.Message = "Bad parameters. " + "'tn' must be a ten digit telephone number. TN: " + Request.QueryString["tn"]; Response.Write(response.ToXml()); return; } else { // Valid TN! this.Tn = Request.QueryString["tn"]; request.TN = this.Tn; } // Create a response for the BCom status request. BComTnStatusResponse responseTnStatus = new BComTnStatusResponse(); // Check status of TN try { responseTnStatus = httpsInterface.TnStatus(request); } catch (Exception ex) { string jeop = "Unable to check the status of TN: " + ex.Message; this.response.SetJeop(jeop); Response.Write(this.response.ToXml()); return; } // ErrorResponse? if (responseTnStatus.ErrorResponse != null) { string errorString = string.Empty; if (responseTnStatus.ErrorResponse.irisStatus != null) { if (!string.IsNullOrEmpty(responseTnStatus.ErrorResponse.irisStatus.Code)) { errorString = responseTnStatus.ErrorResponse.irisStatus.Code; } else { errorString = "Uknown Code"; } if (!string.IsNullOrEmpty(responseTnStatus.ErrorResponse.irisStatus.Description)) { errorString += " - " + responseTnStatus.ErrorResponse.irisStatus.Description; } else { errorString += " - Unknown Error"; } } this.response.SetJeop(errorString); } // Is there a status? else if (responseTnStatus.TelephoneNumberResponse != null) { if (!string.IsNullOrEmpty(responseTnStatus.TelephoneNumberResponse.Status)) { this.response.Status = responseTnStatus.TelephoneNumberResponse.Status; } else { this.response.Status = "Unknown"; } this.response.SetComplete(); } else // No info?! { this.response.SetJeop("Uknown Code - Response received, but without a status."); } // Write results. Response.Write(response.ToXml()); return; }
private BComSipPeerResponse CreateNewPeerID(DataTable aviatorData) { // Create an HTTPS_ Interface. HTTPS_Interface httpsInterface = new HTTPS_Interface(); // Create SipPeer Request BComSipPeerRequest request = new BComSipPeerRequest(); request.SipPeer = new SipPeer(); // Load the request. try { request.SiteID = this.siteid.ToString(); request.SipPeer.PeerName = aviatorData.Rows[0]["BCOM_AcctName"].SafeToString(); request.SipPeer.Description = aviatorData.Rows[0]["AcctDescription"].SafeToString(); request.SipPeer.IsDefaultPeer = "true"; } catch (Exception ex) { throw new ApplicationException("Failed loading Aviator data into order: " + ex.Message); } // Special load the voicehost string voicehostURL = string.Empty; if (aviatorData.Rows[0]["VoiceHost"].SafeToString() == "NATIONAL") { voicehostURL = Settings.VoiceHostNational; } else if (aviatorData.Rows[0]["VoiceHost"].SafeToString() == "CORE") { voicehostURL = Settings.VoiceHostCore; } else { throw new ApplicationException( "Failed parsing VoiceHost indicator from Aviator: Value of '" + aviatorData.Rows[0]["VoiceHost"].SafeToString() + "'."); } request.SipPeer.VoiceHosts = new Host[] { new Host(voicehostURL) }; // Send the request and get the response. BComSipPeerResponse peerResponse = httpsInterface.CreateSipPeer(request); // Did the request succeed? if (peerResponse.Status == "Success") { // Update Peer information. try { this.db.UpdateSipPeersTable(request, peerResponse); } catch (Exception ex) { throw new ApplicationException("Failed update the SipPeers table with the new account: " + ex.Message); } } // Return the response. return(peerResponse); }