Пример #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 rpConfigItemList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            ConfigItemDAL dal = new ConfigItemDAL();

            if (e.CommandName == "Add")
            {
                if (e.Item.ItemType == ListItemType.Header)
                {
                    TextBox  txtIdentity   = e.Item.FindControl("txtIdentityAdd") as TextBox;
                    TextBox  txtValue      = e.Item.FindControl("txtValueAdd") as TextBox;
                    CheckBox chkDefaultAdd = e.Item.FindControl("chkDefaultAdd") as CheckBox;

                    if (!string.IsNullOrEmpty(txtIdentity.Text) &&
                        !string.IsNullOrEmpty(txtValue.Text) &&
                        CurrentGroupId > 0)
                    {
                        ConfigItem item = new ConfigItem()
                        {
                            ConfigGroup_Id   = CurrentGroupId,
                            ConfigItem_Key   = txtIdentity.Text,
                            ConfigItem_Value = txtValue.Text,
                            IsDefault        = chkDefaultAdd.Checked
                        };
                        dal.AddConfigItem(item);
                        dal.Save();
                        ConfigItemDAL itemDAL = new ConfigItemDAL();
                        Utility.BindDataToRepeater(rpConfigItemList, itemDAL.GetConfigByGroup(CurrentGroupId));
                    }
                }
            }
            if (e.CommandName == "Save")
            {
                HiddenField hdId        = e.Item.FindControl("hdId") as HiddenField;
                TextBox     txtIdentity = e.Item.FindControl("txtIdentity") as TextBox;
                TextBox     txtValue    = e.Item.FindControl("txtValue") as TextBox;
                CheckBox    chkDefault  = e.Item.FindControl("chkDefault") as CheckBox;

                var item = dal.GetConfigItemById(int.Parse(hdId.Value));
                item.ConfigItem_Key   = txtIdentity.Text;
                item.ConfigItem_Value = txtValue.Text;
                item.IsDefault        = chkDefault.Checked;
                dal.Save();
            }
            if (e.CommandName == "Delete")
            {
                HiddenField hdId = e.Item.FindControl("hdId") as HiddenField;

                dal.Delete(int.Parse(hdId.Value));
            }
            Utility.BindDataToRepeater(rpConfigItemList, dal.GetConfigByGroup(CurrentGroupId));
        }
Пример #3
0
        public static List <ConfigItem> GetLookupList(string name)
        {
            ConfigItemDAL dal = new ConfigItemDAL();

            return(dal.GetConfigByGroup(name));
        }
Пример #4
0
        public static List <ConfigItem> GetLookupList(int groupId)
        {
            ConfigItemDAL dal = new ConfigItemDAL();

            return(dal.GetConfigByGroup(groupId));
        }