⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userpurview.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
namespace PowerEasy.WebSite.Controls
{
    using PowerEasy.AccessManage;
    using PowerEasy.Common;
    using PowerEasy.CommonModel;
    using PowerEasy.Contents;
    using PowerEasy.Controls;
    using PowerEasy.Enumerations;
    using PowerEasy.Model.AccessManage;
    using PowerEasy.Model.CommonModel;
    using PowerEasy.Model.Contents;
    using PowerEasy.Web.UI;
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class UserPurview : BaseUserControl
    {
        private string ChkNodeInputId;
        private string ChkNodeShowId;
        private string ChkNodeSkimId;
        protected ExtendedGridView EgvNodes;
        protected ExtendedGridView EgvSpecial;
        public StringBuilder m_ArrModelTr = new StringBuilder();
        public StringBuilder m_ArrTable = new StringBuilder();
        public StringBuilder m_ArrTabs = new StringBuilder();
        public StringBuilder m_ArrTitle = new StringBuilder();
        private StringBuilder m_fieldNameList = new StringBuilder();
        private int m_GroupId;
        private int m_IdType;
        private StringBuilder m_inputNodeIdList = new StringBuilder();
        private bool m_inputSpecialAll;
        private string m_inputSpecialId;
        private StringBuilder m_inputSpecialIds = new StringBuilder();
        private StringBuilder m_modelIdList = new StringBuilder();
        private bool m_NodeInputAll;
        private bool m_NodeShowAll;
        private bool m_NodeSkimAll;
        private StringBuilder m_showNodeIdList = new StringBuilder();
        private StringBuilder m_SkimNodeIdList = new StringBuilder();
        private StringBuilder m_strMsg = new StringBuilder();
        protected ObjectDataSource OdsEgvNodes;
        protected ObjectDataSource OdsModelList;
        protected ObjectDataSource OdsSpecial;
        protected Repeater RptModelList;
        protected Repeater RptModelList2;
        protected HtmlGenericControl Tabs0;
        protected HtmlGenericControl Tabs1;
        protected HtmlGenericControl Tabs2;
        protected HtmlTableCell TabTitle0;
        protected HtmlTableCell TabTitle1;
        protected HtmlTableCell TabTitle2;

        private void AddContentFieldManagePermission()
        {
            if (!UserPermissions.AddFieldPermissions(this.m_GroupId, this.m_modelIdList.ToString(), this.m_fieldNameList.ToString(), OperateCode.ContentFieldInput, this.IdType))
            {
                this.m_strMsg.Append("<li>模型字段权限添加失败!</li>");
            }
        }

        private void AddNodesPermission()
        {
            UserPermissions.DeleteNodePermissions(this.m_GroupId, this.IdType);
            if (!UserPermissions.AddNodePermissions(this.m_GroupId, OperateCode.NodeContentInput, this.m_inputNodeIdList.ToString(), this.IdType))
            {
                this.m_strMsg.Append("<li>节点录入权限添加失败!</li>");
            }
            if (!UserPermissions.AddNodePermissions(this.m_GroupId, OperateCode.NodeContentSkim, this.m_SkimNodeIdList.ToString(), this.IdType))
            {
                this.m_strMsg.Append("<li>节点录入审核添加失败!</li>");
            }
            if (!UserPermissions.AddNodePermissions(this.m_GroupId, OperateCode.NodeContentPreview, this.m_showNodeIdList.ToString(), this.IdType))
            {
                this.m_strMsg.Append("<li>节点操作管理修改失败!</li>");
            }
        }

        private void AddSpecialInfosPermissions()
        {
            if (!UserPermissions.AddSpecialPermissions(this.m_GroupId, OperateCode.SpecialContentInput, this.m_inputSpecialIds.ToString(), this.IdType))
            {
                this.m_strMsg.Append("<li>专题信息录入权限添加失败!</li>");
            }
        }

        private static void AppendSelectId(bool isChecked, string selectId, StringBuilder roleIdList)
        {
            if (isChecked)
            {
                StringHelper.AppendString(roleIdList, selectId);
            }
        }

        protected void EgvNodes_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                NodeInfo dataItem = (NodeInfo) e.Row.DataItem;
                CheckBox box = (CheckBox) e.Row.FindControl("ChkNodeShow");
                CheckBox box2 = (CheckBox) e.Row.FindControl("ChkNodeInput");
                CheckBox box3 = (CheckBox) e.Row.FindControl("ChkNodeSkim");
                Label label = (Label) e.Row.FindControl("LabNodeShowTree");
                label.Text = Nodes.GetTreeLine(dataItem.Depth, dataItem.ParentPath, dataItem.NextId, dataItem.Child) + dataItem.NodeName + Nodes.GetNodeDir(dataItem.Child, dataItem.NodeType, dataItem.NodeDir);
                if (dataItem.NodeId == -1)
                {
                    this.ChkNodeSkimId = box3.ClientID;
                    this.ChkNodeShowId = box.ClientID;
                    this.ChkNodeInputId = box2.ClientID;
                    box3.Attributes.Add("onclick", "ChkNodeAll(this.form,'" + box3.ID + "'," + box3.ClientID + ")");
                    box.Attributes.Add("onclick", "ChkNodeAll(this.form,'" + box.ID + "'," + box.ClientID + ")");
                    box2.Attributes.Add("onclick", "ChkNodeAll(this.form,'" + box2.ID + "'," + box2.ClientID + ")");
                }
                else
                {
                    box3.Attributes.Add("onclick", "ChkWipeOffNodeAll(" + this.ChkNodeSkimId + ")");
                    box.Attributes.Add("onclick", "ChkWipeOffNodeAll(" + this.ChkNodeShowId + ")");
                    box2.Attributes.Add("onclick", "ChkWipeOffNodeAll(" + this.ChkNodeInputId + ")");
                }
            }
        }

        protected void EgvSpecial_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                SpecialTree dataItem = (SpecialTree) e.Row.DataItem;
                Label label = (Label) e.Row.FindControl("LabName");
                CheckBox box = (CheckBox) e.Row.FindControl("ChkSpecialInput");
                HiddenField field = (HiddenField) e.Row.FindControl("HdnSpecialId");
                if (dataItem != null)
                {
                    label.Text = Special.TreeLine(dataItem.TreeLineType) + dataItem.Name;
                    if (dataItem.IsSpecialCategory)
                    {
                        field.Value = "0";
                        box.Visible = false;
                    }
                    else
                    {
                        field.Value = dataItem.Id.ToString();
                    }
                    if (!dataItem.IsSpecialCategory)
                    {
                        if (dataItem.Id == -1)
                        {
                            this.m_inputSpecialId = box.ClientID;
                            box.Attributes.Add("onclick", "ChkSpecialAll(this.form,'" + box.ID + "'," + this.m_inputSpecialId + ")");
                        }
                        else
                        {
                            box.Attributes.Add("onclick", "ChkWipeOffSpecialAll(" + this.m_inputSpecialId + ")");
                        }
                        foreach (RoleSpecialPermissionsInfo info in UserPermissions.GetSpecialPermissionsBySpecialId(dataItem.Id, this.IdType))
                        {
                            if ((info.OperateCode != OperateCode.SpecialContentInput) || (info.GroupId != this.m_GroupId))
                            {
                                continue;
                            }
                            if (dataItem.Id == -1)
                            {
                                this.m_inputSpecialAll = true;
                                box.Checked = true;
                                break;
                            }
                            if (!this.m_inputSpecialAll)
                            {
                                box.Checked = true;
                            }
                        }
                    }
                }
            }
        }

        private void GetModelPermission()
        {
            foreach (RepeaterItem item in this.RptModelList2.Items)
            {
                Repeater repeater = item.FindControl("RptFieldList") as Repeater;
                HiddenField field = item.FindControl("HdnModelId") as HiddenField;
                if (repeater == null)
                {
                    return;
                }
                foreach (RepeaterItem item2 in repeater.Items)
                {
                    CheckBox box = item2.FindControl("ChkFieldPurview") as CheckBox;
                    HiddenField field2 = item2.FindControl("HdnFieldName") as HiddenField;
                    if (box.Checked)
                    {
                        StringHelper.AppendString(this.m_modelIdList, field.Value);
                        StringHelper.AppendString(this.m_fieldNameList, field2.Value);
                    }
                }
            }
            this.AddContentFieldManagePermission();
        }

        private void GetNodeSelectPermission()
        {
            string selectId = "";
            CheckBox box5 = (CheckBox) this.EgvNodes.Rows[0].FindControl("ChkNodeSkim");
            CheckBox box4 = (CheckBox) this.EgvNodes.Rows[0].FindControl("ChkNodeShow");
            CheckBox box6 = (CheckBox) this.EgvNodes.Rows[0].FindControl("ChkNodeInput");
            for (int i = 0; i < this.EgvNodes.Rows.Count; i++)
            {
                selectId = this.EgvNodes.DataKeys[i].Value.ToString();
                CheckBox box3 = (CheckBox) this.EgvNodes.Rows[i].FindControl("ChkNodeSkim");
                CheckBox box = (CheckBox) this.EgvNodes.Rows[i].FindControl("ChkNodeShow");
                CheckBox box2 = (CheckBox) this.EgvNodes.Rows[i].FindControl("ChkNodeInput");
                AppendSelectId(box3.Checked || box5.Checked, selectId, this.m_SkimNodeIdList);
                AppendSelectId(box.Checked || box4.Checked, selectId, this.m_showNodeIdList);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -