private void btnDeleteAll_All_Click(object sender, EventArgs e) { if (dgvAll.Rows.Count > 0) { bool bHasToDo = false; if (dgvAll.Rows[0].Cells[5].Value.ToString() == "未处理") { bHasToDo = true; } if (bHasToDo && MessageHandle.MessageAsk("注意:有日程事务还没执行!\n确定要删除所有日程事务?", "确定删除") == DialogResult.OK) { BusAdminDaily.DeleteDailyOfAll(); if (_dailyEntity != null) { foreach (DataGridViewRow dataRow in dgvAll.Rows) { if (_dailyEntity.ID == dataRow.Cells[0].Value.ToString()) { ClearForm(); _dailyEntity = null; break; } } } _dsAll.Tables[0].Rows.Clear(); MessageHandle.MessageInfo("恭喜,删除成功!", "提示信息"); } else if (!bHasToDo && MessageHandle.MessageAsk("确定要删除所有日程事务?", "确定删除") == DialogResult.OK) { BusAdminDaily.DeleteDidDailyOfAll(); if (_dailyEntity != null) { foreach (DataGridViewRow dataRow in dgvAll.Rows) { if (_dailyEntity.ID == dataRow.Cells[0].Value.ToString()) { ClearForm(); _dailyEntity = null; break; } } } _dsAll.Tables[0].Rows.Clear(); MessageHandle.MessageInfo("恭喜,删除成功!", "提示信息"); } } }
private void btnClearAll_Click(object sender, EventArgs e) { if (dgvAll.Rows.Count > 0) { if (MessageHandle.MessageAsk("确定要删除所有已处理日程事务?", "确定删除") == DialogResult.OK) { BusAdminDaily.DeleteDidDailyOfAll(); if (_dailyEntity != null) { foreach (DataGridViewRow dataRow in dgvAll.Rows) { if (_dailyEntity.ID == dataRow.Cells[0].Value.ToString()) { ClearForm(); _dailyEntity = null; break; } } } _dsAll.Tables[0].DefaultView.RowFilter = "D_REMIND_FLAG='未处理'"; MessageHandle.MessageInfo("恭喜,清空成功!", "提示信息"); } } }