using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors; using DevExpress.XtraGrid.Views.Grid; using UAS_DeviceMonitor.Entity; namespace UAS_DeviceMonitor.CustomerControl.Button { public partial class ButtonDeleteRow : SimpleButton { private AutoDataGridControl.AutoDataGridControl grid; public AutoDataGridControl.AutoDataGridControl Grid { get { return grid; } set { grid = value; } } public ButtonDeleteRow() { InitializeComponent(); } private void ButtonDeleteRow_Click(object sender, EventArgs e) { if (grid != null) { GridView view = grid.MainView as GridView; int[] DeleteID = view.GetSelectedRows(); for (int i = 0; i < DeleteID.Length; i++) { DeleteID[i] = int.Parse(view.GetRowCellValue(i, grid.ID.ToUpper()).ToString()); } if (DeleteID.Length > 0) { DialogResult result = XtraMessageBox.Show("确认删除", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result.ToString() == "Yes") { SystemInf.dh.DeleteDataByID(grid.TableName, grid.ID, DeleteID); grid.RefreshData(); } } else XtraMessageBox.Show("请选择要删除的数据", "提示"); } } } }