Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SysParameterCatalog ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Delete:
                ent = this.GetTargetData <SysParameterCatalog>();
                ent.Delete();
                this.SetMessage("删除成功!");
                break;

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

                if (idList != null && idList.Count > 0)
                {
                    if (RequestActionString == "batchdelete")
                    {
                        SysParameterCatalog.DoBatchDelete(idList.ToArray());
                    }
                }
                break;

            default:
                ents = SysParameterCatalogRule.FindAll(SearchCriterion);
                this.PageState.Add("SysParameterCatalogList", ents);
                break;
            }
        }
Exemplo n.º 2
0
        IList <string> pids = null;         // 父节点列表

        #endregion

        #region 构造函数

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            id   = RequestData.Get <string>("id", String.Empty);
            ids  = RequestData.GetList <string>("ids");
            pids = RequestData.GetList <string>("pids");

            SysParameterCatalog ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent          = this.GetMergedData <SysParameterCatalog>();
                ent.ParentID = String.IsNullOrEmpty(ent.ParentID) ? null : ent.ParentID;
                ent.Update();
                this.SetMessage("更新成功!");
                break;

            default:
                if (RequestActionString == "batchdelete")
                {
                    IList <object> idList = RequestData.GetList <object>("IdList");
                    if (idList != null && idList.Count > 0)
                    {
                        SysParameterCatalog.DoBatchDelete(idList.ToArray());
                    }
                }
                else
                {
                    // 构建查询表达式
                    SearchCriterion sc = new HqlSearchCriterion();

                    // sc.SetOrder("SortIndex");
                    sc.SetOrder("CreatedDate");

                    ICriterion crit = null;

                    if (RequestActionString == "querychildren")
                    {
                        if (ids != null && ids.Count > 0 || pids != null && pids.Count > 0)
                        {
                            if (ids != null && ids.Count > 0)
                            {
                                IEnumerable <string> distids = ids.Distinct().Where(tent => !String.IsNullOrEmpty(tent));
                                crit = Expression.In("ParameterCatalogID", distids.ToArray());
                            }

                            if (pids != null && pids.Count > 0)
                            {
                                IEnumerable <string> dispids = pids.Distinct().Where(tent => !String.IsNullOrEmpty(tent));

                                if (crit != null)
                                {
                                    crit = SearchHelper.UnionCriterions(crit, Expression.In("ParentID", dispids.ToArray()));
                                }
                                else
                                {
                                    crit = Expression.In("ParentID", dispids.ToArray());
                                }
                            }
                        }
                    }
                    else
                    {
                        crit = SearchHelper.UnionCriterions(Expression.IsNull("ParentID"),
                                                            Expression.Eq("ParentID", String.Empty));
                    }

                    if (crit != null)
                    {
                        ents = SysParameterCatalogRule.FindAll(sc, crit);
                    }
                    else
                    {
                        ents = SysParameterCatalogRule.FindAll(sc);
                    }

                    this.PageState.Add("DtList", ents);
                }

                break;
            }
        }
        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");

            SysParameterCatalog ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <SysParameterCatalog>();
                ent.Update();
                this.SetMessage("修改成功!");
                break;

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

                if (String.IsNullOrEmpty(id))
                {
                    ent.CreateAsRoot();
                }
                else
                {
                    ent.CreateAsSibling(SysParameterCatalog.Find(id));
                }

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

            default:
                if (RequestActionString == "createsub")
                {
                    ent             = this.GetPostedData <SysParameterCatalog>();
                    ent.CreaterID   = UserInfo.UserID;
                    ent.CreaterName = UserInfo.Name;

                    ent.CreateAsChild(SysParameterCatalog.Find(id));

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

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

                this.SetFormData(ent);
            }
            else
            {
                PageState.Add("CreaterName", UserInfo.Name);
                PageState.Add("CreatedDate", DateTime.Now);
            }
        }