public override void DeleteButtonClick() { List <SubjectDto> list_subject = new List <SubjectDto>(); List <ShopDto> list_shop = new List <ShopDto>(); for (int i = 0; i < grvSubject.RowCount; i++) { if (grvSubject.GetRowCellValue(i, "CheckMarkSelection") != null && grvSubject.GetRowCellValue(i, "CheckMarkSelection").ToString() == "True") { list_subject.Add(grvSubject.GetRow(i) as SubjectDto); } } for (int i = 0; i < grvShop.RowCount; i++) { if (grvShop.GetRowCellValue(i, "CheckMarkSelection") != null && grvShop.GetRowCellValue(i, "CheckMarkSelection").ToString() == "True") { list_shop.Add(grvShop.GetRow(i) as ShopDto); } } if (list_subject.Count == 0) { CommonHandler.ShowMessage(MessageType.Information, "没有选择任何执行文件"); return; } if (list_shop.Count == 0) { CommonHandler.ShowMessage(MessageType.Information, "没有选择任何经销商"); return; } if (CommonHandler.ShowMessage(MessageType.Confirm, "确定要删除吗?") == DialogResult.Yes) { foreach (ShopDto shop in list_shop) { if (checkBox1.Checked) { service.AnswerStartInfoDelete(CommonHandler.GetComboBoxSelectedValue(cboProject).ToString(), shop.ShopCode); } foreach (SubjectDto subject in list_subject) { service.DeleteAnserForError(CommonHandler.GetComboBoxSelectedValue(cboProject).ToString(), shop.ShopCode, subject.SubjectCode); } } CommonHandler.ShowMessage(MessageType.Information, "删除成功"); } }