Esempio n. 1
0
        public void Test_Delete()
        {
            var eventData   = _fixture.CreateMany <byte>().ToArray();
            var partitionId = _fixture.Create <int>();
            var type        = _fixture.Create <EventType>();

            _events.Add(partitionId, TestConstants.TestAdminUserId, type, EventState.Emailing, eventData);
            var data = _events.GetNext(type, partitionId);

            _events.Delete(data.Id);

            data = _events.GetNext(type, partitionId);
            data.Should().BeNull();
        }
Esempio n. 2
0
 public void Delete(long[] ids)
 {
     using (var repo = new EventRepository())
     {
         repo.Delete(ids);
     }
 }
Esempio n. 3
0
 public void Delete(int id)
 {
     using (var repo = new EventRepository())
     {
         repo.Delete(id);
     }
 }
Esempio n. 4
0
      public ActionResult Delete(int id)
      {
          var efEvent = _eventRepository.FindBy(i => i.Id == id).SingleOrDefault();

          _eventRepository.Delete(id);
          return(RedirectToAction("ManageIndex"));
      }
Esempio n. 5
0
 public int DeleteEvent(Event eventToDelete)
 {
     using (var repo = new EventRepository())
     {
         repo.Delete(eventToDelete);
         return repo.Save();
     }
 }
 public void DeleteEvent(int eventId)
 {
     using (var uow = UnitOfWorkProvider.Create())
     {
         _eventRepository.Delete(eventId);
         uow.Commit();
     }
 }
Esempio n. 7
0
 public int DeleteEvent(Event eventToDelete)
 {
     using (var repo = new EventRepository())
     {
         repo.Delete(eventToDelete);
         return(repo.Save());
     }
 }
Esempio n. 8
0
        public void DeleteTest()
        {
            var mockContext = GetMockContext();
            var repository  = new EventRepository(mockContext.Object);
            var item        = mockContext.Object.Events.First();

            repository.Delete(item);
            Assert.Null(mockContext.Object.Events.Find(item.Id));
        }
        public ActionResult DeleteEvent(int id)
        {
            EventRepository eventRepository = RepositoryFactory.GetEventRepository();
            Event           even            = eventRepository.GetById(id);

            eventRepository.Delete(even);

            return(RedirectToAction("Index", "EventManagement"));
        }
Esempio n. 10
0
        public ActionResult Delete(int id)
        {
            var eventRepository = new EventRepository();
            var entity          = eventRepository.GetById(id);

            eventRepository.Delete(entity);

            return(RedirectToAction("Index"));
        }
Esempio n. 11
0
        public void Delete()
        {
            Planning planningOutput = _planningRepository.Create(_planningInput);
            Event    eventInput     = new Event(0, 1, planningOutput.Id, "label", "20-05-05 00:00:00", "20-05-05 00:00:00");

            Event eventOutput = _eventRepository.Create(eventInput);
            bool  isDeleted   = _eventRepository.Delete(eventOutput.Id);

            Assert.True(isDeleted);
        }
Esempio n. 12
0
 public void DeleteItem(Event item)
 {
     if (item != null)
     {
         if (_eventRepository.Exists(item))
         {
             _eventRepository.Delete(item);
         }
     }
 }
Esempio n. 13
0
        public JsonResult DeleteEvent(int eventID)
        {
            Events events = new Events();

            eventRepository.Delete(eventID);
            var status = true;

            return(new JsonResult {
                Data = new { status = status }
            });
        }
Esempio n. 14
0
        /// <summary>
        /// Permanently delete all events from the data store that are system-wide (that is, not associated with a specific gallery) and also
        /// those events belonging to the specified <paramref name="galleryId" />.
        /// </summary>
        /// <param name="galleryId">The gallery ID.</param>
        public static void ClearEventLog(int galleryId)
        {
            using (var repo = new EventRepository())
            {
                foreach (var eDto in repo.Where(e => e.FKGalleryId == galleryId || e.Gallery.IsTemplate))
                {
                    repo.Delete(eDto);
                }

                repo.Save();
            }
        }
