string code = String.Empty; // 编码

        #endregion

        #region 构造函数

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");
            code = RequestData.Get <string>("code");

            DynamicAuthCatalog dac = null; // 动态权限类型

            SearchCriterion sc = new HqlSearchCriterion();

            SearchCriterion.SetOrder("SortIndex");
            SearchCriterion.SetOrder("CreatedDate");
            SearchCriterion.AddSearch("EditStatus", "G", SearchModeEnum.Like);  // 只显示允许授权的节点

            if (type == "catalog")
            {
                if (String.IsNullOrEmpty(code) && !String.IsNullOrEmpty(id))
                {
                    dac  = DynamicAuthCatalog.Find(id);
                    code = dac.Code;
                }

                if (!String.IsNullOrEmpty(code))
                {
                    SearchCriterion.AddSearch("CatalogCode", code);
                    SearchCriterion.AddSearch("ParentID", SingleSearchModeEnum.IsNull);

                    ents = DynamicAuthRule.FindAll(SearchCriterion);

                    if (dac == null)
                    {
                        dac = DynamicAuthCatalog.FindFirst(Expression.Eq("Code", code));
                    }
                }
            }
            else if (!String.IsNullOrEmpty(id))
            {
                SearchCriterion.AddSearch("ParentID", id);

                ents = DynamicAuthRule.FindAll(SearchCriterion);

                DynamicAuth da = DynamicAuth.Find(id);
                dac = DynamicAuthCatalog.FindFirst(Expression.Eq("Code", da.CatalogCode));
            }

            this.PageState.Add("EntList", ents);

            if (!IsAsyncRequest)
            {
                if (dac != null)
                {
                    IList <DynamicPermissionCatalog> dpcs = dac.AllowGrantPermissionCatalog;
                    this.PageState.Add("PCatalogList", dpcs);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 选择操作
        /// </summary>
        private void DoSelect()
        {
            DynamicAuthCatalog dac = null; // 动态权限类型

            SearchCriterion sc = new HqlSearchCriterion();

            SearchCriterion.SetOrder("SortIndex");
            SearchCriterion.SetOrder("CreatedDate");
            SearchCriterion.AddSearch("EditStatus", "G", SearchModeEnum.Like);  // 只显示允许授权的节点

            if (type == "catalog")
            {
                if (String.IsNullOrEmpty(code) && !String.IsNullOrEmpty(id))
                {
                    dac  = DynamicAuthCatalog.Find(id);
                    code = dac.Code;
                }

                if (!String.IsNullOrEmpty(code))
                {
                    SearchCriterion.AddSearch("CatalogCode", code);
                    SearchCriterion.AddSearch("ParentID", SingleSearchModeEnum.IsNull);

                    ents = DynamicAuthRule.FindAll(SearchCriterion);

                    if (dac == null)
                    {
                        dac = DynamicAuthCatalog.FindFirst(Expression.Eq("Code", code));
                    }
                }
            }
            else if (!String.IsNullOrEmpty(id))
            {
                SearchCriterion.AddSearch("ParentID", id);

                ents = DynamicAuthRule.FindAll(SearchCriterion);

                DynamicAuth da = DynamicAuth.Find(id);
                dac = DynamicAuthCatalog.FindFirst(Expression.Eq("Code", da.CatalogCode));
            }

            this.PageState.Add("EntList", ents);

            if (!IsAsyncRequest)
            {
                if (dac != null)
                {
                    IList <DynamicPermissionCatalog> dpcs = dac.AllowGrantPermissionCatalog;
                    this.PageState.Add("PCatalogList", dpcs);

                    this.PageState.Add("AllowOperation", dac.GetAllowOperations()); // 允许的操作
                }

                this.PageState.Add("OpDivChar", DynamicOperations.DivChar); // 操作分割符
            }
        }
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            DynamicAuthCatalog ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <DynamicAuthCatalog>();
                if (!this.FormData.ContainsKey("Editable"))
                {
                    ent.Editable = false;
                }

                ent.DoUpdate();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Create:
                ent = this.GetPostedData <DynamicAuthCatalog>();

                ent.CreaterID   = UserInfo.UserID;
                ent.CreaterName = UserInfo.Name;
                ent.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <DynamicAuthCatalog>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = DynamicAuthCatalog.Find(id);
                }

                this.SetFormData(ent);
            }
        }
Beispiel #4
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            DynamicAuth ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Query:
            case RequestActionEnum.Read:
            case RequestActionEnum.Default:
                if (op == "c")
                {
                    DynamicAuthCatalog dacent = DynamicAuthCatalog.Find(id);
                    ent             = new DynamicAuth();
                    ent.CatalogCode = dacent.Code;
                }
                else
                {
                    ent = DynamicAuth.Find(id);
                }
                break;

            case RequestActionEnum.Update:
                ent = this.GetMergedData <DynamicAuth>();
                if (!this.FormData.ContainsKey("Editable"))
                {
                    ent.Editable = false;
                }
                if (!this.FormData.ContainsKey("Grantable"))
                {
                    ent.Grantable = false;
                }
                ent.DoUpdate();
                this.SetMessage("修改成功!");
                break;

            case RequestActionEnum.Create:
                ent             = this.GetPostedData <DynamicAuth>();
                ent.CreaterID   = UserInfo.UserID;
                ent.CreaterName = UserInfo.Name;

                if (this.RequestAction == RequestActionEnum.Create)
                {
                    ent.CreateAsTop(id);
                }
                else
                {
                    ent.CreateAsSub(id);
                }

                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <DynamicAuth>();
                ent.DoDelete();
                this.SetMessage("删除成功!");
                return;
            }

            this.SetFormData(ent);
        }