Exemplo n.º 1
0
        public static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, string styleName, string inputTemplateString, string successTemplateString, string failureTemplateString)
        {
            var parsedContent = string.Empty;

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

            var styleInfo = TagStyleManager.GetTagStyleInfo(pageInfo.PublishmentSystemId, ElementName, styleName);

            if (styleInfo == null)
            {
                styleInfo = new TagStyleInfo();
            }
            var applyInfo = new TagStyleGovPublicApplyInfo(styleInfo.SettingsXML);

            var applyTemplate  = new GovPublicApplyTemplate(pageInfo.PublishmentSystemInfo, styleInfo, applyInfo);
            var contentBuilder = new StringBuilder(applyTemplate.GetTemplate(styleInfo.IsTemplate, inputTemplateString, successTemplateString, failureTemplateString));

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

            return(parsedContent);
        }
Exemplo n.º 2
0
        public void Main(int publishmentSystemId, int nodeId, int styleId)
        {
            var body = new RequestBody();

            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);

            var tagStyleInfo = TagStyleManager.GetTagStyleInfo(styleId) ?? new TagStyleInfo();
            var tagStyleGovInteractApplyInfo = new TagStyleGovInteractApplyInfo(tagStyleInfo.SettingsXML);

            try
            {
                if (!tagStyleGovInteractApplyInfo.IsAnomynous && !body.IsUserLoggin)
                {
                    throw new Exception("请先登录系统!");
                }

                var contentInfo = DataProvider.GovInteractContentDao.GetContentInfo(publishmentSystemInfo, nodeId, HttpContext.Current.Request.Form);

                if (HttpContext.Current.Request.Files.Count > 0)
                {
                    foreach (var attributeName in HttpContext.Current.Request.Files.AllKeys)
                    {
                        var myFile = HttpContext.Current.Request.Files[attributeName];
                        if (myFile != null && "" != myFile.FileName)
                        {
                            var fileUrl = UploadFile(publishmentSystemInfo, myFile);
                            contentInfo.SetExtendedAttribute(attributeName, fileUrl);
                        }
                    }
                }

                var contentId = DataProvider.ContentDao.Insert(publishmentSystemInfo.AuxiliaryTableForGovInteract, publishmentSystemInfo, contentInfo);

                var realName         = contentInfo.RealName;
                var toDepartmentName = string.Empty;
                if (contentInfo.DepartmentId > 0)
                {
                    toDepartmentName = "至" + contentInfo.DepartmentName;
                }
                GovInteractApplyManager.LogNew(publishmentSystemId, nodeId, contentId, realName, toDepartmentName);

                MessageManager.SendSMS(publishmentSystemInfo, tagStyleGovInteractApplyInfo, ETableStyle.GovInteractContent, publishmentSystemInfo.AuxiliaryTableForGovInteract, nodeId, contentInfo);

                HttpContext.Current.Response.Write(GovInteractApplyTemplate.GetCallbackScript(publishmentSystemInfo, nodeId, true, contentInfo.QueryCode, string.Empty));
            }
            catch (Exception ex)
            {
                //HttpContext.Current.Response.Write(GovInteractApplyTemplate.GetCallbackScript(publishmentSystemInfo, nodeId, false, string.Empty, ex.Message));
                HttpContext.Current.Response.Write(GovInteractApplyTemplate.GetCallbackScript(publishmentSystemInfo, nodeId, false, string.Empty, "程序错误"));
            }

            HttpContext.Current.Response.End();
        }
Exemplo n.º 3
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.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 applyStyleID = DataProvider.GovInteractChannelDao.GetApplyStyleId(nodeInfo.PublishmentSystemId, nodeInfo.NodeId);

                var styleInfo = TagStyleManager.GetTagStyleInfo(applyStyleID);
                if (styleInfo == null)
                {
                    styleInfo = new TagStyleInfo();
                }
                var applyInfo = new TagStyleGovInteractApplyInfo(styleInfo.SettingsXML);

                var applyTemplate  = new GovInteractApplyTemplate(pageInfo.PublishmentSystemInfo, nodeInfo.NodeId, styleInfo, applyInfo);
                var contentBuilder = new StringBuilder(applyTemplate.GetTemplate(styleInfo.IsTemplate, inputTemplateString, successTemplateString, failureTemplateString));
                contentBuilder.Replace("{ChannelID}", nodeInfo.NodeId.ToString());

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

            return(parsedContent);
        }
Exemplo n.º 4
0
        public static string ParseImpl(PageInfo pageInfo, ContextInfo contextInfo, string styleName, string inputTemplateString, string successTemplateString, string failureTemplateString)
        {
            pageInfo.AddPageScriptsIfNotExists(PageInfo.Components.Jquery);
            pageInfo.AddPageScriptsIfNotExists(PageInfo.JQuery.BShowLoading);
            pageInfo.AddPageScriptsIfNotExists(PageInfo.JQuery.BjTemplates);
            pageInfo.AddPageScriptsIfNotExists(PageInfo.JQuery.BValidate);

            var styleInfo = TagStyleManager.GetTagStyleInfo(pageInfo.PublishmentSystemId, ElementName, styleName) ??
                            new TagStyleInfo();

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

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

            return(parsedContent);
        }
Exemplo n.º 5
0
        public void Main(int publishmentSystemId, int styleId)
        {
            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);

            var tagStyleInfo = TagStyleManager.GetTagStyleInfo(styleId) ?? new TagStyleInfo();
            var tagStyleGovPublicApplyInfo = new TagStyleGovPublicApplyInfo(tagStyleInfo.SettingsXML);

            try
            {
                var applyInfo = DataProvider.GovPublicApplyDao.GetApplyInfo(publishmentSystemId, styleId, HttpContext.Current.Request.Form);

                var applyId = DataProvider.GovPublicApplyDao.Insert(applyInfo);

                var fromName = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.CivicName);
                if (applyInfo.IsOrganization)
                {
                    fromName = applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.OrgName);
                }
                var toDepartmentName = string.Empty;
                if (applyInfo.DepartmentId > 0)
                {
                    toDepartmentName = "至" + applyInfo.DepartmentName;
                }
                GovPublicApplyManager.LogNew(publishmentSystemId, applyId, fromName, toDepartmentName);

                MessageManager.SendSMSByGovPublicApply(publishmentSystemInfo, tagStyleGovPublicApplyInfo, applyInfo);

                HttpContext.Current.Response.Write(GovPublicApplyTemplate.GetCallbackScript(publishmentSystemInfo, true, applyInfo.QueryCode, string.Empty));
                HttpContext.Current.Response.End();
            }
            catch (Exception ex)
            {
                //HttpContext.Current.Response.Write(GovPublicApplyTemplate.GetCallbackScript(publishmentSystemInfo, false, string.Empty, ex.Message));
                HttpContext.Current.Response.Write(GovPublicApplyTemplate.GetCallbackScript(publishmentSystemInfo, false, string.Empty, "程序错误"));
                HttpContext.Current.Response.End();
            }
        }