示例#1
0
        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");
            code = RequestData.Get <string>("code");

            if (IsAsyncRequest)
            {
                DynamicAuth ent = null;

                switch (this.RequestAction)
                {
                case RequestActionEnum.Read:
                case RequestActionEnum.Query:
                case RequestActionEnum.Default:
                    if (SearchCriterion.Orders.Count <= 0)
                    {
                        SearchCriterion.SetOrder("SortIndex");
                        SearchCriterion.SetOrder("CreatedDate");
                    }

                    SearchCriterion.AddSearch("CatalogCode", code);
                    SearchCriterion.AddSearch("EditStatus", SingleSearchModeEnum.IsNotNull);
                    SearchCriterion.AddSearch("EditStatus", "", SearchModeEnum.NotEqual);

                    if (String.IsNullOrEmpty(id))
                    {
                        SearchCriterion.AddSearch("ParentID", SingleSearchModeEnum.IsNull);
                    }
                    else
                    {
                        SearchCriterion.AddSearch("ParentID", id);
                    }

                    ents = DynamicAuthRule.FindAll(SearchCriterion);
                    break;

                case RequestActionEnum.Delete:
                    ent = DynamicAuth.Find(id);
                    ent.DoDelete();
                    this.SetMessage("删除成功!");
                    break;
                }

                this.PageState.Add("EntList", ents);
            }
            else
            {
                SearchCriterion sc = new HqlSearchCriterion();
                sc.SetOrder("SortIndex");
                sc.SetOrder("CreatedDate");
                DynamicAuthCatalog[] entCatalogs = DynamicAuthCatalogRule.FindAll(sc);

                this.PageState.Add("EntCatalogList", entCatalogs);
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (SearchCriterion.Orders.Count <= 0)
            {
                SearchCriterion.SetOrder("SortIndex");
                SearchCriterion.SetOrder("CreatedDate");
            }

            ents = DynamicAuthCatalogRule.FindAll(SearchCriterion);

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

            DynamicAuthCatalog ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Create:
                ent = this.GetPostedData <DynamicAuthCatalog>();
                ent.DoCreate();
                this.SetMessage("新建成功!");
                break;

            case RequestActionEnum.Update:
                ent = this.GetMergedData <DynamicAuthCatalog>();
                ent.DoUpdate();
                this.SetMessage("保存成功!");
                break;

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

            case RequestActionEnum.Custom:
                IList <object> idList = RequestData.GetList <object>("IdList");

                if (idList != null && idList.Count > 0)
                {
                    if (RequestActionString == "batchdelete")
                    {
                        DynamicAuthCatalogRule.BatchRemoveByPrimaryKeys(idList);
                    }
                }
                break;
            }
        }