duheng
2024-10-16 cda61a9518ac3aa246be156dfeeb814b4d3e6f67
WinFrmUI/HStation.WinFrmUI.Auth.Core/01-Role/UpdateRoleDlg.cs
@@ -9,7 +9,7 @@
using System.Threading.Tasks;
using System.Windows.Forms;
namespace HStation.WinFrmUI.Auth.Core._01_Role
namespace HStation.WinFrmUI.Auth
{
    public partial class UpdateRoleDlg : DevExpress.XtraEditors.XtraForm
    {
@@ -17,13 +17,54 @@
        {
            InitializeComponent();
        }
        string error="";
        Yw.Vmo.Role _role = new Yw.Vmo.Role();
        Yw.BLL.Role _service = new Yw.BLL.Role();
        public void IncomingData(Yw.Vmo.Role role)
        {
            error = "";
            _role = role;
            roleFrom.SetBangDingData(role, out error);
            if(!string.IsNullOrEmpty(error))
            {
                MessageBox.Show(error);
                return;
            }
        }
        //确定
        private void simpleButtonQueDing_Click(object sender, EventArgs e)
        private async void simpleButtonQueDing_Click(object sender, EventArgs e)
        {
            if (e == null)
            {
                return;
            }
            error = "";
            Yw.Vmo.Role thisrole = new Yw.Vmo.Role();
            thisrole = _role;
            var b = thisrole.UseStatus;//修改前
            thisrole = roleFrom.OperateData(out error , thisrole);
            if (!string.IsNullOrEmpty(error))
            {
                MessageBox.Show(error);
                return;
            }
            List<Yw.Vmo.Role> AllRole =await _service.GetAll();
            foreach (Yw.Vmo.Role emp in AllRole)
            {
                if (emp.Code == thisrole.Code && thisrole.Code != _role.Code)
                {
                    MessageBox.Show("编号重复!请重新输入!");
                    return;
                }
            }
            var a = thisrole.UseStatus;//修改后
            if(!await _service.Update(thisrole))
            {
                MessageBox.Show("添加失败!");
                return;
            }
            MessageBox.Show("编辑成功!");
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        //取消
@@ -33,6 +74,7 @@
            {
                return;
            }
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }