private void AddCharge(DataTable dataTable)
        {
            int      generalId     = DataConverter.CLng(dataTable.Select("FieldName = 'generalId'")[0]["FieldValue"].ToString());
            NodeInfo cacheNodeById = EasyOne.Contents.Nodes.GetCacheNodeById(DataConverter.CLng(dataTable.Select("FieldName = 'nodeId'")[0]["FieldValue"].ToString()));
            ContentPermissionInfo contentPermissionInfo = new ContentPermissionInfo();

            contentPermissionInfo.GeneralId      = generalId;
            contentPermissionInfo.PermissionType = 0;
            PermissionContent.Delete(generalId);
            if (PermissionContent.Add(contentPermissionInfo))
            {
                ContentCharge.Delete(generalId);
                if (cacheNodeById.Settings.DefaultItemPoint > 0)
                {
                    ContentChargeInfo contentChargeInfo = new ContentChargeInfo();
                    contentChargeInfo.GeneralId     = generalId;
                    contentChargeInfo.InfoPoint     = cacheNodeById.Settings.DefaultItemPoint;
                    contentChargeInfo.ChargeType    = cacheNodeById.Settings.DefaultItemChargeType;
                    contentChargeInfo.PitchTime     = cacheNodeById.Settings.DefaultItemPitchTime;
                    contentChargeInfo.ReadTimes     = cacheNodeById.Settings.DefaultItemReadTimes;
                    contentChargeInfo.DividePercent = cacheNodeById.Settings.DefaultItemDividePercent;
                    ContentCharge.Add(contentChargeInfo);
                }
            }
        }
 /// <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);
 }
Exemple #3
0
 protected void EgvContent_RowCommand(object sender, CommandEventArgs e)
 {
     if (e.CommandName == "DeleteContent")
     {
         int             generalId           = DataConverter.CLng(e.CommandArgument.ToString());
         CommonModelInfo commonModelInfoById = ContentManage.GetCommonModelInfoById(generalId);
         this.m_IsInput = this.CheckUserConentInputPurview(commonModelInfoById.NodeId);
         if (!this.m_IsInput)
         {
             DynamicPage.WriteUserErrMsg("<li>没有删除权限!</li>");
         }
         if (ContentManage.UpdateStatusByUserName(e.CommandArgument.ToString(), -3))
         {
             PermissionContent.Delete(generalId);
             ContentCharge.Delete(generalId);
             DynamicPage.WriteUserSuccessMsg("<li>删除成功!</li>", "ContentManage.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
         }
         else
         {
             DynamicPage.WriteUserErrMsg("<li>删除失败!</li>");
         }
     }
 }
        /// <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);
        }