From 3fa53a1e9e6e320ecdf15c7a633b0c4a1ad41c34 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期六, 01 三月 2025 18:58:43 +0800 Subject: [PATCH] 修改个人中心界面,修复报表报错 --- WinFrmUI/HStation.WinFrmUI.Auth.Core/06-user-info/PersonalCenterDlg.cs | 212 +++++++++++++++++++++++++++------------------------- 1 files changed, 109 insertions(+), 103 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Auth.Core/06-user-info/PersonalCenterDlg.cs b/WinFrmUI/HStation.WinFrmUI.Auth.Core/06-user-info/PersonalCenterDlg.cs index 5fbf0e6..8d5be77 100644 --- a/WinFrmUI/HStation.WinFrmUI.Auth.Core/06-user-info/PersonalCenterDlg.cs +++ b/WinFrmUI/HStation.WinFrmUI.Auth.Core/06-user-info/PersonalCenterDlg.cs @@ -13,26 +13,36 @@ { InitializeComponent(); this.Load += PersonalCenterDlg_Load; - this.gridView1.SetNormalView(20); - this.gridView2.SetNormalView(20); + this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; } private const string _smsTemplate = "hzkw_sms_template";//鎵嬫満鍙风櫥褰曟ā鏉� private const string _vxTemplate = "hzkw_wx_template";//寰俊鐧诲綍妯℃澘 private const string _software = "HStation_XHS_DESKTOP";//杞欢缂栫爜 - private List<PhoneData> _phoneNuberBinding; - private List<WxData> _WxBinding; + private long _wxId; + private long _phoneId; //鍒濆鍖� - private void PersonalCenterDlg_Load(object? sender, EventArgs e) + private async void PersonalCenterDlg_Load(object? sender, EventArgs e) { this.txtEditUserName.Text = GlobalParas._GlobalParas.LoginName; this.txtEditAdminType.Text = GlobalParas._GlobalParas.AdminType; this.txtAccountName.Text = GlobalParas._GlobalParas.AccountName; this.textAccountType.Text = GlobalParas._GlobalParas.LoginType; - phoneInitialize(); - wxInitialize(); + + var allPhones = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.GetSmsByUserID(GlobalParas._GlobalParas.UserID); + var allWeChat = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.GetWechatByUserID(GlobalParas._GlobalParas.UserID); + if (allPhones!=null&&allPhones.Any()) + { + _phoneId = allPhones.First().ID; + this.buttonEditPhone.EditValue = allPhones.First().Credential; + } + if (allWeChat!=null&&allWeChat.Any()) + { + _wxId = allWeChat.First().ID; + this.buttonEditWeChat.EditValue = allWeChat.First().Credential; + } } public class PhoneData @@ -45,44 +55,6 @@ { public long ID { get; set; } public string Wxid { get; set; } - } - - //鎵嬫満鍙峰垵濮嬪寲 - private async void phoneInitialize() - { - _phoneNuberBinding = new List<PhoneData>(); - var allPhones = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.GetSmsByUserID(GlobalParas._GlobalParas.UserID); - if (allPhones != null) - { - foreach (var item in allPhones) - { - _phoneNuberBinding.Add(new PhoneData - { - Phone = item.Credential, - ID = item.ID - }); - } - } - this.gridControl1.DataSource = _phoneNuberBinding; - } - - //寰俊缁戝畾鍒濆鍖� - private async void wxInitialize() - { - _WxBinding = new List<WxData>(); - var allPhones = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.GetWechatByUserID(GlobalParas._GlobalParas.UserID); - if (allPhones != null) - { - foreach (var item in allPhones) - { - _WxBinding.Add(new WxData - { - Wxid = item.Credential, - ID = item.ID - }); - } - } - this.gridControl2.DataSource = _WxBinding; } //淇敼瀵嗙爜 @@ -208,81 +180,115 @@ } } - //娣诲姞鎵嬫満鍙� - private void btnAddPhone_Click(object sender, EventArgs e) - { - var dlg = new AddPhoneNumberDlg(); - dlg.ReloadDataEvent += async (phoneNumber) => - { - var id = await PhoneBinding(phoneNumber); - if (id > 0) + /* + //娣诲姞鎵嬫満鍙� + private void btnAddPhone_Click(object sender, EventArgs e) { - _phoneNuberBinding.Add(new PhoneData { Phone = phoneNumber, ID = id }); - this.gridControl1.RefreshDataSource(); - } - }; - dlg.ShowDialog(); - } + var dlg = new AddPhoneNumberDlg(); + dlg.ReloadDataEvent += async (phoneNumber) => + { + var id = await PhoneBinding(phoneNumber); + if (id > 0) + { + _phoneNuberBinding.Add(new PhoneData { Phone = phoneNumber, ID = id }); + this.gridControl1.RefreshDataSource(); + } + }; + dlg.ShowDialog(); + }*/ - //鎵嬫満鍙峰崟鍏冩牸鐐瑰嚮浜嬩欢 - private async void gridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) + /* //娣诲姞寰俊 + private void btnAddWx_Click(object sender, EventArgs e) + { + var dlg = new WechatBindingDlg(); + dlg.SetBindingData(); + dlg.CodeReloadData += async (code) => + { + var id = await WechatBinding(code); + if (id > 0) + { + _WxBinding.Add(new WxData { Wxid = code, ID = id }); + this.gridControl2.RefreshDataSource(); + } + }; + dlg.ShowDialog(); + }*/ + + private async void buttonEditPhone_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { - var vm = this.gridView1.GetCurrentViewModel(_phoneNuberBinding); - if (vm == null) + if (e.Button.Tag.ToString() == "import") { - return; - } - if (e.Column == this.colDel) - { - var bol = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.DeleteByID(vm.ID); - if (!bol) + if (this.buttonEditPhone.EditValue != null) { - TipFormHelper.ShowError("鍒犻櫎澶辫触锛�"); + TipFormHelper.ShowWarn("宸插瓨鍦ㄦ墜鏈哄彿"); return; } - TipFormHelper.ShowSucceed("鍒犻櫎鎴愬姛锛�"); - _phoneNuberBinding.Remove(vm); - this.gridControl1.RefreshDataSource(); + var dlg = new AddPhoneNumberDlg(); + dlg.ReloadDataEvent += async (phoneNumber) => + { + var id = await PhoneBinding(phoneNumber); + if (id > 0) + { + _phoneId = id; + this.buttonEditPhone.EditValue = phoneNumber; + } + }; + dlg.ShowDialog(); + } + else if (e.Button.Tag.ToString() == "delete") + { + if (_phoneId > 0) + { + var bol = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.DeleteByID(_phoneId); + if (!bol) + { + TipFormHelper.ShowError("鍒犻櫎澶辫触锛�"); + return; + } + TipFormHelper.ShowSucceed("鍒犻櫎鎴愬姛锛�"); + _phoneId = default; + this.buttonEditPhone.EditValue = null; + } } } - //寰俊鍗曞厓鏍肩偣鍑讳簨浠� - private async void gridView2_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) + private async void buttonEditWeChat_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { - var vm = this.gridView2.GetCurrentViewModel(_WxBinding); - if (vm == null) + if (e.Button.Tag.ToString() == "import") { - return; - } - if (e.Column == this.colWxDel) - { - var bol = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.DeleteByID(vm.ID); - if (!bol) + if (this.buttonEditWeChat.EditValue != null) { - TipFormHelper.ShowError("鍒犻櫎澶辫触锛�"); + TipFormHelper.ShowWarn("宸插瓨鍦ㄥ井淇�"); return; } - TipFormHelper.ShowSucceed("鍒犻櫎鎴愬姛锛�"); - _WxBinding.Remove(vm); - this.gridControl2.RefreshDataSource(); - } - } - - //娣诲姞寰俊 - private void btnAddWx_Click(object sender, EventArgs e) - { - var dlg = new WechatBindingDlg(); - dlg.SetBindingData(); - dlg.CodeReloadData += async (code) => - { - var id = await WechatBinding(code); - if (id > 0) + var dlg = new WechatBindingDlg(); + dlg.SetBindingData(); + dlg.CodeReloadData += async (code) => { - _WxBinding.Add(new WxData { Wxid = code, ID = id }); - this.gridControl2.RefreshDataSource(); + var id = await WechatBinding(code); + if (id > 0) + { + _wxId = id; + this.buttonEditWeChat.EditValue = id; + } + }; + dlg.ShowDialog(); + } + else if (e.Button.Tag.ToString() == "delete") + { + if (_wxId > 0) + { + var bol = await BLLFactory<Yw.BLL.UserLoginAccount>.Instance.DeleteByID(_wxId); + if (!bol) + { + TipFormHelper.ShowError("鍒犻櫎澶辫触锛�"); + return; + } + TipFormHelper.ShowSucceed("鍒犻櫎鎴愬姛锛�"); + _wxId = default; + this.buttonEditWeChat.EditValue = null; } - }; - dlg.ShowDialog(); + } } } } \ No newline at end of file -- Gitblit v1.9.3