private void deleteToolStripMenuItem_Click(object sender, System.EventArgs e) { string command = "delete from notes " + "where id = @ids"; List <int> ids = JournalTask.GetAllNoteId(selectedId); for (int i = 0; i < ids.Count; i++) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@ids", SqlDbType.Int) { Value = ids[i] } }; db.GenericNonQueryAction(command, parameter); } OnNotesSaved(); }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { if (entryType == JournalTask.EntryType.daily) { string command = "delete from currenttasks " + "where id = @ids"; List <int> ids = JournalTask.GetAllCurrentTasksId(taskId); for (int i = 0; i < ids.Count; i++) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@ids", SqlDbType.Int) { Value = ids[i] } }; db.GenericNonQueryAction(command, parameter); } RefreshGrid(); } if (entryType == JournalTask.EntryType.monthly) { string command = "delete from monthlytasks " + "where id = @ids"; List <int> ids = JournalTask.GetAllMonthlyTasksId(taskId); for (int i = 0; i < ids.Count; i++) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@ids", SqlDbType.Int) { Value = ids[i] } }; db.GenericNonQueryAction(command, parameter); } RefreshGrid(); } if (entryType == JournalTask.EntryType.future) { string command = "delete from futuretasks " + "where id = @ids"; List <int> ids = JournalTask.GetAllFutureTasksId(taskId); for (int i = 0; i < ids.Count; i++) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@ids", SqlDbType.Int) { Value = ids[i] } }; db.GenericNonQueryAction(command, parameter); } RefreshGrid(); } if (entryType == JournalTask.EntryType.notes) { string command = "delete from notes " + "where id = @ids"; List <int> ids = JournalTask.GetAllNoteId(taskId); for (int i = 0; i < ids.Count; i++) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@ids", SqlDbType.Int) { Value = ids[i] } }; db.GenericNonQueryAction(command, parameter); } RefreshGrid(); } }