示例#1
0
        protected void EBtnBatchDelete_Click(object sender, EventArgs e)
        {
            this.PermissionDetection();
            StringBuilder selectList = this.EgvContent.SelectList;

            if (selectList.Length == 0)
            {
                AdminPage.WriteErrMsg("<li>对不起,您还没选择要删除的项目!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&ListType=", this.HdnListType.Value }));
            }
            else if (ContentManage.UpdateStatus(selectList.ToString(), -3))
            {
                PermissionContent.Delete(selectList.ToString());
                EasyOne.Contents.ContentCharge.Delete(selectList.ToString());
                SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
                if (SiteConfig.SmsConfig.IsAutoSendStateMessage)
                {
                    AdminPage.WriteSuccessMsg("<li>删除成功!</li><br /> " + this.ChangeStateSendMessageToUser(-3), string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&ListType=", this.HdnListType.Value }));
                }
                else
                {
                    AdminPage.WriteSuccessMsg("<li>删除成功!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&ListType=", this.HdnListType.Value }));
                }
            }
            else
            {
                AdminPage.WriteErrMsg("<li>删除项目失败!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&ListType=", this.HdnListType.Value }));
            }
        }
        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 int AddPermissionAndCharge(DataTable dataTable, bool enableCharge)
        {
            int generalId = GetGeneralId(dataTable);
            ContentPermissionInfo contentPermissionInfo = new ContentPermissionInfo();

            contentPermissionInfo.GeneralId      = generalId;
            contentPermissionInfo.PermissionType = DataConverter.CLng(this.RadlInfoPurview.SelectedValue);
            contentPermissionInfo.ArrGroupId     = this.EChklUserGroupList.SelectList();
            int num2 = DataConverter.CLng(this.TxtInfoPoint.Text);

            PermissionContent.Delete(generalId);
            if (PermissionContent.Add(contentPermissionInfo))
            {
                EasyOne.Contents.ContentCharge.Delete(generalId);
                if (enableCharge && (num2 > 0))
                {
                    ContentChargeInfo contentChargeInfo = new ContentChargeInfo();
                    contentChargeInfo.GeneralId     = generalId;
                    contentChargeInfo.InfoPoint     = num2;
                    contentChargeInfo.ChargeType    = this.ShowChargeType.ChargeType;
                    contentChargeInfo.PitchTime     = this.ShowChargeType.PitchTime;
                    contentChargeInfo.ReadTimes     = this.ShowChargeType.ReadTimes;
                    contentChargeInfo.DividePercent = DataConverter.CLng(this.TxtDividePercent.Text);
                    EasyOne.Contents.ContentCharge.Add(contentChargeInfo);
                }
            }
            return(num2);
        }
        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);
                }
            }
        }
 public Role_PermissionContentDTO(PermissionContent PermissionContent)
 {
     this.Id = PermissionContent.Id;
     this.PermissionOperatorId = PermissionContent.PermissionOperatorId;
     this.PermissionId         = PermissionContent.PermissionId;
     this.FieldId            = PermissionContent.FieldId;
     this.Value              = PermissionContent.Value;
     this.Field              = PermissionContent.Field == null ? null : new Role_FieldDTO(PermissionContent.Field);
     this.PermissionOperator = PermissionContent.PermissionOperator == null ? null : new Role_PermissionOperatorDTO(PermissionContent.PermissionOperator);
     this.Errors             = PermissionContent.Errors;
 }
        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;
            }
        }