Esempio n. 15
0
 public IActionResult DeleteEvent(int id)
 {
     try
     {
         eventRepository.Delete(id);
         return(Ok());
     }
     catch (Exception exe)
     {
         return(BadRequest(exe.Message));
     }
 }
Esempio n. 16
0
        /// <summary>
        /// Permanently delete all events from the data store that are system-wide (that is, not associated with a specific gallery) and also
        /// those events belonging to the specified <paramref name="galleryId" />.
        /// </summary>
        /// <param name="galleryId">The gallery ID.</param>
        public static void ClearEventLog(int galleryId)
        {
            using (var repo = new EventRepository())
            {
                foreach (var eDto in repo.Where(e => e.FKGalleryId == galleryId || e.Gallery.IsTemplate))
                {
                    repo.Delete(eDto);
                }

                repo.Save();
            }
        }
Esempio n. 17
0
        public ActionResult Delete(EventsDeleteViewModel model)
        {
            EventRepository repository = new EventRepository();

            if (model.Id.ToString() != String.Empty)
            {
                repository.Delete(model.Id);
            }


            return(RedirectToAction("Index"));
        }
Esempio n. 18
0
        /// <summary>
        /// Permanently remove the specified event from the data store.
        /// </summary>
        /// <param name="eventId">The value that uniquely identifies this application event (<see cref="IEvent.EventId"/>).</param>
        public static void Delete(int eventId)
        {
            using (var repo = new EventRepository())
            {
                var aeDto = repo.Find(eventId);

                if (aeDto != null)
                {
                    repo.Delete(aeDto);
                    repo.Save();
                }
            }
        }
Esempio n. 19
0
        public IHttpActionResult DeleteEvent(int id)
        {
            Event @event = repository.GetById(id);

            if (@event == null)
            {
                return(NotFound());
            }

            repository.Delete(@event);

            return(Ok(@event));
        }
Esempio n. 20
0
        /// <summary>
        /// Permanently remove the specified event from the data store.
        /// </summary>
        /// <param name="eventId">The value that uniquely identifies this application event (<see cref="IEvent.EventId"/>).</param>
        public static void Delete(int eventId)
        {
            using (var repo = new EventRepository())
            {
                var aeDto = repo.Find(eventId);

                if (aeDto != null)
                {
                    repo.Delete(aeDto);
                    repo.Save();
                }
            }
        }
