duheng
2024-09-26 a6c50c87d1ba3f5c8785dcc9e8ea640b5a43209f
WinFrmUI/HStation.WinFrmUI.Basic/02-SysPropManage/SetSysPropChoiceDlg.cs
@@ -1,4 +1,5 @@
using Mapster;
using Yw.DAL.Basic;
using Yw.Dto;
namespace HStation.WinFrmUI.Basic
@@ -8,6 +9,7 @@
        public SetSysPropChoiceDlg()
        {
            InitializeComponent();
            this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
        }
        private Yw.BLL.SysPropChoice _bll = null;
@@ -18,7 +20,7 @@
        public async void SetBindingData(long PropID)
        {
            _PropID=PropID;
            _PropID = PropID;
            _bll = new Yw.BLL.SysPropChoice();
            var alllist = await _bll.GetByPropID(PropID);
            _allBindingList = new List<SysPropChoiceViewModel>();
@@ -33,14 +35,24 @@
        //完成
        private async void BtnOk_Click(object sender, EventArgs e)
        {
            var AddSysPropChoices = new List<AddSysPropChoiceInput>();
            var AddSysPropChoices = new List<Yw.Vmo.SysPropChoiceVmo>();
            foreach (var item in _allBindingList)
            {
                var choiceitem = item.Adapt<SysPropChoiceViewModel, AddSysPropChoiceInput>();
                var choiceitem = item.Adapt<SysPropChoiceViewModel, Yw.Vmo.SysPropChoiceVmo>();
                choiceitem.PropID = _PropID;
                AddSysPropChoices.Add(choiceitem);
            }
            if (await _bll.Inserts(AddSysPropChoices))
            var alllist = await _bll.GetByPropID(_PropID);
            foreach (var item in alllist)
            {
                await _bll.DeleteByID(item.ID);
            }
            if (AddSysPropChoices.Count == 0)
            {
                MessageBoxHelper.ShowSuccess("设置成功!");
            }
            else if (await _bll.Inserts(AddSysPropChoices))
            {
                MessageBoxHelper.ShowSuccess("设置成功!");
            }