示例#7
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++;
     }
 }
 protected void EgvContentSignin_RowCommand(object sender, CommandEventArgs e)
 {
     if (e.CommandName == "DeleteContent")
     {
         int generalId = DataConverter.CLng(e.CommandArgument.ToString());
         if (ContentManage.UpdateStatus(generalId, -3))
         {
             PermissionContent.Delete(generalId);
             EasyOne.Contents.ContentCharge.Delete(generalId);
             AdminPage.WriteSuccessMsg("<li>删除成功!</li>", "ContentSignin.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
         }
         else
         {
             AdminPage.WriteErrMsg("<li>删除失败!</li>");
         }
     }
 }
示例#9
0
        protected void EBtnBatchDelete_Click(object sender, EventArgs e)
        {
            this.PermissionDetection(this.m_isManage);
            StringBuilder selectList = this.EgvContent.SelectList;

            if (selectList.Length == 0)
            {
                AdminPage.WriteErrMsg("<li>对不起,您还没选择要删除的项目!</li>", "ContentManage.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
            }
            else if (ContentManage.UpdateStatus(selectList.ToString(), -3))
            {
                PermissionContent.Delete(selectList.ToString());
                EasyOne.Contents.ContentCharge.Delete(selectList.ToString());
                SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
                AdminPage.WriteSuccessMsg("<li>删除成功!</li>", "ContentManage.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
            }
            else
            {
                AdminPage.WriteErrMsg("<li>删除项目失败!</li>", "ContentManage.aspx?NodeID=" + BasePage.RequestInt32("NodeID"));
            }
        }
 private void UpdatePurview(int batchType, StringBuilder itemId)
 {
     if (this.GetCheckItem()["InfoPurview"])
     {
         ContentPermissionInfo contentPermissionInfo = new ContentPermissionInfo();
         contentPermissionInfo.PermissionType = DataConverter.CLng(this.RadlInfoPurview.SelectedValue);
         StringBuilder sb = new StringBuilder("");
         for (int i = 0; i < this.EChklUserGroupList.Items.Count; i++)
         {
             if (this.EChklUserGroupList.Items[i].Selected)
             {
                 StringHelper.AppendString(sb, this.EChklUserGroupList.Items[i].Value);
             }
         }
         contentPermissionInfo.ArrGroupId = sb.ToString();
         if (!PermissionContent.BatchUpdate(contentPermissionInfo, itemId.ToString(), this.GetCheckItem(), batchType))
         {
             AdminPage.WriteErrMsg("批量设置收费权限失败!");
         }
     }
 }
 /// <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);
 }
示例#12
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>");
         }
     }
 }
示例#13
0
        protected void EgvContent_RowCommand(object sender, CommandEventArgs e)
        {
            int    generalId   = DataConverter.CLng(e.CommandArgument.ToString());
            string commandName = e.CommandName;

            if (commandName != null)
            {
                if (!(commandName == "CancelArchiving"))
                {
                    if (!(commandName == "DeleteContent"))
                    {
                        return;
                    }
                }
                else
                {
                    if (ContentManage.UpdateStatus(generalId, 0))
                    {
                        AdminPage.WriteSuccessMsg("<li>取消归档成功!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&Status=102&ListType=", this.HdnListType.Value }));
                        return;
                    }
                    AdminPage.WriteErrMsg("<li>取消归档失败!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&Status=102&ListType=", this.HdnListType.Value }));
                    return;
                }
                if (ContentManage.UpdateStatus(generalId, -3))
                {
                    PermissionContent.Delete(generalId);
                    EasyOne.Contents.ContentCharge.Delete(generalId);
                    SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
                    AdminPage.WriteSuccessMsg("<li>删除成功!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&Status=102&ListType=", this.HdnListType.Value }));
                }
                else
                {
                    AdminPage.WriteErrMsg("<li>删除失败!</li>", string.Concat(new object[] { "ContentArchivingManage.aspx?NodeID=", BasePage.RequestInt32("NodeID"), "&Status=102&ListType=", this.HdnListType.Value }));
                }
            }
        }
示例#14
0
        public async Task <bool> ValidatePermissionContent(Permission Permission)
        {
            if (Permission.PermissionContents != null)
            {
                List <Field> Fields = await UOW.FieldRepository.List(new FieldFilter
                {
                    Selects = FieldSelect.ALL,
                    Skip    = 0,
                    Take    = int.MaxValue
                });

                List <PermissionOperator> PermissionOperators = await UOW.PermissionOperatorRepository.List(new PermissionOperatorFilter
                {
                    Skip = 0,
                    Take = int.MaxValue,
                });

                foreach (PermissionContent PermissionContent in Permission.PermissionContents)
                {
                    Field Field = Fields.Where(f => f.Id == PermissionContent.FieldId).FirstOrDefault();
                    if (Field == null)
                    {
                        PermissionContent.AddError(nameof(PermissionValidator), nameof(PermissionContent.Field), ErrorCode.FieldNotExisted);
                    }
                    else
                    {
                        PermissionOperator PermissionOperator = PermissionOperators
                                                                .Where(po => po.FieldTypeId == Field.FieldTypeId && po.Id == PermissionContent.PermissionOperatorId).FirstOrDefault();
                        if (PermissionOperator == null)
                        {
                            PermissionContent.AddError(nameof(PermissionValidator), nameof(PermissionContent.PermissionOperator), ErrorCode.PermissionOperatorNotExisted);
                        }
                    }
                }
            }
            return(Permission.IsValidated);
        }
        /// <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);
        }
示例#16
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() + "%";
            }
        }