From 1c30ee4068eb5dba3c6b9a4987b98034f2a622d0 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期一, 13 一月 2025 10:49:47 +0800 Subject: [PATCH] 登录界面修改 --- WinFrmUI/HStation.WinFrmUI.Auth.Core/01-Role/RoleMainMgrPanel.cs | 99 +++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 82 insertions(+), 17 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Auth.Core/01-Role/RoleMainMgrPanel.cs b/WinFrmUI/HStation.WinFrmUI.Auth.Core/01-Role/RoleMainMgrPanel.cs index c7d14c7..7d2a461 100644 --- a/WinFrmUI/HStation.WinFrmUI.Auth.Core/01-Role/RoleMainMgrPanel.cs +++ b/WinFrmUI/HStation.WinFrmUI.Auth.Core/01-Role/RoleMainMgrPanel.cs @@ -1,39 +1,104 @@ -锘縰sing DevExpress.XtraEditors; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using Yw.WinFrmUI; +锘縰sing Yw.WinFrmUI; -namespace HStation.WinFrmUI.Auth.Core._01_Role +namespace HStation.WinFrmUI.Auth { - public partial class RoleMainMgrPanel : DocumentPage - { + public partial class RoleMainMgrPanel : DocumentPage + { public RoleMainMgrPanel() { InitializeComponent(); + GetData(); } + string error; + List<Yw.Vmo.Role> RoleData = new List<Yw.Vmo.Role>(); + Yw.BLL.Role _service = new Yw.BLL.Role(); + public async void GetData() + { + this.gridControl.DataSource = null; + var DataList = await _service.GetAll(); + RoleData.Clear(); + foreach (var Data in DataList) + { + RoleData.Add(Data); + } + this.gridControl.DataSource = RoleData; + + //showRoleList.SetCorprationName(RoleData); + //Yw.BLL.Role.ReferenceEquals + //var Datalist = await Yw.BLLFactory<string>.Instance.GetAll(); + } + //娣诲姞瑙掕壊 private void RoleAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var dlg = new AddRoleDlg(); - dlg.ShowDialog(); + if (dlg.ShowDialog() != DialogResult.OK) + { + return; + } + GetData(); } //淇敼瑙掕壊 private void RoleEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var dlg = new UpdateRoleDlg(); - dlg.ShowDialog(); + var SelectData = this.gridView1.GetCurrentViewModel(RoleData); + if (SelectData == null) + { + MessageBox.Show("璇烽�夋嫨鏁版嵁琛岋紒"); + return; + } + dlg.IncomingData(SelectData); + if (dlg.ShowDialog() != DialogResult.OK) + { + return; + } + GetData(); } //鍒犻櫎瑙掕壊 - private void RoleDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) + private async void RoleDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { + var SelectData = this.gridView1.GetCurrentViewModel(RoleData); + if (SelectData == null) + { + MessageBox.Show("璇烽�夋嫨鏁版嵁琛岋紒"); + return; + } + var result = MessageBox.Show("纭畾鍒犻櫎杩欎釜瑙掕壊鍚楋紵", "纭鎿嶄綔", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); + if (result == DialogResult.OK) + { + if (!await _service.DeleteByID(SelectData.ID)) + { + MessageBox.Show("鍒犻櫎澶辫触锛�"); + return; + } + RoleData.Remove(SelectData); + this.gridControl.DataSource = null; + this.gridControl.DataSource = RoleData; + MessageBox.Show("鍒犻櫎鎴愬姛锛�"); + } + + + } + + private void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) + { + if (e.Column == colUseStatus) + { + var role = e.Row as Yw.Vmo.Role; + if (role == null) + { + return; + } + e.Value = role.UseStatus == Yw.Vmo.eUseStatus.Disable ? "绂佺敤" : "鍚敤"; + } + } + + private void showRoleList_Click(object sender, EventArgs e) + { + error = ""; + showRoleList.GetCorprationName(out error); } } } -- Gitblit v1.9.3