Пример #1
0
        public void BindTreeView()
        {
            trvConfig.Nodes.Clear();
            TreeNode root = new TreeNode()
            {
                Text = "系统基本信息"
            };

            trvConfig.Nodes.Add(root);

            ConfigDAL dal       = new ConfigDAL();
            var       allConfig = dal.GetAllConfigGroup();

            foreach (var item in allConfig)
            {
                root.ChildNodes.Add(new TreeNode()
                {
                    Text = item.ConfigGroup_Name, Value = item.ConfigGroup_Id.ToString()
                });
            }
            trvConfig.ExpandAll();

            if (CurrentGroupId > 0 && !string.IsNullOrEmpty(CurrentGroupName))
            {
                ConfigItemDAL itemDAL = new ConfigItemDAL();
                Utility.BindDataToRepeater(rpConfigItemList, itemDAL.GetConfigByGroup(CurrentGroupId));
            }
        }
Пример #2
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtGroupName.Text))
     {
         ConfigDAL dal = new ConfigDAL();
         if (!dal.GetAllConfigGroup().Exists(c => c.ConfigGroup_Name == txtGroupName.Text))
         {
             dal.AddConfigGroup(new ConfigGroup()
             {
                 ConfigGroup_Name = txtGroupName.Text
             });
             dal.Save();
         }
         BindTreeView();
     }
 }