Example #1
0
        public void SetExpired()
        {
            List <ToDoListItem> _list = _toDoListItemRepository.GetMany(a => a.deadline < DateTime.Now).ToList();

            foreach (ToDoListItem _ in _list)
            {
                _.status = "Expired";

                _toDoListItemRepository.Delete(_.ToDoListItemId);

                _toDoListItemRepository.Save();

                _toDoListItemRepository.Insert(_);

                _toDoListItemRepository.Save();
            }
        }
Example #2
0
 private void BtnItemDelete_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ToDoListItem toDoListItem = (ToDoListItem)dtgToDoListItems.SelectedItem;
         if (toDoListItem == null)
         {
             MessageBox.Show("Please select one item!");
         }
         else
         {
             if ((MessageBox.Show("Are you sure?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes))
             {
                 _toDoListItemRepository.Delete(toDoListItem);
                 GetDataGridItems();
                 MessageBox.Show("Item deleted!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }