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); }
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. // Response declared. this.response = new DisconnectSingleOrderTNLineResponse(); // First make sure the parameters are there. SetParameters(); // Failed? Then Jeop. if (this.response.Action != "PENDING") { Response.Write(this.response.ToXml()); return; } // Create a database interface. try { this.db = new DB(); } catch (Exception ex) { this.response.SetJeop( "Unable to open a database connection: " + ex.Message); Response.Write(this.response.ToXml()); this.db.Close(); return; } // DataTable to load disconnect information. DataRow aviatorData = null; // Load the disconnect data. try { aviatorData = this.db.LoadAviatorInstallData(oppid); } catch (Exception ex) { string jeop = "Unable to load data from Aviator: " + ex.Message; this.response.SetJeop(jeop); Response.Write(this.response.ToXml()); this.db.JeopStep( this.oppid, this.wf_id, this.wf_step_id, this.jeopname, jeop); this.db.Close(); return; } // Get tn and add to tnlist this.tnList = new TelephoneNumberList(); try { this.tn = (aviatorData["TN"].SafeToString()).Trim(); this.tnList.Add(this.tn); } catch (Exception ex) { string jeop = "Unable to add tns to list: " + ex.Message; this.response.SetJeop(jeop); Response.Write(this.response.ToXml()); this.db.JeopStep( this.oppid, this.wf_id, this.wf_step_id, this.jeopname, jeop); this.db.Close(); return; } // Get the coid. try { this.coid = this.db.GenerateDiscoCoid(); } catch (Exception ex) { string jeop = "Unable to generate Disconnect COID: " + ex.Message; this.response.SetJeop(jeop); Response.Write(this.response.ToXml()); this.db.JeopStep( this.oppid, this.wf_id, this.wf_step_id, this.jeopname, jeop); this.db.Close(); return; } // Generate the Name. this.name = "BRC_" + oppid + "_DISCO_" + DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.ToString("HHmmssff"); // Make request BComDiscoOrderResponse disconnectResponse = null; try { disconnectResponse = DisconnectSingleTN(coid.SafeToString(), name, tnList); } catch (Exception ex) { string jeop = "Unable to disconnect tn: " + ex.Message; this.response.SetJeop(jeop); Response.Write(this.response.ToXml()); this.db.JeopStep( this.oppid, this.wf_id, this.wf_step_id, this.jeopname, jeop); this.db.Close(); return; } if (disconnectResponse.Status != "Success") { string jeop = disconnectResponse.ErrorMessage + this.requestXML; this.response.SetJeop(jeop); try { this.db.InsertDiscoTable(this.coid, this.oppid, this.name, this.wf_id, this.wf_step_id, this.jeopname, this.tn, disconnectResponse.ToXml(), this.requestXML, "Jeop", ""); } catch { //ignore error } // Return the response. this.db.JeopStep( this.oppid, this.wf_id, this.wf_step_id, this.jeopname, jeop); this.db.Close(); // Return result. Response.Write(this.response.ToXml()); return; } // Set to Continue if not failed. if (disconnectResponse.Status == "Success") { this.response.SetComplete(); // Now complete the step. this.db.CompleteStep(this.oppid, this.wf_id, this.wf_step_id); } // Update table again information. try { // here we update info this.db.InsertDiscoTable(this.coid, this.oppid, this.name, this.wf_id, this.wf_step_id, this.jeopname, this.tn, disconnectResponse.ToXml(), this.requestXML, "Complete", /*orderid*/ ""); } catch { // Ignore the error. } // Close the db this.db.Close(); // Return result. Response.Write(this.response.ToXml()); return; }