private void DeleteTestLimitConfig() { if (this.gridSpec.RowCount < 1) { MessageBox.Show("没有可以清除的数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (MessageBox.Show("是否确认清除当前所有数据?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) != DialogResult.OK) { return; } List <MesService.TestStandSpecHistory> testStandSpecs = new List <MesService.TestStandSpecHistory>(); foreach (GridViewRowInfo rowInfo in this.gridSpec.Rows) { MesService.TestStandSpecHistory specHistory = new MesService.TestStandSpecHistory(); specHistory.ProductTypeNo = rowInfo.Cells[1].Value.ToString(); specHistory.StationName = rowInfo.Cells[2].Value.ToString(); specHistory.TestItem = rowInfo.Cells[3].Value.ToString(); specHistory.LimitValue = rowInfo.Cells[4].Value.ToString(); specHistory.TeamLeader = rowInfo.Cells[5].Value.ToString(); specHistory.Admin = rowInfo.Cells[6].Value.ToString(); specHistory.UpdateDate = rowInfo.Cells[7].Value.ToString(); testStandSpecs.Add(specHistory); } var returnRes = serviceClient.DeleteTestLimitConfig(testStandSpecs.ToArray()); if (returnRes > 0) { RefreshUI(); MessageBox.Show($"已清除{returnRes}条数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } MessageBox.Show("未删除任何数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); }