public void Main(int publishmentSystemId, int nodeId)
        {
            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);

            try
            {
                var queryCode   = PageUtils.FilterSqlAndXss(HttpContext.Current.Request.Form[GovInteractContentAttribute.QueryCode]);
                var contentInfo = DataProvider.GovInteractContentDao.GetContentInfo(publishmentSystemInfo, nodeId, queryCode);
                if (contentInfo != null)
                {
                    HttpContext.Current.Response.Write(GovInteractQueryTemplate.GetCallbackScript(publishmentSystemInfo, true, contentInfo, string.Empty));
                }
                else
                {
                    HttpContext.Current.Response.Write(GovInteractQueryTemplate.GetCallbackScript(publishmentSystemInfo, false, null, "您输入的查询号不正确"));
                }
            }
            catch (Exception ex)
            {
                //HttpContext.Current.Response.Write(GovInteractQueryTemplate.GetCallbackScript(publishmentSystemInfo, false, null, ex.Message));
                HttpContext.Current.Response.Write(GovInteractQueryTemplate.GetCallbackScript(publishmentSystemInfo, false, null, "程序错误"));
            }

            HttpContext.Current.Response.End();
        }
Ejemplo n.º 2
0
        public static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, int channelID, string channelIndex, string channelName, string interactName, string inputTemplateString, string successTemplateString, string failureTemplateString)
        {
            var parsedContent = string.Empty;

            pageInfo.AddPageScriptsIfNotExists(PageInfo.Components.Jquery);
            pageInfo.AddPageScriptsIfNotExists(PageInfo.JQuery.BShowLoading);
            pageInfo.AddPageScriptsIfNotExists(PageInfo.JQuery.BjTemplates);
            pageInfo.AddPageScriptsIfNotExists(PageInfo.JQuery.BValidate);

            var nodeID = channelID;

            if (!string.IsNullOrEmpty(interactName))
            {
                nodeID = DataProvider.GovInteractChannelDao.GetNodeIdByInteractName(pageInfo.PublishmentSystemId, interactName);
            }
            if (nodeID == 0)
            {
                nodeID = StlCacheManager.NodeId.GetNodeIdByChannelIdOrChannelIndexOrChannelName(pageInfo.PublishmentSystemId, pageInfo.PublishmentSystemId, channelIndex, channelName);
            }
            var nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, nodeID);

            if (nodeInfo == null || !EContentModelTypeUtils.Equals(nodeInfo.ContentModelId, EContentModelType.GovInteract))
            {
                nodeInfo = NodeManager.GetNodeInfo(pageInfo.PublishmentSystemId, pageInfo.PublishmentSystemInfo.Additional.GovInteractNodeId);
            }
            if (nodeInfo != null)
            {
                var queryStyleID = DataProvider.GovInteractChannelDao.GetQueryStyleId(nodeInfo.PublishmentSystemId, nodeInfo.NodeId);

                var styleInfo = TagStyleManager.GetTagStyleInfo(queryStyleID);
                if (styleInfo == null)
                {
                    styleInfo = new TagStyleInfo();
                }

                var queryTemplate  = new GovInteractQueryTemplate(pageInfo.PublishmentSystemInfo, nodeInfo.NodeId, styleInfo);
                var contentBuilder = new StringBuilder(queryTemplate.GetTemplate(styleInfo.IsTemplate, inputTemplateString, successTemplateString, failureTemplateString));

                StlParserManager.ParseTemplateContent(contentBuilder, pageInfo, contextInfo);
                parsedContent = contentBuilder.ToString();
            }

            return(parsedContent);
        }
Ejemplo n.º 3
0
 public static void IsCreateTemplate_CheckedChanged(TagStyleInfo styleInfo, PublishmentSystemInfo publishmentSystemInfo, TextBox tbContent, TextBox tbSuccess, TextBox tbFailure, TextBox tbStyle, TextBox tbScript)
 {
     if (StringUtils.EqualsIgnoreCase(StlGovPublicApply.ElementName, styleInfo.ElementName))
     {
         var applyInfo     = new TagStyleGovPublicApplyInfo(styleInfo.SettingsXML);
         var applyTemplate = new GovPublicApplyTemplate(publishmentSystemInfo, styleInfo, applyInfo);
         tbContent.Text = applyTemplate.GetFileInputTemplate();
         tbSuccess.Text = applyTemplate.GetFileSuccessTemplate();
         tbFailure.Text = applyTemplate.GetFileFailureTemplate();
         tbScript.Text  = applyTemplate.GetScript();
     }
     else if (StringUtils.EqualsIgnoreCase(StlGovPublicQuery.ElementName, styleInfo.ElementName))
     {
         var queryTemplate = new GovPublicQueryTemplate(publishmentSystemInfo, styleInfo);
         tbContent.Text = queryTemplate.GetFileInputTemplate();
         tbSuccess.Text = queryTemplate.GetFileSuccessTemplate();
         tbFailure.Text = queryTemplate.GetFileFailureTemplate();
         tbScript.Text  = queryTemplate.GetScript();
     }
     else if (StringUtils.EqualsIgnoreCase(StlGovInteractApply.ElementName, styleInfo.ElementName))
     {
         var applyInfo     = new TagStyleGovInteractApplyInfo(styleInfo.SettingsXML);
         var nodeID        = DataProvider.GovInteractChannelDao.GetNodeIdByApplyStyleId(styleInfo.StyleID);
         var applyTemplate = new GovInteractApplyTemplate(publishmentSystemInfo, nodeID, styleInfo, applyInfo);
         tbContent.Text = applyTemplate.GetFileInputTemplate();
         tbSuccess.Text = applyTemplate.GetFileSuccessTemplate();
         tbFailure.Text = applyTemplate.GetFileFailureTemplate();
         tbScript.Text  = applyTemplate.GetScript();
     }
     else if (StringUtils.EqualsIgnoreCase(StlGovInteractQuery.ElementName, styleInfo.ElementName))
     {
         var nodeID        = DataProvider.GovInteractChannelDao.GetNodeIdByQueryStyleId(styleInfo.StyleID);
         var queryTemplate = new GovInteractQueryTemplate(publishmentSystemInfo, nodeID, styleInfo);
         tbContent.Text = queryTemplate.GetFileInputTemplate();
         tbSuccess.Text = queryTemplate.GetFileSuccessTemplate();
         tbFailure.Text = queryTemplate.GetFileFailureTemplate();
         tbScript.Text  = queryTemplate.GetScript();
     }
 }