Exemplo n.º 1
0
        private void InitCharge(int generalId, bool enableCharge)
        {
            ContentPermissionInfo contentPermissionInfoById = PermissionContent.GetContentPermissionInfoById(generalId);

            if (!contentPermissionInfoById.IsNull)
            {
                this.RadlInfoPurview.SelectedValue = contentPermissionInfoById.PermissionType.ToString();
                if (!string.IsNullOrEmpty(contentPermissionInfoById.ArrGroupId))
                {
                    string[] strArray = contentPermissionInfoById.ArrGroupId.Split(new char[] { ',' });
                    for (int i = 0; i < strArray.Length; i++)
                    {
                        this.EChklUserGroupList.Items.FindByValue(strArray[i]).Selected = true;
                    }
                }
            }
            if (enableCharge)
            {
                ContentChargeInfo contentChargeInfoById = EasyOne.Contents.ContentCharge.GetContentChargeInfoById(generalId);
                if (!contentChargeInfoById.IsNull)
                {
                    this.TxtInfoPoint.Text         = contentChargeInfoById.InfoPoint.ToString();
                    this.ShowChargeType.ChargeType = contentChargeInfoById.ChargeType;
                    this.ShowChargeType.PitchTime  = contentChargeInfoById.PitchTime;
                    this.ShowChargeType.ReadTimes  = contentChargeInfoById.ReadTimes;
                    this.TxtDividePercent.Text     = contentChargeInfoById.DividePercent.ToString();
                }
            }
        }
        private void CheckPermission()
        {
            int permissionType;
            ContentPermissionInfo contentPermissionInfoById = PermissionContent.GetContentPermissionInfoById(this.m_GeneralId);

            if (contentPermissionInfoById == null)
            {
                permissionType = 0;
            }
            else
            {
                permissionType = contentPermissionInfoById.PermissionType;
            }
            switch (permissionType)
            {
            case 0:
                switch (this.m_NodeInfo.PurviewType)
                {
                case 1:
                    this.CheckIsAuthenticated();
                    return;

                case 2:
                    this.CheckIsAuthenticated();
                    if (UserPermissions.AccessCheck(OperateCode.NodeContentPreview, this.m_NodeInfo.NodeId))
                    {
                        break;
                    }
                    TemplatePage.WriteErrMsg("您没有查看该页的权限,请与网站管理员联系", "Default.aspx");
                    return;
                }
                return;

            case 1:
                this.CheckIsAuthenticated();
                return;

            case 2:
                this.CheckIsAuthenticated();
                if (!StringHelper.FoundCharInArr(contentPermissionInfoById.ArrGroupId, PEContext.Current.User.GroupId.ToString()))
                {
                    TemplatePage.WriteErrMsg("您没有查看该页的权限,请与网站管理员联系", "Default.aspx");
                }
                break;

            default:
                return;
            }
        }
Exemplo n.º 3
0
 private void CreateAllContent()
 {
     foreach (CommonModelInfo info in this.m_CommonList)
     {
         if (PermissionContent.GetContentPermissionInfoById(info.GeneralId).PermissionType > 0)
         {
             this.CreateMessage = "<li><font color='red'>ID号为:" + info.GeneralId.ToString() + "的项目因为设置了游客不能查看,所以没有生成。</font></li>" + this.CreateMessage;
         }
         else
         {
             this.CreateContentHtml(info);
         }
         this.CreateCompleted++;
     }
 }
 /// <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);
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ContentChargeInfo info4;
            int generalId = BaseUserControl.RequestInt32("GeneralID");

            this.contentDataTable = ContentManage.GetContentDataById(generalId);
            if ((this.contentDataTable == null) || (this.contentDataTable.Rows.Count == 0))
            {
                BaseUserControl.WriteErrMsg("指定的信息不存在!");
            }
            if (ModelManager.GetModelInfoById(DataConverter.CLng(this.contentDataTable.Rows[0]["ModelID"].ToString())).IsNull)
            {
                BaseUserControl.WriteErrMsg("信息隶属模型不存在!");
            }
            IList <UserGroupsInfo> userGroupList             = UserGroups.GetUserGroupList(0, 0);
            ContentPermissionInfo  contentPermissionInfoById = PermissionContent.GetContentPermissionInfoById(generalId);

            if (!contentPermissionInfoById.IsNull)
            {
                switch (contentPermissionInfoById.PermissionType)
                {
                case 0:
                    this.LitInfoPurview.Text = "继承栏目权限";
                    goto Label_0186;

                case 1:
                    this.LitInfoPurview.Text = "所有会员";
                    goto Label_0186;
                }
                this.LitInfoPurview.Text = "指定会员组:";
                if (!string.IsNullOrEmpty(contentPermissionInfoById.ArrGroupId))
                {
                    string[] strArray = contentPermissionInfoById.ArrGroupId.Split(new char[] { ',' });
                    for (int i = 0; i < strArray.Length; i++)
                    {
                        foreach (UserGroupsInfo info3 in userGroupList)
                        {
                            if (info3.GroupId == DataConverter.CLng(strArray[i]))
                            {
                                this.LitInfoPurview.Text = this.LitInfoPurview.Text + " " + info3.GroupName;
                                break;
                            }
                        }
                    }
                }
            }
Label_0186:
            info4 = EasyOne.Contents.ContentCharge.GetContentChargeInfoById(generalId);
            if (!info4.IsNull)
            {
                this.LblInfoPoint.Text = DataConverter.CLng(info4.InfoPoint).ToString();
                switch (info4.ChargeType)
                {
                case 1:
                    this.LblChargeType.Text = "距离上次收费时间" + DataConverter.CLng(info4.PitchTime).ToString() + "小时后重新收费";
                    break;

                case 2:
                    this.LblChargeType.Text = "会员重复阅读此文章" + DataConverter.CLng(info4.ReadTimes).ToString() + "次后重新收费";
                    break;

                case 3:
                    this.LblChargeType.Text = "上述两者都满足时重新收费";
                    break;

                case 4:
                    this.LblChargeType.Text = "上述两者任一个满足时就重新收费";
                    break;

                case 5:
                    this.LblChargeType.Text = "每阅读一次就重复收费一次(建议不要使用)";
                    break;

                default:
                    this.LblChargeType.Text = "不重复收费";
                    break;
                }
                this.LblDividePercent.Text = DataConverter.CLng(info4.DividePercent).ToString() + "%";
            }
        }