예제 #1
0
        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;
            }
        }
예제 #2
0
        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;
            }
        }