Ejemplo n.º 1
0
        private void udcReport003_ButtonViewClick(object sender, EventArgs e)
        {
            DataTable dt      = null;
            DataTable dtChart = null;

            if (Step.ToString() == " " || Step.ToString() == "")
            {
                return;
            }
            if (Function_Name.Trim() == "")
            {
                return;
            }

            spdData_Sheet1.RowCount = 0;

            DateTime dtStart = DateTime.Now;

            dt      = CmnFunction.oComm.GetFuncDataTable(Function_Name, Condition);
            dtChart = dt.Copy();
            DateTime dtEnd = DateTime.Now;
            TimeSpan ts    = dtEnd.Subtract(dtStart);

            lblExecution.Text  = "Execution Time : " + ts.TotalSeconds.ToString("#,##0.0000") + "(msecs)  ";
            lblExecution.Text += "Data Count : " + dt.Rows.Count.ToString();

            if (dt.Rows.Count == 0)
            {
                spdData.Visible  = false;
                utrChart.Visible = false;
            }
            else
            {
                spdData.Visible           = true;
                utrChart.Visible          = true;
                spdData_Sheet1.DataSource = Modify_DataTable(dt);
                CmnFunction.FitColumnHeader(spdData);

                Make_Chart(dtChart);
            }

            dt.Dispose();
            dtChart.Dispose();
        }
Ejemplo n.º 2
0
        //private bool ValidateAgainstSchema(string xml)
        //{
        //    XmlSchemaSet schemas = new XmlSchemaSet();
        //    schemas.Add("http://www.funkwerk-itk.com/Siri/KARI-TrainFormation-Import", "./Banenor/KARI_TrainFormationImport_V1.7.xsd");

        //    XDocument doc = XDocument.Parse(xml);
        //    string msg = "";
        //    doc.Validate(schemas, (o, e) =>
        //    {
        //        msg += e.Message + Environment.NewLine;
        //    });

        //    output.WriteLine(string.IsNullOrEmpty(msg) ? "Document is valid" : "Document invalid: " + msg);

        //    return string.IsNullOrEmpty(msg);
        //}

        private async Task <string> HTTP_TestMap(string inputfile, string destinationFile)
        {
            string input = await File.ReadAllTextAsync(inputfile);

            string source        = input;
            string tempInputFile = Path.GetTempFileName();

            System.IO.File.WriteAllText(tempInputFile, source);
            output.WriteLine("Result stored temporarily in " + tempInputFile);

            var request = TestFactory.CreateHttpRequest("tmkKey", "tmpVal", source);

            Microsoft.Azure.WebJobs.ExecutionContext context = new Microsoft.Azure.WebJobs.ExecutionContext()
            {
                FunctionName         = "Test",
                FunctionAppDirectory = "TestAppDirectory",
                FunctionDirectory    = "TestDirectory",
                InvocationId         = Guid.NewGuid()
            };

            //Run the transformation by calling "Function_Name" which in this case is the function name
            var response = await Function_Name.Run(request, logger, context);

            if (response == null)
            {
                return(null);
            }

            string responseContent = await response.Content.ReadAsStringAsync();

            if (responseContent != null)
            {
                System.IO.File.WriteAllText(destinationFile, responseContent);
                return(responseContent);
            }

            return(null);
        }