duheng
2025-03-28 b266e82b9a377fa35a766f7a3a2f5aa95f3c9125
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
namespace HStation.WinFrmUI.Basic
{
    public partial class UpdateCatalogParentDlg : DevExpress.XtraEditors.XtraForm
    {
        public UpdateCatalogParentDlg()
        {
            InitializeComponent();
        }
 
        public async void SetBindingData(long TypeId, long vmId, long currentParentId)
        {
            var alllist = await new Yw.BLL.SysCatalog().GetByTypeID(TypeId);
            alllist.Remove(alllist.Find(x => x.ID == vmId));
            treeListLookUpEdit1TreeList.DataSource = alllist;
            this.ComboBoxEditParentsChoice.EditValue = currentParentId;
        }
 
        public event Func<long, Task<bool>> ReloadEvent;
 
        //完成
        private async void BtnOk_Click(object sender, EventArgs e)
        {
            if (ComboBoxEditParentsChoice.EditValue == null)
            {
                TipFormHelper.ShowWarn("请选择正确的父级!");
                return;
            }
            if (long.TryParse(ComboBoxEditParentsChoice.EditValue.ToString(), out long ParentId))
            {
                if (await ReloadEvent.Invoke(ParentId))
                {
                    MessageBoxHelper.ShowSuccess("修改成功!");
                }
                else
                {
                    MessageBoxHelper.ShowError("修改失败!");
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
 
        private void simpleLabelItemDelete_Click(object sender, EventArgs e)
        {
            this.ComboBoxEditParentsChoice.EditValue = null;
        }
    }
}