lixiaojun
2024-09-20 abbe29e54421c136aa6eb4ef11935c70d818101a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
namespace HStation.WinFrmUI.Basic
{
    public partial class SetSysPropForCatalogDlg : Form
    {
        public SetSysPropForCatalogDlg()
        {
            InitializeComponent();
            this.gridView1.Columns["GroupName"].Group();
        }
 
        private List<SysPropMappingViewModel> _allBindingList = new List<SysPropMappingViewModel>();
 
        private Yw.BLL.SysPropMapping _bll = null;
 
        private long _CatlogID;
 
        public async void SetBindingData(long ID)
        {
            _CatlogID = ID;
            _bll = new Yw.BLL.SysPropMapping();
            var PropTreeList = await _bll.GetHaveLogicalTreeList(ID);
            foreach (var item in PropTreeList)
            {
                if (item.Children.Count > 0)
                {
                    foreach (var child in item.Children)
                    {
                        var model = new SysPropMappingViewModel();
                        model.GroupName = item.LogicalName;
                        model.ID = child.LogicalID;
                        model.Name = child.LogicalName;
                        model.IsHave = child.Have;
                        _allBindingList.Add(model);
                    }
                }
            }
            this.sysCatalogPropViewModelBindingSource.DataSource = _allBindingList;
            this.gridView1.ExpandAllGroups();
        }
 
        // 完成
        private async void BtnOk_Click(object sender, EventArgs e)
        {
            List<long> IdList = new List<long>();
            foreach (var item in _allBindingList)
            {
                if (item.IsHave)
                {
                    IdList.Add(item.ID);
                }
            }
            if (await _bll.Set(_CatlogID, IdList))
            {
                MessageBoxHelper.ShowSuccess("修改成功!");
            }
            else
            {
                MessageBoxHelper.ShowError("修改失败"!);
                return;
            }
            this.Close();
        }
    }
}