Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.HttpBrowserCapabilities browser = Request.Browser;
            if (paramObj.ImportInputParameter(Server.MapPath("~\\Resources\\AMLParameter.xml")))
            {
                Page.Title        = paramObj.Title;
                lblTitle.Text     = paramObj.Title;
                webServicePostUrl = AMLParameterObject.GetPostUrl(paramObj.Url);
            }
            else
            {
                RequireInfor();
            }

            if (paramObj.listGlobalParameter != null && paramObj.listGlobalParameter.Count > 0)
            {
                // Show Global parameter
                //GenerateControl.ShowInput(GlobalPlaceHolder1, GlobalPlaceHolder2, paramObj.listGlobalParameter, browser);
                GenerateControl.ShowInput(PlaceHolderMain, paramObj.listGlobalParameter, browser, "Global Parameters");
            }

            //GenerateControl.ShowInput(InputPlaceHolder1, InputPlaceHolder2, paramObj.listInputParameter, browser);
            if (paramObj.listInputGroup != null)
            {
                paramObj.listInputGroup.Sort(); // Sort input by group name
                foreach (var groupName in paramObj.listInputGroup)
                {
                    var listParam = paramObj.listInputParameter.Where(x => (x.Group == groupName)).ToList();
                    GenerateControl.ShowInput(PlaceHolderMain, listParam, browser, groupName + " Parameters");
                }
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.HttpBrowserCapabilities browser = Request.Browser;
            if (paramObj.ImportInputParameter(Server.MapPath("~\\Resources\\AMLParameter.xml")))
            {
                Page.Title        = paramObj.Title;
                lblTitle.Text     = paramObj.Title;
                webServicePostUrl = paramObj.Url;
            }
            else
            {
                RequireInfor();
            }

            GenerateControl.ShowInput(InputPlaceHolder1, InputPlaceHolder2, paramObj.listInputParameter, browser);
        }
Ejemplo n.º 3
0
        //******************************************RRS Client code to submit request to server***************************************
        //This is copied from the help page sample code and modified for ASP.NEt
        async Task InvokeRequestResponseService_A(Dictionary <string, string> columnsDictionary)
        {
            ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return(true); });
            webServicePostUrl = webServicePostUrl.Replace("format=swagger", "format=details");
            var scoreRequest = GetScoreRequest(columnsDictionary);

            using (var client = new HttpClient())
            {
                string apiKey = (paramObj.APIKey);
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
                client.BaseAddress = new Uri(webServicePostUrl);

                // WARNING: The 'await' statement below can result in a deadlock if you are calling this code from the UI thread of an ASP.Net application.
                // One way to address this would be to call ConfigureAwait(false) so that the execution does not attempt to resume on the original context.
                // For instance, replace code such as:
                //      result = await DoSomeTask()
                // with the following:
                //      result = await DoSomeTask().ConfigureAwait(false)

                HttpResponseMessage response = await client.PostAsJsonAsync("", scoreRequest).ConfigureAwait(false);;

                if (response.IsSuccessStatusCode)
                {
                    string apiResult = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

                    //List<string> listValues = ExtractValues(apiResult);
                    //GenerateControl.ShowOutput(OutputPlaceHolder, bottomsciprtPlaceHolde, paramObj.listOutputParameter, listValues, this);

                    List <OutputObject> listOutputObject = ExtractValuesObject(apiResult);
                    GenerateControl.ShowOutput(OutputPlaceHolder, bottomsciprtPlaceHolde, paramObj.listOutputParameter, listOutputObject, this);

                    FocusControlOnPageLoad("divResult");
                }
                else
                {
                    divResult.InnerText = string.Format("The request failed with status code: {0}", response.StatusCode);
                    // Print the headers - they include the requert ID and the timestamp, which are useful for debugging the failure
                    divResult.InnerText = response.Headers.ToString();
                    string responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

                    divResult.InnerText = responseContent;
                }
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Response.AddHeader("Keep-Alive", "21600");

            System.Web.HttpBrowserCapabilities browser = Request.Browser;
            if (paramObj.ImportInputParameter(Server.MapPath("~\\Resources\\AMLParameter.xml")))
            {
                Page.Title        = paramObj.Title;
                lblTitle.Text     = paramObj.Title;
                webServicePostUrl = paramObj.Url;

                isHasInput  = paramObj.listBatchInputs != null && paramObj.listBatchInputs.Count > 0;
                isHasOutput = paramObj.listBatchOutputs != null && paramObj.listBatchOutputs.Count > 0;
            }
            else
            {
                RequireInfor();
            }

            if (paramObj.listGlobalParameter != null && paramObj.listGlobalParameter.Count > 0)
            {
                // Show Global parameter
                GenerateControl.ShowInput(GlobalPlaceHoder, null, paramObj.listGlobalParameter, browser);
            }

            if (!isHasInput && !isHasOutput)
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Hide", "document.getElementById(\"both\").style.display = \"none\";", true);
            }
            else if (!isHasInput)
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Hide", "document.getElementById(\"Input_FIle_Info_fieldset\").style.display = \"none\";", true);
            }
            else if (!isHasOutput)
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Hide", "document.getElementById(\"azure_Storage_Info_fieldset\").style.display = \"none\";", true);
            }
        }