protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {

                //Dictionary<string, string> featureList = getColumnsAndValues();

                //if (featureList == null || featureList.Count == 0) return;

                // Blob contain input file. Get from Input Information
                string Account_Name = txtAccountName_blob.Text;
                string Account_Key = txtAccountKey_blob.Text;
                string container = txtContainer_blob.Text;
                string inputBlobName = txtBlobName.Text;

                // Blob store output. Get from Azure Blob information
                OutputObject output = new OutputObject
                {
                    AccountName = txtAccountName.Text,
                    AccountKey = txtAccountKey.Text,
                    Container = txtContainer.Text,
                    isAddTime = false,
                    NodeOutputName = new Dictionary<string, string>()
                };
                foreach (var batchOutput in paramObj.listBatchOutputs)
                {
                    output.NodeOutputName.Add(batchOutput.Name, string.IsNullOrEmpty(batchOutput.Alias) ? batchOutput.Name : batchOutput.Alias);
                }
                string filePath = _fileUpload.FileName;
                if (!input_radio_File.Checked) filePath = null;
                InvokeBatchExecutionService(Account_Name, Account_Key, container, inputBlobName, filePath, output).Wait();
            }
            catch (Exception ex)
            {
                //txtresultModal.Text = ex.Message;
                //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "failModal", "$('#failModal').modal();", true);
                ShowError(ex.Message);
            }
        }
        static List<OutputObject> ExtractValuesObject(string jsonStr)
        {
            try
            {
                List<OutputObject> listOutput = new List<OutputObject>();
                var objects = JObject.Parse(JObject.Parse(jsonStr)["Results"].ToString());

                foreach (var output in objects)
                {
                    OutputObject tmpOutput = new OutputObject();
                    tmpOutput.Name = output.Key;
                    try
                    {
                        JArray outputArray = JArray.Parse(output.Value["value"]["Values"][0].ToString());
                        foreach (var outputValue in outputArray)
                            tmpOutput.Values.Add(outputValue.ToString());                       
                    }
                    catch (Exception) { }
                    finally { listOutput.Add(tmpOutput); };
                }
                return listOutput;
            }
            catch (Exception)
            {
                return null;
            }
        }
        async Task InvokeBatchExecutionService(string accountNameInput, string accountKeyInput, string containerInput, string inputBlobName, string inputFileName, OutputObject outputObj)
        {
            // Upload file to Blob if pathFile given

            if (isHasInput && input_radio_File.Checked)
            {
                accountNameInput = outputObj.AccountName;
                if (string.IsNullOrEmpty(accountNameInput))
                {
                    //Console.WriteLine("Upload Error");
                    ShowError("Please enter Account Name");
                    return;
                }
                accountKeyInput = outputObj.AccountKey;
                if (string.IsNullOrEmpty(accountKeyInput))
                {
                    //Console.WriteLine("Upload Error");
                    ShowError("Please enter Account Key");
                    return;
                }
                containerInput = outputObj.Container;
                if (string.IsNullOrEmpty(containerInput))
                {
                    //Console.WriteLine("Upload Error");
                    ShowError("Please enter Container Name");
                    return;
                }
                

                if (string.IsNullOrEmpty(_fileUpload.FileName))
                {
                    //Console.WriteLine("Upload Error");
                    ShowError("Please choose input file");
                    return;
                }

                inputBlobName = inputFileName;

                //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "disable", "$(\"#btnclear\").prop(\"disabled\",true);", true);

                bool uploadresult = await uploadBigFile(accountNameInput, accountKeyInput, containerInput, inputFileName);
                //$("#btnclear").prop("disabled",true)
                
                if (!uploadresult)
                {
                    //Console.WriteLine("Upload Error");
                    ShowError("Upload Error");
                    return;
                }
                
            }

            // First collect and fill in the URI and access key for your web service endpoint.
            // These are available on your service's API help page.
            var endpointUri = paramObj.Url;
            string accessKey = Crypto.DecryptStringAES(paramObj.APIKey);

            // Create an Azure Machine Learning runtime client for this endpoint
            var runtimeClient = new RuntimeClient(endpointUri, accessKey);

            // Define the request information for your batch job. This information can contain:
            // -- A reference to the AzureBlob containing the input for your job run
            // -- A set of values for global parameters defined as part of your experiment and service
            // -- A set of output blob locations that allow you to redirect the job's results

            // NOTE: This sample is applicable, as is, for a service with explicit input port and
            // potential global parameters. Also, we choose to also demo how you could override the
            // location of one of the output blobs that could be generated by your service. You might 
            // need to tweak these features to adjust the sample to your service.
            //
            // All of these properties of a BatchJobRequest shown below can be optional, depending on
            // your service, so it is not required to specify all with any request.  If you do not want to
            // use any of the parameters, a null value should be passed in its place.

            // Define the reference to the blob containing your input data. You can refer to this blob by its
            // connection string / container / blob name values; alternatively, we also support references 
            // based on a blob SAS URI

            string ext = ".csv";//inputBlobName.Substring(inputBlobName.LastIndexOf("."));

            BlobReference inputBlob;
            if (isHasInput)
            {
                inputBlob = BlobReference.CreateFromConnectionStringData(
                connectionString: string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", accountNameInput, accountKeyInput),
                containerName: containerInput,
                blobName: inputBlobName);
                ext = inputBlobName.Substring(inputBlobName.LastIndexOf("."));
            }
            else inputBlob = null;


            
            // If desired, one can override the location where the job outputs are to be stored, by passing in
            // the storage account details and name of the blob where we want the output to be redirected to.

            var outputLocations = new Dictionary<string, BlobReference>();
           
                foreach (var keyvalue in outputObj.NodeOutputName)
                {
                    outputLocations.Add(

                        keyvalue.Key,
                        BlobReference.CreateFromConnectionStringData(
                            connectionString: string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", outputObj.AccountName, outputObj.AccountKey),
                            containerName: outputObj.Container,
                            blobName: !outputObj.isAddTime ? keyvalue.Value + "_" + DateTime.Now.ToString("MMddyy_hhmmss") + ext : keyvalue.Value + ext
                    ));

                };
          

            // If applicable, you can also set the global parameters for your service
            var globalParameters = new Dictionary<string, string>();
            foreach(var global in paramObj.listGlobalParameter)
            {
                
                string columnValue = "";
                var control = FindControl(global.Name);
                if (control is TextBox)
                {
                    TextBox txt = control as TextBox;
                    if (txt.Text != "")
                        columnValue = txt.Text;
                }
                else if (control is DropDownList)
                {
                    DropDownList lb = control as DropDownList;
                    if (lb.SelectedIndex != -1)
                        columnValue = lb.SelectedValue;
                }
                if (control is RadioButtonList)
                {
                    RadioButtonList ct = control as RadioButtonList;
                    if (ct.SelectedIndex != -1)
                        columnValue = ct.SelectedValue;
                }
                globalParameters.Add(global.Name, columnValue);
            }
            

            var jobRequest = new BatchJobRequest
            {
                Input = inputBlob,
                GlobalParameters = globalParameters,
                Outputs = outputLocations
            };

            try
            {
                // Register the batch job with the system, which will grant you access to a job object
                BatchJob job = await runtimeClient.RegisterBatchJobAsync(jobRequest);

                AddJobIdCookie(job.Id, job.CreatedAt.ToLocalTime().ToString());

                // Start the job to allow it to be scheduled in the running queue
                await job.StartAsync();

                //ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('Status.aspx?jobid=" + job.Id + "');", true);
                

                Response.Redirect("Status.aspx?jobid=" + job.Id);

                // Wait for the job's completion and handle the output

                //BatchJobStatus jobStatus = await job.WaitForCompletionAsync();
                //while (job.CheckStatus().JobState != JobState.Finished && job.CheckStatus().JobState != JobState.Failed)
                //{
                //    Console.WriteLine(job.Id + ":" + job.CreatedAt.ToLocalTime() + job.CheckStatus().JobState);
                //}

                //BatchJobStatus jobStatus = job.CheckStatus();
                ////job.CreatedAt
                //if (jobStatus.JobState == JobState.Finished)
                //{
                //    // Process job outputs
                //    //Console.WriteLine(@"Job {0} has completed successfully and returned {1} outputs", job.Id, jobStatus.Results.Count);
                //    lblJobIdSuccess.Text = job.Id;
                //    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "CompleteSuccess", "$('#CompleteSuccess').modal();", true);

                //    foreach (var output in jobStatus.Results)
                //    {
                //        //Console.WriteLine(@"\t{0}: {1}", output.Key, output.Value.AbsoluteUri);
                //        Response.Redirect(output.Value.AbsoluteUri);

                //    }
                //}
                //else if (jobStatus.JobState == JobState.Failed)
                //{
                //    // Handle job failure
                //    //Console.WriteLine(@"Job {0} has failed with this error: {1}", job.Id, jobStatus.Details);
                //    txtresultModal.Text = jobStatus.Details;
                //    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "failModal", "$('#failModal').modal();", true);
                //}
            }
            catch (ArgumentException ex)
            {
                //Console.WriteLine("Argument {0} is invalid: {1}", aex.ParamName, aex.Message);
                //txtresultModal.Text = ex.Message;
                //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "failModal", "$('#failModal').modal();", true);
                ShowError(ex.Message);
            }
            catch (RuntimeException runtimeError)
            {
                //Console.WriteLine("Runtime error occurred: {0} - {1}", runtimeError.ErrorCode, runtimeError.Message);
                //Console.WriteLine("Error details:");
                string error = "";
                foreach (var errorDetails in runtimeError.Details)
                {
                    error += string.Format("\t{0} - {1}", errorDetails.Code, errorDetails.Message);
                }
                //txtresultModal.Text = error;
                //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "failModal", "$('#failModal').modal();", true);
                ShowError(error);
            }
            catch (Exception ex)
            {
                //Console.WriteLine("Unexpected error occurred: {0} - {1}", ex.GetType().Name, ex.Message);
                //txtresultModal.Text = ex.Message;
                //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "failModal", "$('#failModal').modal();", true);
                ShowError(ex.Message);
            }
        }