Example #1
0
 public GovInteractApplyTemplate(PublishmentSystemInfo publishmentSystemInfo, int nodeId, TagStyleInfo tagStyleInfo, TagStyleGovInteractApplyInfo tagStyleApplyInfo)
 {
     _publishmentSystemInfo = publishmentSystemInfo;
     _nodeId            = nodeId;
     _tagStyleInfo      = tagStyleInfo;
     _tagStyleApplyInfo = tagStyleApplyInfo;
 }
Example #2
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            try
            {
                var styleInfo = DataProvider.TagStyleDao.GetTagStyleInfo(styleID);
                var applyInfo = new TagStyleGovInteractApplyInfo(styleInfo.SettingsXML);

                applyInfo.IsAnomynous = TranslateUtils.ToBool(IsAnomynous.SelectedValue);

                styleInfo.SettingsXML = applyInfo.ToString();

                DataProvider.TagStyleDao.Update(styleInfo);

                Body.AddSiteLog(PublishmentSystemId, "修改互动交流提交样式", $"样式名称:{styleInfo.StyleName}");

                isChanged = true;
            }
            catch (Exception ex)
            {
                FailMessage(ex, "互动交流提交样式修改失败!");
            }

            if (isChanged)
            {
                PageUtils.CloseModalPage(Page);
            }
        }
Example #3
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();
        }
Example #4
0
        public static string Parse(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfo)
        {
            var parsedContent = string.Empty;

            try
            {
                var channelID    = string.Empty;
                var channelIndex = string.Empty;
                var channelName  = string.Empty;
                var interactName = string.Empty;
                var applyInfo    = new TagStyleGovInteractApplyInfo(string.Empty);

                var inputTemplateString   = string.Empty;
                var successTemplateString = string.Empty;
                var failureTemplateString = string.Empty;
                StlParserUtility.GetInnerTemplateStringOfInput(node, out inputTemplateString, out successTemplateString, out failureTemplateString, pageInfo, contextInfo);

                var ie = node.Attributes.GetEnumerator();

                while (ie.MoveNext())
                {
                    var attr          = (XmlAttribute)ie.Current;
                    var attributeName = attr.Name.ToLower();
                    if (attributeName.Equals(Attribute_ChannelID))
                    {
                        channelID = StlEntityParser.ReplaceStlEntitiesForAttributeValue(attr.Value, pageInfo, contextInfo);
                    }
                    else if (attributeName.Equals(Attribute_ChannelIndex))
                    {
                        channelIndex = StlEntityParser.ReplaceStlEntitiesForAttributeValue(attr.Value, pageInfo, contextInfo);
                    }
                    else if (attributeName.Equals(Attribute_ChannelName))
                    {
                        channelName = StlEntityParser.ReplaceStlEntitiesForAttributeValue(attr.Value, pageInfo, contextInfo);
                    }
                    else if (attributeName.Equals(Attribute_InteractName))
                    {
                        interactName = StlEntityParser.ReplaceStlEntitiesForAttributeValue(attr.Value, pageInfo, contextInfo);
                    }
                }

                parsedContent = ParseImpl(pageInfo, contextInfo, TranslateUtils.ToInt(channelID), channelIndex, channelName, interactName, inputTemplateString, successTemplateString, failureTemplateString);
            }
            catch (Exception ex)
            {
                parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, ex);
            }

            return(parsedContent);
        }
Example #5
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            styleID = Body.GetQueryInt("StyleID");

            if (!IsPostBack)
            {
                var styleInfo = DataProvider.TagStyleDao.GetTagStyleInfo(styleID);
                var applyInfo = new TagStyleGovInteractApplyInfo(styleInfo.SettingsXML);

                ControlUtils.SelectListItems(IsAnomynous, applyInfo.IsAnomynous.ToString());
            }
        }
Example #6
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);
        }
Example #7
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();
     }
 }