Exemple #1
0
        protected override object[] LoadDataSource(int inclusive, int exclusive)
        {
            if (facade == null)
            {
                facade = new SystemSettingFacadeFactory(base.DataProvider).Create();
            }
            // 查询所有模块
            object[] objs = facade.GetModuleWithViewValueVisibility(this.GetQueryParameterModuleParent());

            ArrayList listMdl = new ArrayList();

            if (objs != null)
            {
                // 查询用户组具有的权限
                object[] objsSelected = facade.GetSelectedModuleWithViewValueByFunctionGroupCode(
                    FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtFunctionGroupCodeQuery.Text)),
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    this.GetQueryParameterModuleParent());              //this.GetRequestParam("expand")
                Hashtable htSelected = new Hashtable();
                if (objsSelected != null)
                {
                    for (int i = 0; i < objsSelected.Length; i++)
                    {
                        ModuleWithViewValue module = (ModuleWithViewValue)objsSelected[i];
                        htSelected.Add(module.ModuleCode, module);
                    }
                }

                // 搜索每个模块的子模块
                Hashtable htMdlChild = new Hashtable();
                for (int i = 0; i < objs.Length; i++)
                {
                    Module    module    = (Module)objs[i];
                    ArrayList listChild = new ArrayList();
                    if (htMdlChild.ContainsKey(module.ParentModuleCode) == true)
                    {
                        listChild = (ArrayList)htMdlChild[module.ParentModuleCode];
                    }
                    else
                    {
                        htMdlChild.Add(module.ParentModuleCode, listChild);
                    }
                    listChild.Add(module);
                }
                // 查询具有子模块的模块代码
                object[]  objsParent = facade.GetModuleWithChild();
                Hashtable htParent   = new Hashtable();
                for (int i = 0; i < objsParent.Length; i++)
                {
                    htParent.Add(((Module)objsParent[i]).ModuleCode, ((Module)objsParent[i]).ModuleCode);
                }
                // 添加树型结构
                listMdl.AddRange(GetChildrenModule(objs, string.Empty, 1, htMdlChild));
                // 根据模块层级增加Grid列
                AdjustGridColumnByLevel(moduleMaxLevel);
                if (securityFacade == null)
                {
                    securityFacade = new SystemSettingFacadeFactory(base.DataProvider).CreateSecurityFacade();
                }
                // 增加行
                for (int i = 0; i < listMdl.Count; i++)
                {
                    object[] objMdl = (object[])listMdl[i];
                    this.AppendRow((Module)objMdl[1], Convert.ToInt32(objMdl[0]), htParent, htSelected);
                }
                // 保存选中项
                SaveModuleRightWhenPost();
                // 调整展开/收缩图标
                AdjustExpandCollact(listMdl, htParent);
            }
            return(null);
        }