public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (!IsPostBack)
            {
                if (Body.IsQueryExists("StyleID"))
                {
                    var styleId   = Body.GetQueryInt("StyleID");
                    var styleInfo = DataProvider.TagStyleDao.GetTagStyleInfo(styleId);
                    if (styleInfo != null)
                    {
                        var applyInfo = new TagStyleGovPublicApplyInfo(styleInfo.SettingsXML);
                        StyleName.Text = styleInfo.StyleName;

                        ControlUtils.SelectListItems(IsSMS, applyInfo.IsSMS.ToString());
                        if (applyInfo.IsSMS)
                        {
                            phSMS.Visible = true;
                        }
                        SMSTo.Text    = applyInfo.SMSTo;
                        SMSTitle.Text = applyInfo.SMSTitle;
                    }
                }
            }
        }
Beispiel #2
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);
        }
Beispiel #3
0
        public static string Parse(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfo)
        {
            var parsedContent = string.Empty;

            try
            {
                var styleName = string.Empty;
                var applyInfo = new TagStyleGovPublicApplyInfo(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_StyleName))
                    {
                        styleName = StlEntityParser.ReplaceStlEntitiesForAttributeValue(attr.Value, pageInfo, contextInfo);
                    }
                }

                parsedContent = ParseImpl(pageInfo, contextInfo, styleName, inputTemplateString, successTemplateString, failureTemplateString);
            }
            catch (Exception ex)
            {
                parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, ex);
            }

            return(parsedContent);
        }
Beispiel #4
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();
     }
 }
Beispiel #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();
            }
        }
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var          isChanged = false;
            TagStyleInfo styleInfo;

            if (Body.IsQueryExists("StyleID"))
            {
                try
                {
                    var styleId = Body.GetQueryInt("StyleID");
                    styleInfo = DataProvider.TagStyleDao.GetTagStyleInfo(styleId);
                    if (styleInfo != null)
                    {
                        var applyInfo = new TagStyleGovPublicApplyInfo(styleInfo.SettingsXML);

                        styleInfo.StyleName = StyleName.Text;

                        applyInfo.IsSMS    = TranslateUtils.ToBool(IsSMS.SelectedValue);
                        applyInfo.SMSTo    = SMSTo.Text;
                        applyInfo.SMSTitle = SMSTitle.Text;

                        styleInfo.SettingsXML = applyInfo.ToString();
                    }
                    DataProvider.TagStyleDao.Update(styleInfo);

                    Body.AddSiteLog(PublishmentSystemId, "修改依申请公开提交样式", $"样式名称:{styleInfo.StyleName}");

                    isChanged = true;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "依申请公开提交样式修改失败!");
                }
            }
            else
            {
                var styleNameArrayList = DataProvider.TagStyleDao.GetStyleNameArrayList(PublishmentSystemId, StlGovPublicApply.ElementName);
                if (styleNameArrayList.IndexOf(StyleName.Text) != -1)
                {
                    FailMessage("依申请公开提交样式添加失败,依申请公开提交样式名称已存在!");
                }
                else
                {
                    try
                    {
                        styleInfo = new TagStyleInfo();
                        var applyInfo = new TagStyleGovPublicApplyInfo(string.Empty);

                        styleInfo.StyleName           = StyleName.Text;
                        styleInfo.ElementName         = StlGovPublicApply.ElementName;
                        styleInfo.PublishmentSystemID = PublishmentSystemId;

                        applyInfo.IsSMS    = TranslateUtils.ToBool(IsSMS.SelectedValue);
                        applyInfo.SMSTo    = SMSTo.Text;
                        applyInfo.SMSTitle = SMSTitle.Text;

                        styleInfo.SettingsXML = applyInfo.ToString();

                        DataProvider.TagStyleDao.Insert(styleInfo);

                        Body.AddSiteLog(PublishmentSystemId, "添加依申请公开提交样式", $"样式名称:{styleInfo.StyleName}");

                        isChanged = true;
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "依申请公开提交样式添加失败!");
                    }
                }
            }

            if (isChanged)
            {
                PageUtils.CloseModalPage(Page);
            }
        }
Beispiel #7
0
 public GovPublicApplyTemplate(PublishmentSystemInfo publishmentSystemInfo, TagStyleInfo tagStyleInfo, TagStyleGovPublicApplyInfo applyInfo)
 {
     _publishmentSystemInfo = publishmentSystemInfo;
     _tagStyleInfo          = tagStyleInfo;
     _applyInfo             = applyInfo;
 }
Beispiel #8
0
        public static void SendSMSByGovPublicApply(PublishmentSystemInfo publishmentSystemInfo, TagStyleGovPublicApplyInfo tagStyleInfo, GovPublicApplyInfo applyInfo)
        {
            try
            {
                if (tagStyleInfo.IsSMS && !string.IsNullOrEmpty(tagStyleInfo.SMSTo))
                {
                    var mobiles         = tagStyleInfo.SMSTo.Split(';', ',');
                    var mobileArrayList = new ArrayList();

                    foreach (var mobile in mobiles)
                    {
                        if (!string.IsNullOrEmpty(mobile) && StringUtils.IsMobile(mobile) && !mobileArrayList.Contains(mobile))
                        {
                            mobileArrayList.Add(mobile);
                        }
                    }

                    var builder    = new StringBuilder(tagStyleInfo.SMSTitle);
                    var attributes = new NameValueCollection();
                    attributes["申请人类型"] = "公民";
                    if (TranslateUtils.ToBool(applyInfo.GetExtendedAttribute(GovPublicApplyAttribute.IsOrganization)))
                    {
                        attributes["申请人类型"] = "法人/其他组织";
                    }
                    attributes["申请时间"] = DateUtils.GetDateAndTimeString(applyInfo.AddDate);
                    foreach (string key in attributes.Keys)
                    {
                        var theValue = attributes[key];

                        builder.Append($@"{key}:{theValue},");
                    }

                    if (builder.Length > 0)
                    {
                        builder.Length = builder.Length - 1;
                    }

                    if (builder.Length > 60)
                    {
                        builder.Length = 60;
                    }

                    //var errorMessage = string.Empty;
                    //var providerInfo = BaiRongDataProvider.SmsProviderDAO.GetFirstSmsProviderInfo();
                    //if (providerInfo != null)
                    //{
                    //    SmsProviderManager.Send(providerInfo, mobileArrayList, builder.ToString(), out errorMessage);
                    //}
                }
            }
            catch
            {
                // ignored
            }
        }