duheng
2024-08-14 60665fe5913db357ea37f9f52a64b6ac0ce21911
WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/03-mgr/XhsProjectMgrPage.cs
@@ -1,4 +1,5 @@
using DevExpress.Utils;
using DevExpress.CodeParser;
using DevExpress.Utils;
using HStation.WinFrmUI.Xhs;
namespace HStation.WinFrmUI
@@ -131,7 +132,7 @@
        private void barBtnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var dlg = new AddProjectDlg();
            dlg.ReloadDataEvent += async (rhs) =>
            dlg.ReloadDataEvent += async (rhs, mapinfo) =>
            {
                var bll = new BLL.XhsProjectExtensions();
                var id = await bll.Insert(rhs);
@@ -141,6 +142,16 @@
                    var vmo = await _bll.GetByID(id);
                    _allProjectList.Add(new XhsProjectMgrViewModel(vmo));
                    this.xhsProjectMgrViewModelBindingSource.ResetBindings(false);
                    if (mapinfo != null)
                    {
                        mapinfo.ObjectID = id;
                        mapinfo.ObjectName = rhs.Name;
                        var mapinfoid = await new Yw.BLL.MapInfo().Insert(mapinfo);
                        if (mapinfoid < 0)
                        {
                            TipFormHelper.ShowError("地图信息添加错误");
                        }
                    }
                    return true;
                }
                return false;
@@ -154,12 +165,22 @@
            var currentVm = this.GetCurrentViewModel();
            var dlg = new EditProjectDlg();
            dlg.SetBindingData(currentVm.ID);
            dlg.ReloadDataEvent += async (rhs) =>
            dlg.ReloadDataEvent += async (rhs, mapinfo) =>
            {
                if (await _bll.Update(rhs))
                {
                    currentVm.Reset(rhs);
                    this.xhsProjectMgrViewModelBindingSource.ResetBindings(false);
                    if (mapinfo != null)
                    {
                        //  mapinfo.ObjectID = id;
                        mapinfo.ObjectName = rhs.Name;
                        var bol = await new Yw.BLL.MapInfo().Update(mapinfo);
                        if (!bol)
                        {
                            TipFormHelper.ShowError("地图信息添加错误");
                        }
                    }
                    return true;
                }
                return false;
@@ -183,15 +204,20 @@
            {
                _allProjectList.Remove(currentVm);
                this.xhsProjectMgrViewModelBindingSource.ResetBindings(false);
                MessageBoxHelper.ShowSuccess($"删除成功!");
                TipFormHelper.ShowSucceed("删除成功!");
            }
            else
            {
                MessageBoxHelper.ShowError($"删除失败!");
                TipFormHelper.ShowSucceed("删除失败!");
                return;
            }
        }
        //详细信息
        private void barBtnInfo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
        }
        #endregion 基础操作
    }
}