duheng
2025-02-19 ad8f813f5eddd66740b4e09801e4ea02ddf70a4a
WinFrmUI/HStation.WinFrmUI.Auth.Core/01-menu/AddMenuDlg.cs
@@ -1,4 +1,5 @@
using DevExpress.XtraEditors;
using DevExpress.DocumentServices.ServiceModel.DataContracts;
using DevExpress.XtraEditors;
using System;
using System.Windows.Forms;
using Yw.WinFrmUI;
@@ -16,22 +17,20 @@
            InitializeComponent();
        }
        public event Func<Yw.Vmo.ProjectMenu, Task<bool>> ReloadDataEvent;
        public event Func<Yw.Vmo.AddProjectMenuExVmo, Task<bool>> ReloadDataEvent;
        private Yw.Vmo.ProjectMenu _model = null;
        private Yw.Vmo.ProjectMenuVmo _model = null;
        /// <summary>
        /// 添加
        /// </summary>
        public async void SetBindingData(long parentId)
        {
            _model = new Yw.Vmo.ProjectMenu();
            var allList = await new Yw.BLL.ProjectMenu().GetByProjectID(GlobalParas._GlobalParas.ProjectID);
            this.treeListLookUpEdit1TreeList.DataSource = allList;
            this.imageComboBoxMenuType.Properties.AddEnum(typeof(eMenuType));
            this.imageComboBoxMenuType.SelectedIndex = 0;
            this.ComboBoxEditParentsChoice.EditValue = parentId;
            _model.ProjectID = GlobalParas._GlobalParas.ProjectID;
        }
        //验证
@@ -56,12 +55,15 @@
        {
            if (!Valid())
                return;
            _model.Name = this.NameTextEdit.Text.Trim();
            _model.Description = this.DescriptionMemoEdit.Text.Trim();
            _model.ParentID = this.ComboBoxEditParentsChoice.EditValue == null ? 0 : Convert.ToInt64(this.ComboBoxEditParentsChoice.EditValue);
            _model.Type = (int)(eMenuType)this.imageComboBoxMenuType.EditValue;
            _model.Permission = this.TxtEditPermission.Text.Trim();
            if (await this.ReloadDataEvent.Invoke(_model))
            var AddProject = new Yw.Vmo.AddProjectMenuExVmo();
            AddProject.Name = this.NameTextEdit.Text.Trim();
            AddProject.Description = this.DescriptionMemoEdit.Text.Trim();
            AddProject.ParentID = this.ComboBoxEditParentsChoice.EditValue == null ? 0 : Convert.ToInt64(this.ComboBoxEditParentsChoice.EditValue);
            AddProject.Type = (int)(eMenuType)this.imageComboBoxMenuType.EditValue;
            AddProject.Permission = this.TxtEditPermission.Text.Trim();
            AddProject.ProjectID = GlobalParas._GlobalParas.ProjectID;
            AddProject.SoftwareIds = new List<long> { GlobalParas._GlobalParas.SoftwareID };
            if (await this.ReloadDataEvent.Invoke(AddProject))
            {
                TipFormHelper.ShowSucceed("添加成功!!");
            }
@@ -72,5 +74,10 @@
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        private void simpleLabelDelete_Click(object sender, EventArgs e)
        {
            this.ComboBoxEditParentsChoice.EditValue = null;
        }
    }
}