protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            var    command = (CommandJson) new DataContractJsonSerializer(typeof(CommandJson)).ReadObject(HttpContext.Current.Request.InputStream);
            Result result  = new Result();
            if (command.Database == "MySQL")
            {
                result = MySQLAdapter.Process(command);
            }
            if (command.Database == "Firebird")
            {
                result = FirebirdAdapter.Process(command);
            }
            if (command.Database == "MS SQL")
            {
                result = MSSQLAdapter.Process(command);
            }
            if (command.Database == "PostgreSQL")
            {
                result = PostgreSQLAdapter.Process(command);
            }

            var serializer = new DataContractJsonSerializer(typeof(Result));

            serializer.WriteObject(HttpContext.Current.Response.OutputStream, result);
            HttpContext.Current.Response.Headers.Add("Access-Control-Allow-Origin", "*");
            HttpContext.Current.Response.Headers.Add("Cache-Control", "no-cache");

            HttpContext.Current.Response.OutputStream.Flush();
            HttpContext.Current.Response.End();
        }
        catch {}
    }
        public void GetDataSource()
        {
            try
            {
                var    command = (CommandJson) new DataContractJsonSerializer(typeof(CommandJson)).ReadObject(HttpContext.Request.Body);
                Result result  = new Result();

                if (command.Database == "MS SQL")
                {
                    result = MSSQLAdapter.Process(command);
                }
                //if (command.Database == "PostgreSQL") result = PostgreSQLAdapter.Process(command);

                var serializer = new DataContractJsonSerializer(typeof(Result));

                serializer.WriteObject(HttpContext.Response.Body, result);


                HttpContext.Response.Body.Flush();
            }
            catch { }
        }
Example #3
0
        public void GetDataSource()
        {
            try
            {
                var    command = (CommandJson) new DataContractJsonSerializer(typeof(CommandJson)).ReadObject(HttpContext.Request.BodyReader.AsStream());
                Result result  = new Result();

                if (command.Database == "MS SQL")
                {
                    result = MSSQLAdapter.Process(command);
                }
                //if (command.Database == "PostgreSQL") result = PostgreSQLAdapter.Process(command);

                var serializer = new DataContractJsonSerializer(typeof(Result));

                serializer.WriteObject(HttpContext.Response.BodyWriter.AsStream(), result);
                HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
                HttpContext.Response.Headers.Add("Cache-Control", "no-cache");

                HttpContext.Response.Body.Flush();
                HttpContext.Response.Clear();
            }
            catch { }
        }