private string GetFileName()
        {
            if (string.IsNullOrEmpty(FileName))
            {
                return(DEFAULT_FILE);
            }

            return(UseTemplate ? WebRazorUtil.GetTemplateFile(FileName) : FileName);
        }
 public string GetTemplateFile(ISource source, IInputData input, OutputData outputData)
 {
     if (input.QueryString["GetData"] == "Page" || input.IsPost)
     {
         return(WebRazorUtil.GetTemplateFile("StatList/listmain.cshtml"));
     }
     else
     {
         return(WebRazorUtil.GetTemplateFile("StatList/template.cshtml"));
     }
 }
Example #3
0
        public IContent WritePage(ISource source, IPageData pageData, OutputData outputData)
        {
            object       model   = WebRazorUtil.GetModel(outputData);
            var          viewBag = WebRazorUtil.GetViewBag(pageData, fMetaData, null, RazorData);
            IRazorEngine engine  = RazorEnginePlugInFactory.CreateRazorEngine(EngineName);

            string fileName = UseTemplate ? WebRazorUtil.GetTemplateFile(fFileName) : fFileName;

            string content = Task.Run(async()
                                      => await RazorExtension.CompileRenderWithLayoutAsync(engine, fileName,
                                                                                           Layout, model, null, viewBag)).GetAwaiter().GetResult();

            return(new SimpleContent(ContentTypeConst.HTML, content));
        }
Example #4
0
        public IPageMaker CreateObject(params object[] args)
        {
            IInputData input = ObjectUtil.QueryObject <IInputData>(args);

            TkDebug.AssertNotNull(input, "参数args中缺少IInputData类型", this);

            if (input.IsPost)
            {
                return(new ExceptionPostPageMaker());
            }
            else
            {
                string fileName = UseTemplate ? WebRazorUtil.GetTemplateFile(PART_FILE_NAME) : FILE_NAME;
                return(new FreeRazorPageMaker(fileName));
            }
        }
Example #5
0
        public RazorTableOutput(string editRazorFile, string detailRazorFile,
                                string detailHeadRazorFile = null, string detailListRazorFile = null)
        {
            TkDebug.AssertArgumentNullOrEmpty(editRazorFile, nameof(editRazorFile), null);
            TkDebug.AssertArgumentNullOrEmpty(detailRazorFile, nameof(detailRazorFile), null);

            EditRazorFile   = WebRazorUtil.GetTemplateFile(editRazorFile);
            DetailRazorFile = WebRazorUtil.GetTemplateFile(detailRazorFile);
            if (!string.IsNullOrEmpty(detailHeadRazorFile))
            {
                DetailHeadRazorFile = WebRazorUtil.GetTemplateFile(detailHeadRazorFile);
            }
            if (!string.IsNullOrEmpty(detailListRazorFile))
            {
                DetailListRazorFile = WebRazorUtil.GetTemplateFile(detailListRazorFile);
            }
            else
            {
                DetailListRazorFile = WebRazorUtil.GetTemplateFile(DEFAULT_DLIST_FILENAME);
            }
        }
Example #6
0
 public string GetTemplateFile(ISource source, IInputData input, OutputData outputData)
 {
     return(WebRazorUtil.GetTemplateFile("Detail/template.cshtml"));
 }
Example #7
0
        private IPageMaker CreatePageMaker()
        {
            string fileName = UseTemplate ? WebRazorUtil.GetTemplateFile(PART_FILE_NAME) : FILE_NAME;

            return(new FreeRazorPageMaker(fileName));
        }
Example #8
0
 public string GetTemplateFile(ISource source, IInputData input, OutputData outputData)
 {
     return(WebRazorUtil.GetTemplateFile(fConfig.TemplateFile));
 }