/// <summary>
 /// 支付模板处理
 /// </summary>
 /// <param name="templateInfo"></param>
 private void Charge(TemplateInfo templateInfo)
 {
     if (templateInfo.IsDynamicPage)
     {
         ChargeManage manage = new ChargeManage();
         if (manage.CheckPermission())
         {
             manage.ExecuteContentCharge();
         }
         if (!string.IsNullOrEmpty(manage.ErrMsg))
         {
             string pattern = @"{PE\.Charge}(([\s\S](?!{PE\.Charge))*?){\/PE.Charge}";
             foreach (Match match in Regex.Matches(templateInfo.TemplateContent, pattern, RegexOptions.IgnoreCase))
             {
                 templateInfo.TemplateContent = templateInfo.TemplateContent.Replace(match.Value, manage.ErrMsg);
             }
         }
     }
     else if (templateInfo.PageType == 0)
     {
         ContentPermissionInfo contentPermissionInfoById = PermissionContent.GetContentPermissionInfoById(DataConverter.CLng(templateInfo.QueryList["id"]));
         if (!contentPermissionInfoById.IsNull)
         {
             if (contentPermissionInfoById.PermissionType == 0)
             {
                 if (!ContentCharge.GetContentChargeInfoById(DataConverter.CLng(templateInfo.QueryList["id"])).IsNull)
                 {
                     this.ChargeTips(templateInfo);
                 }
             }
             else
             {
                 this.ChargeTips(templateInfo);
             }
         }
     }
     templateInfo.TemplateContent = templateInfo.TemplateContent.Replace("{PE.Charge}", string.Empty).Replace("{/PE.Charge}", string.Empty);
 }
        /// <summary>
        /// 数据字段标签解析
        /// </summary>
        /// <param name="templateStr"></param>
        /// <param name="dataSourceid"></param>
        /// <param name="inode"></param>
        /// <param name="proctype"></param>
        /// <param name="templateInfo"></param>
        /// <returns></returns>
        private string FieldProc(string templateStr, string dataSourceid, XmlElement inode, int proctype, TemplateInfo templateInfo)
        {
            XmlDocument document = new XmlDocument();
            string      pattern  = @"{PE\.Field([\s\S](?!{PE))*?\/}";

            foreach (Match match in Regex.Matches(templateStr, pattern, RegexOptions.IgnoreCase))
            {
                XmlElement firstChild;
                try
                {
                    document.LoadXml(match.Value.Replace("{", "<").Replace("}", ">"));
                    firstChild = (XmlElement)document.FirstChild;
                }
                catch (XmlException exception)
                {
                    templateStr = templateStr.Replace(match.Value, "[err:数据字段标签" + match.Value.Replace("{", string.Empty).Replace("}", string.Empty) + "错,原因:" + exception.Message + "]");
                    continue;
                }
                if ((proctype == 1) || (string.Compare(dataSourceid, XmlManage.GetAttributesValue(firstChild, "id"), StringComparison.OrdinalIgnoreCase) == 0))
                {
                    if (firstChild.HasAttribute("fieldname"))
                    {
                        string xpath = string.Empty;
                        if (proctype == 1)
                        {
                            xpath = firstChild.GetAttribute("fieldname");
                        }
                        else
                        {
                            xpath = "//" + firstChild.GetAttribute("fieldname");
                        }
                        string errMsg = (inode.SelectSingleNode(xpath) == null) ? string.Empty : inode.SelectSingleNode(xpath).InnerText;
                        if (DataConverter.CBoolean(XmlManage.GetAttributesValue(firstChild, "htmldecode")))
                        {
                            errMsg = DataSecurity.HtmlDecode(errMsg);
                        }
                        if (DataConverter.CLng(XmlManage.GetAttributesValue(firstChild, "length")) > 0)
                        {
                            errMsg = StringHelper.SubString(errMsg, DataConverter.CLng(XmlManage.GetAttributesValue(firstChild, "length")), "");
                        }
                        if (DataConverter.CBoolean(XmlManage.GetAttributesValue(firstChild, "charge")))
                        {
                            if (templateInfo.IsDynamicPage)
                            {
                                ChargeManage manage = new ChargeManage();
                                if (manage.CheckPermission())
                                {
                                    manage.ExecuteContentCharge();
                                }
                                if (!string.IsNullOrEmpty(manage.ErrMsg))
                                {
                                    if (DataConverter.CBoolean(XmlManage.GetAttributesValue(firstChild, "showerr")))
                                    {
                                        errMsg = manage.ErrMsg;
                                    }
                                    else
                                    {
                                        errMsg = "";
                                    }
                                }
                            }
                            else if (templateInfo.PageType == 0)
                            {
                                if (DataConverter.CBoolean(XmlManage.GetAttributesValue(firstChild, "showerr")))
                                {
                                    ContentPermissionInfo contentPermissionInfoById = PermissionContent.GetContentPermissionInfoById(DataConverter.CLng(templateInfo.QueryList["id"]));
                                    if (!contentPermissionInfoById.IsNull)
                                    {
                                        if (contentPermissionInfoById.PermissionType == 0)
                                        {
                                            if (!ContentCharge.GetContentChargeInfoById(DataConverter.CLng(templateInfo.QueryList["id"])).IsNull)
                                            {
                                                errMsg = "$$$EasyOne.ChargeTips$$$";
                                            }
                                        }
                                        else
                                        {
                                            errMsg = "$$$EasyOne.ChargeTips$$$";
                                        }
                                    }
                                }
                                else
                                {
                                    errMsg = "";
                                }
                            }
                        }
                        if (DataConverter.CBoolean(XmlManage.GetAttributesValue(firstChild, "noprocinlabel")))
                        {
                            this.tempstr.Add(this.loopmark.ToString(), errMsg);
                            templateStr = templateStr.Replace(match.Value, "###labelmark" + this.loopmark.ToString() + "###");
                            this.loopmark++;
                        }
                        else
                        {
                            templateStr = templateStr.Replace(match.Value, errMsg);
                        }
                        continue;
                    }
                    templateStr = templateStr.Replace(match.Value, string.Empty);
                }
            }
            return(templateStr);
        }