|
@@ -1,6 +1,7 @@
|
|
|
using DW5S.Entity;
|
|
|
using DW5S.Repostory;
|
|
|
using DW5S.ViewModel;
|
|
|
+using DxHelper;
|
|
|
using ExtensionsDev;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
@@ -16,6 +17,7 @@ namespace DW5S.App.EditForms
|
|
|
{
|
|
|
public AdCardViewModel info;
|
|
|
public List<AdChannelViewModel> AdChItems = new List<AdChannelViewModel>();
|
|
|
+ public List<AdChannelViewModel> DeleteChItems = new List<AdChannelViewModel>();
|
|
|
private List<AdCardViewModel> infos;
|
|
|
public StationEditor()
|
|
|
{
|
|
@@ -101,10 +103,10 @@ namespace DW5S.App.EditForms
|
|
|
{
|
|
|
if (e.Column.FieldName == nameof(AdChannelViewModel.ChNum))
|
|
|
{
|
|
|
- var AdChannel = gvChannelList.GetSelectRow<AdChannelViewModel>().FirstOrDefault();
|
|
|
- if (AdChItems.Count(i => i.ChNum == AdChannel.ChNum) > 1)
|
|
|
+ var ChNum = (int)e.Value;
|
|
|
+ if (AdChItems.Count(i => i.ChNum == ChNum) > 1)
|
|
|
{
|
|
|
- DxHelper.MsgBoxHelper.ShowError($"采集通道[{AdChannel.ChNum}]已经存在!");
|
|
|
+ DxHelper.MsgBoxHelper.ShowError($"采集通道[{ChNum}]已经存在!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -234,7 +236,7 @@ namespace DW5S.App.EditForms
|
|
|
this.DialogResult = DialogResult.Cancel;
|
|
|
}
|
|
|
|
|
|
- private async void GroupChannel_CustomButtonClick(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e)
|
|
|
+ private void GroupChannel_CustomButtonClick(object sender, DevExpress.XtraBars.Docking2010.BaseButtonEventArgs e)
|
|
|
{
|
|
|
string caption = e.Button.Properties.Caption;
|
|
|
switch (caption)
|
|
@@ -246,12 +248,11 @@ namespace DW5S.App.EditForms
|
|
|
case "删除":
|
|
|
try
|
|
|
{
|
|
|
- var deletes = gvChannelList.DeleteSelectedRows<AdChannelViewModel>();
|
|
|
- var unitOfWork = IocContainer.UnitOfWork;
|
|
|
- var repsCh = unitOfWork.Of<AdChannel>();
|
|
|
- await repsCh.DeleteAsync(deletes.To<List<AdChannel>>());
|
|
|
- await unitOfWork.SaveAsync();
|
|
|
-
|
|
|
+ if (MsgBoxHelper.ShowConfirm("确定删除选中的采集通道吗?"))
|
|
|
+ {
|
|
|
+ var deletes = gvChannelList.DeleteSelectedRows<AdChannelViewModel>();
|
|
|
+ DeleteChItems.AddRange(deletes);
|
|
|
+ }
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|