Beispiel #1
0
 private void btnDeleteTask_Click(object sender, EventArgs e)
 {
     if (taskData.SelectedRows.Count > 0)
     {
         if (MessageBox.Show(UserMessages.ARE_YOU_SURE("Delete"), UserMessages.CONFIRMION("Delete"), MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             lastId -= taskData.SelectedRows.Count;
             if (lastId < 0)
             {
                 lastId = 1;
             }
             TaskNote task;
             bool     flag = false;
             foreach (DataGridViewRow row in taskData.SelectedRows)
             {
                 task            = (TaskNote)row.DataBoundItem;
                 undoBufferIndex = (undoBufferIndex + 1) % bufferSize;
                 flag            = taskDTO.delete(task.id);
                 Note noteTemp = NoteDTOImplementation.getInstance().getById(task.noteId);
                 flag &= noteTemp != null;
                 flag &= NoteDTOImplementation.getInstance().delete(task.noteId);
                 flag &= DocumentDTOImplementation.getInstance().delete(noteTemp.getDocumentId());
                 undoBuffer[undoBufferIndex] = task;
                 tasks.Remove(task);
                 UserMessages.messageStatus(flag);
             }
             refreshTaskData();
         }
     }
     else
     {
         MessageBox.Show(UserMessages.EMPTY_OPERATION("Delete"));
     }
 }