private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { string command = "delete from futuretasks " + "where id = @ids"; List <int> ids = JournalTask.GetAllFutureTasksId(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); } OnFutureTaskSave(); }
private void dataGrid_content_CellContentClick(object sender, DataGridViewCellEventArgs e) { selectedId = JournalTask.ContentClickHandler(dataGrid_content, e); if (e.ColumnIndex == 1) { string command = "update futuretasks " + "set " + "iscompleted = @iscompleted, " + "datecompleted = @completeddate " + "where id = @id"; List <int> ids = JournalTask.GetAllFutureTasksId(selectedId); for (int i = 0; i < ids.Count; i++) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int) { Value = ids[i] }, new SqlParameter("@iscompleted", SqlDbType.Bit) { Value = true }, new SqlParameter("@completeddate", SqlDbType.DateTime) { Value = DateTime.Now } }; db.GenericNonQueryAction(command, parameter); } OnFutureTaskSave(); } }
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(); } }