protected void btnGetStatus_Click(object sender, EventArgs e) { string OrgID = Session["OrgID"].ToString(); //get credentials CDXCredentials cred = WQXSubmit.GetCDXSubmitCredentials2(OrgID); //auth string token = WQXSubmit.AuthHelper(cred.userID, cred.credential, "Password", "default", cred.NodeURL); StatusResponseType gsResp = WQXSubmit.GetStatusHelper(cred.NodeURL, token, txtTransID.Text); string status = gsResp.status.ToString(); }
public static void ATTAINS_byReport(int ReportIDX) { //get OrgID for the report TAttainsReport r = db_Attains.GetT_ATTAINS_REPORT_byID(ReportIDX); if (r != null) { //get CDX username, password, and CDX destination URL CDXCredentials cred = WQXSubmit.GetCDXSubmitCredentials2(r.OrgId); //*******AUTHENTICATE********************************************************************************************************* string token = WQXSubmit.AuthHelper(cred.userID, cred.credential, "Password", "default", cred.NodeURL); //*******SUBMIT*************************************************************************************************************** string requestXml = db_Attains.SP_GenATTAINSXML(ReportIDX); //get XML from DB stored procedure byte[] bytes = Utils.StrToByteArray(requestXml); if (bytes == null) { return; } NetworkNode2.StatusResponseType subStatus = WQXSubmit.SubmitHelper(cred.NodeURL, token, "ATTAINS", "default", bytes, "submit.xml", NetworkNode2.DocumentFormatType.XML, "1"); if (subStatus != null) { //*******GET STATUS******************************************************************************************************** string status = ""; int i = 0; do { i += 1; Thread.Sleep(10000); NetworkNode2.StatusResponseType gsResp = WQXSubmit.GetStatusHelper(cred.NodeURL, token, subStatus.transactionId); if (gsResp != null) { status = gsResp.status.ToString(); //exit if waiting too long if (i > 30) { //UpdateRecordStatus(typeText, RecordIDX, "N"); //db_Ref.InsertUpdateWQX_TRANSACTION_LOG(null, typeText, RecordIDX, "I", null, "Timed out while getting status from EPA", subStatus.transactionId, "Failed", orgID); return; } } } while (status != "Failed" && status != "Completed"); } } }
protected void btnDownload_Click(object sender, EventArgs e) { string OrgID = Session["OrgID"].ToString(); int iCount = 0; //get credentials CDXCredentials cred = WQXSubmit.GetCDXSubmitCredentials2(OrgID); string token = WQXSubmit.AuthHelper(cred.userID, cred.credential, "Password", "default", cred.NodeURL); NodeDocumentType[] dlResp = WQXSubmit.DownloadHelper(cred.NodeURL, token, "WQX", txtTransID.Text); foreach (NodeDocumentType ndt in dlResp) { if (ndt.documentName.Contains("Validation") || ndt.documentName.Contains("Processing")) { Byte[] resp1 = dlResp[iCount].documentContent.Value; } iCount += 1; } }
protected void btnTransHistory_Click(object sender, EventArgs e) { try { string OrgID = Session["OrgID"].ToString(); //get CDX username, password, and CDX destination URL CDXCredentials cred = WQXSubmit.GetCDXSubmitCredentials2(OrgID); //*******AUTHENTICATE*********************************** string token = WQXSubmit.AuthHelper(cred.userID, cred.credential, "Password", "default", cred.NodeURL); //*******QUERY***************************************** if (token.Length > 0) { List <net.epacdxnode.test.ParameterType> pars = new List <net.epacdxnode.test.ParameterType>(); net.epacdxnode.test.ParameterType p = new net.epacdxnode.test.ParameterType(); p.parameterName = "organizationIdentifier"; p.Value = OrgID; pars.Add(p); p.parameterName = "transactionDateBegin"; p.Value = "2015-01-04"; p.parameterType = new System.Xml.XmlQualifiedName("DateTime", "http://www.w3.org/2001/XMLSchema"); pars.Add(p); net.epacdxnode.test.ResultSetType queryResp = WQXSubmit.QueryHelper(cred.NodeURL, token, "WQX", "WQX.GetTransactionHistoryByParameters_v2.1", null, null, pars); } else { lblMsg.Text = "Unable to authenticate to EPA-WQX server."; } } catch { return; } }
private void ConnectTest(string typ) { try { //AUTHENTICATION TEST********************************************* CDXCredentials cred = WQXSubmit.GetCDXSubmitCredentials2(Session["OrgID"].ToString()); string token = WQXSubmit.AuthHelper(cred.userID, cred.credential, "Password", "default", cred.NodeURL); if (token.Length > 0) { spnAuth.Attributes["class"] = "signup_header_check"; lblAuthResult.Text = "Authentication passed."; lblCDXSubmitInd.CssClass = "fldPass"; lblCDXSubmitInd.Text = "This Organization is able to submit to EPA."; //SUBMIT TEST********************************************* List <net.epacdxnode.test.ParameterType> pars = new List <net.epacdxnode.test.ParameterType>(); net.epacdxnode.test.ParameterType p = new net.epacdxnode.test.ParameterType(); p.parameterName = "organizationIdentifier"; p.Value = Session["OrgID"].ToString(); pars.Add(p); net.epacdxnode.test.ParameterType p2 = new net.epacdxnode.test.ParameterType(); p2.parameterName = "monitoringLocationIdentifier"; p2.Value = ""; pars.Add(p2); OpenEnvironment.net.epacdxnode.test.ResultSetType rs = WQXSubmit.QueryHelper(cred.NodeURL, token, "WQX", "WQX.GetMonitoringLocationByParameters_v2.1", null, null, pars); if (rs.rowId == "-99") { //THE NAAS ACCOUNT DOES NOT HAVE RIGHTS TO SUBMIT FOR THIS ORGANIZATION********************************************* spnSubmit.Attributes["class"] = "signup_header_cross"; if (typ == "LOCAL") { lblSubmitResult.Text = "The NAAS account you supplied is not authorized to submit for this organization. Please contact the STORET Helpdesk to request access."; } else { lblSubmitResult.Text = "Open Waters is not authorized to submit for your organization. Please contact the STORET Helpdesk to request access."; } lblCDXSubmitInd.CssClass = "fldErr"; lblCDXSubmitInd.Text = "This Organization is unable to submit to EPA. Please correct this below."; db_WQX.InsertOrUpdateT_WQX_ORGANIZATION(Session["OrgID"].ToString(), null, null, null, null, null, null, null, null, null, null, false, null, User.Identity.Name); } else { spnSubmit.Attributes["class"] = "signup_header_check"; lblSubmitResult.Text = "Submit test passed."; lblCDXSubmitInd.CssClass = "fldPass"; lblCDXSubmitInd.Text = "This Organization is able to submit to EPA."; //BOTH AUTHENTICATION AND SUBMIT PASSES - UPDATE ORG SUBMIT IND********************************************* db_WQX.InsertOrUpdateT_WQX_ORGANIZATION(Session["OrgID"].ToString(), null, null, null, null, null, null, null, null, null, null, true, null, User.Identity.Name); } } else //failed authentication { spnAuth.Attributes["class"] = "signup_header_cross"; lblAuthResult.Text = "Unable to authenticate to EPA-CDX. Please double-check your username and password."; spnSubmit.Attributes["class"] = "signup_header_crossbw"; lblSubmitResult.Text = "Cannot test until authentication is resolved."; lblCDXSubmitInd.CssClass = "fldErr"; lblCDXSubmitInd.Text = "This Organization is unable to submit to EPA. Please correct this below."; db_WQX.InsertOrUpdateT_WQX_ORGANIZATION(Session["OrgID"].ToString(), null, null, null, null, null, null, null, null, null, null, false, null, User.Identity.Name); } pnlCDXResults.Visible = true; } catch (Exception ex) { lblMsg.Text = ex.Message; } }