Beispiel #1
0
        /// <summary>
        /// 动态加载配置页
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="displayName">显示名称</param>
        /// <returns></returns>
        private ConfigPageData LoadTabPage(ConfigDefine config)
        {
            string tableName   = config.TableName;
            string displayName = config.TableDisplayName;

            //动态创建控件
            CheckedListBoxControl list = new CheckedListBoxControl();

            list.Dock     = System.Windows.Forms.DockStyle.Fill;
            list.Location = new System.Drawing.Point(0, 0);
            list.Name     = "list" + tableName;
            list.Size     = new System.Drawing.Size(293, 270);
            list.Font     = new Font("Courier New", 10);

            //动态创建控件
            ConfigPageData page = new ConfigPageData(tableName, list);

            page.Name = "page" + tableName;
            page.Size = new System.Drawing.Size(293, 270);
            page.Text = displayName;
            page.Controls.Add(list);

            this.xtraTabControl1.TabPages.Add(page);
            return(page);
        }
Beispiel #2
0
        /// <summary>
        /// 加载窗体列表
        /// </summary>
        /// <param name="tree"></param>
        private void LoadTreeList(TreeList tree)
        {
            DataTable modules = CommonData.GetModules();        //取系统所有模块数据
            DataTable forms   = CommonData.GetBusinessTables(); //取系统所有业务数据表

            tree.BeginUnboundLoad();
            tree.Nodes.Clear();

            //创建模块根结点
            foreach (DataRow moduleRow in modules.Rows)
            {
                ItemObject   itemModule = new ItemObject(moduleRow["ModuleName"].ToString(), moduleRow["ModuleID"]);
                TreeListNode moduleNode = tree.AppendNode(new object[] { itemModule }, null);
                moduleNode.Tag = itemModule;
                moduleNode.SelectImageIndex = 0;
                moduleNode.StateImageIndex  = 0;

                //创建模块的窗体结点
                DataRow[] rows = forms.Select("ModuleID=" + moduleRow["ModuleID"].ToString());
                foreach (DataRow detailRow in rows)
                {
                    IList        defs   = new ArrayList();
                    ConfigDefine master = new ConfigDefine(detailRow["Table1"].ToString(), detailRow["Table1Name"].ToString()); //主表
                    defs.Add(master);

                    //增加明细结点
                    for (int i = 2; i <= 5; i++)
                    {
                        if (ConvertEx.ToString(detailRow["Table" + i.ToString()]) != "")
                        {
                            string       detailName  = detailRow["Table" + i.ToString() + "Name"].ToString();
                            string       detailTable = detailRow["Table" + i.ToString()].ToString();
                            ConfigDefine detail      = new ConfigDefine(detailTable, detailName);
                            defs.Add(detail);
                        }
                    }

                    ItemObject   itemDetail = new ItemObject(detailRow["FormCaption"].ToString(), defs);
                    TreeListNode parentNode = tree.AppendNode(new object[] { detailRow["FormCaption"] }, moduleNode); //增加主表结点
                    parentNode.Tag = itemDetail;
                    parentNode.SelectImageIndex = 1;
                    parentNode.StateImageIndex  = 1;
                }
            }

            tree.EndUnboundLoad();
            tree.ExpandAll();
        }