Esempio n. 21
0
 public bool DeleteEvent(int EventID)
 {
     try
     {
         eventRepository.Delete(EventID);
         eventRepository.Save();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 22
0
        public IHttpActionResult Delete(int id)
        {
            EventRepository repository = new EventRepository();
            Event           _event     = repository.GetById(id);

            if (_event == null)
            {
                return(NotFound());
            }

            repository.Delete(_event);

            return(Ok());
        }
Esempio n. 23
0
        public IHttpActionResult Delete(Guid id)
        {
            try
            {
                var eventItem = _eventRepository.GetById(id);

                _eventRepository.Delete(id);
            }
            catch (Exception e)
            {
                return(InternalServerError(e));
            }

            return(Content(HttpStatusCode.NoContent, "Gebeurtenis is met succes verwijderd."));
        }
Esempio n. 24
0
        public IActionResult DeleteConfirmed(EventDTO obj)
        {
            try
            {
                bool result = _repository.Delete(obj.Id, _userManager.GetUserName(this.User));
            }
            catch (ConcurrencyException ex)
            {
                ModelState.AddModelError("", ex.Message);

                return(View(obj));
            }


            return(RedirectToAction(nameof(Index)));
        }
Esempio n. 25
0
            public void Execute(IJobExecutionContext context)
            {
                log.Info("EventPublisher is executing");

                var eventRepository = new EventRepository(_store.OpenSession());
                var events          = eventRepository.ListAll();

                // Process the new events
                Parallel.ForEach(events, Notify);

                // Delete the recevied events
                Parallel.ForEach(events, evt => { if (evt.Recevied)
                                                  {
                                                      eventRepository.Delete(evt);
                                                  }
                                 });
            }
Esempio n. 26
0
        public IHttpActionResult Delete(int id)
        {
            var headers = Request.Headers;

            if (!headers.Contains("auth_token") && !headers.Contains("fb_auth"))
            {
                return(Ok(new { errorCode = "66", message = "unauthorized" }));
            }
            if (headers.Contains("auth_token"))
            {
                var token = headers.GetValues("auth_token").First();
                if (!_authToken.VerifyToken(token))
                {
                    return(Ok(new { errorCode = "66", message = "unauthorized" }));
                }
            }
            _eventRepository.Delete(id);
            return(Ok());
        }
Esempio n. 27
0
        /// <summary>
        /// If automatic log size trimming is enabled and the log contains more items than the specified limit, delete the oldest
        /// event records. No action is taken if <paramref name="maxNumberEventItems"/> is set to zero. Return the number of
        /// items that were deleted, if any.
        /// </summary>
        /// <param name="maxNumberEventItems">The maximum number of event items that should be stored in the log. If the count exceeds
        /// this amount, the oldest items are deleted. No action is taken if <paramref name="maxNumberEventItems"/> is set to zero.</param>
        /// <returns>Returns the number of items that were deleted from the log.</returns>
        public static int ValidateLogSize(int maxNumberEventItems)
        {
            if (maxNumberEventItems == 0)
            {
                return(0);                // Auto trimming is disabled, so just return.
            }
            var events = GetAppEvents();

            var numErrors       = events.Count;
            var numErrorDeleted = 0;

            using (var repo = new EventRepository())
            {
                while (numErrors > maxNumberEventItems)
                {
                    // Find oldest event and delete it.
                    var aeDto = repo.Find(events[numErrors - 1].EventId);

                    if (aeDto != null)
                    {
                        repo.Delete(aeDto);
                    }

                    numErrors--;

                    numErrorDeleted++;
                }

                try
                {
                    repo.Save();
                }
                catch (DbUpdateConcurrencyException ex)
                {
                    // When multiple threads call this method, the 2nd thread might try to delete rows that were deleted by the
                    // first thread. This isn't a problem, but let's log it in case something else is happening that we should be alerted to.
                    RecordEvent(String.Concat("The following error occurred while trimming the event log. It can be ignored if it occurs infrequently. ", GetExceptionDetails(ex)));
                }
            }

            return(numErrorDeleted);
        }
Esempio n. 28
0
        public void Delete(Event obj)
        {
            if (null != obj.Images)
            {
                for (int i = obj.Images.Count - 1; i >= 0; i--)
                {
                    EventImage image = _imageRepository.Get(obj.Images[i].Id);
                    _imageRepository.Delete(image);

                    if (File.Exists(image.Path))
                    {
                        File.Delete(image.Path);
                    }
                }

                obj.Images.Clear();
            }

            _eventRepository.Delete(obj);
        }
Esempio n. 29
0
        public ActionResult Delete(Event ev)
        {
            try
            {
                var pictures = repoEvent.GetSet().Where(e => e.Id == ev.Id).Include(e => e.Pictures).First().Pictures;
                foreach (Picture p in pictures)
                {
                    var FilePath = Path.Combine(Server.MapPath("~/Content/media/img/") + p.FileName);
                    System.IO.File.Delete(FilePath);
                }
                Context.Pictures.RemoveRange(pictures);
                Context.SaveChanges();
                repoEvent.Delete(ev.Id);


                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View("Index"));
            }
        }
Esempio n. 30
0
        public void DeleteEventTest()
        {
            // Arrange
            HollywoodTestEntities dataContext     = new HollywoodTestEntities();
            EventRepository       eventRepository = new EventRepository(dataContext);
            Event _event = new Event()
            {
                TournamentID     = 1,
                EventName        = "Delete Event Data Access Unit Test",
                EventNumber      = 1,
                EventDateTime    = Convert.ToDateTime("2019-04-16"),
                EventEndDateTime = Convert.ToDateTime("2019-06-16"),
                AutoClose        = true,
            };

            // Act
            int  eventId   = eventRepository.Create(_event);
            bool isDeleted = eventRepository.Delete(eventId);

            // Assert
            Assert.IsTrue(isDeleted);
        }
Esempio n. 31
0
        public ActionResult DeleteConfirmed(Event ev)
        {
            try
            {
                var pictures = from p in Context.Pictures select p;

                foreach (Picture p in pictures)
                {
                    if (p.Id == ev.Id)
                    {
                        Context.Pictures.Remove(p);
                    }
                }

                repoEvent.Delete(ev.Id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View("Index"));
            }
        }
Esempio n. 32
0
        /// <summary>
        /// If automatic log size trimming is enabled and the log contains more items than the specified limit, delete the oldest
        /// event records. No action is taken if <paramref name="maxNumberEventItems"/> is set to zero. Return the number of
        /// items that were deleted, if any.
        /// </summary>
        /// <param name="maxNumberEventItems">The maximum number of event items that should be stored in the log. If the count exceeds
        /// this amount, the oldest items are deleted. No action is taken if <paramref name="maxNumberEventItems"/> is set to zero.</param>
        /// <returns>Returns the number of items that were deleted from the log.</returns>
        public static int ValidateLogSize(int maxNumberEventItems)
        {
            if (maxNumberEventItems == 0)
            {
                return(0);                // Auto trimming is disabled, so just return.
            }
            var numErrorDeleted = 0;

            lock (_sharedLock)
            {
                using (var repo = new EventRepository())
                {
                    foreach (var e in repo.All.OrderByDescending(ae => ae.EventId).Skip(maxNumberEventItems))
                    {
                        repo.Delete(e);
                        numErrorDeleted++;
                    }

                    repo.Save();
                }
            }

            return(numErrorDeleted);
        }
Esempio n. 33
0
 public void DeleteEvent(string eventId)
 {
     EventRepository.Delete(eventId);
 }
Esempio n. 34
0
        /// <summary>
        /// If automatic log size trimming is enabled and the log contains more items than the specified limit, delete the oldest 
        /// event records. No action is taken if <paramref name="maxNumberEventItems"/> is set to zero. Return the number of
        /// items that were deleted, if any.
        /// </summary>
        /// <param name="maxNumberEventItems">The maximum number of event items that should be stored in the log. If the count exceeds 
        /// this amount, the oldest items are deleted. No action is taken if <paramref name="maxNumberEventItems"/> is set to zero.</param>
        /// <returns>Returns the number of items that were deleted from the log.</returns>
        public static int ValidateLogSize(int maxNumberEventItems)
        {
            if (maxNumberEventItems == 0)
                return 0; // Auto trimming is disabled, so just return.

            var events = GetAppEvents();

            var numErrors = events.Count;
            var numErrorDeleted = 0;

            using (var repo = new EventRepository())
            {
                while (numErrors > maxNumberEventItems)
                {
                    // Find oldest event and delete it.
                    var aeDto = repo.Find(events[numErrors - 1].EventId);

                    if (aeDto != null)
                        repo.Delete(aeDto);

                    numErrors--;

                    numErrorDeleted++;
                }

                try
                {
                    repo.Save();
                }
                catch (DbUpdateConcurrencyException ex)
                {
                    // When multiple threads call this method, the 2nd thread might try to delete rows that were deleted by the
                    // first thread. This isn't a problem, but let's log it in case something else is happening that we should be alerted to.
                    RecordEvent(String.Concat("The following error occurred while trimming the event log. It can be ignored if it occurs infrequently. ", GetExceptionDetails(ex)));
                }
            }

            return numErrorDeleted;
        }