Esempio n. 1
0
        protected string RenderHtml(string controller, string action, BeeDataAdapter dataAdapter)
        {
            string result = string.Empty;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                using (StreamWriter streamWriter = new StreamWriter(memoryStream, Encoding.UTF8))
                {
                    HttpWorkerRequest wr          = new System.Web.Hosting.SimpleWorkerRequest("index.htm", string.Empty, streamWriter);
                    HttpContext       httpContext = new HttpContext(wr);
                    httpContext.Response.ContentEncoding = Encoding.Default;

                    MvcDispatcher.ExecuteAction(httpContext, controller, action, dataAdapter);

                    httpContext.Response.Flush();
                    streamWriter.Flush();

                    memoryStream.Position = 0;
                    //using (StreamReader reader = new StreamReader(memoryStream, Encoding.UTF8))
                    //{
                    //    result = reader.ReadToEnd();
                    //}
                    result = Encoding.UTF8.GetString(memoryStream.ToArray());
                }
            }

            return(result);
        }
Esempio n. 2
0
        public void RenderAction(string controller, string action, params string[] data)
        {
            BeeDataAdapter dataAdapter = new BeeDataAdapter();

            foreach (string item in data)
            {
                Match match = ExAttributeRegex.Match(item);
                if (match.Success)
                {
                    dataAdapter[match.Groups["name"].Value] = match.Groups["value"].Value;
                }
            }

            MvcDispatcher.ExecuteAction(controller, action, dataAdapter);
        }
Esempio n. 3
0
        protected StreamResult OutputPage(string fileName, string controller, string action)
        {
            MemoryStream memoryStream = new MemoryStream();
            StreamWriter streamWriter = new StreamWriter(memoryStream);

            HttpWorkerRequest wr          = new System.Web.Hosting.SimpleWorkerRequest("index.htm", string.Empty, streamWriter);
            HttpContext       httpContext = new HttpContext(wr);

            httpContext.Response.ContentEncoding = Encoding.Default;

            MvcDispatcher.ExecuteAction(httpContext, controller, action, ViewData);

            httpContext.Response.Flush();
            streamWriter.Flush();

            StreamResult streamResult = new StreamResult(fileName, memoryStream);

            return(streamResult);
        }
Esempio n. 4
0
 public void RenderAction(string controller, string action, BeeDataAdapter dataAdapter)
 {
     MvcDispatcher.ExecuteAction(controller, action, dataAdapter);
 }
Esempio n. 5
0
 public void RenderAction(string controller, string action)
 {
     MvcDispatcher.ExecuteAction(controller, action, null);
 }
Esempio n. 6
0
 protected void Invoke(string controllerName, string actionName, BeeDataAdapter dataAdapter)
 {
     MvcDispatcher.ExecuteAction(controllerName, actionName, dataAdapter);
 }