示例#1
0
        public void DeleteEvent_InvalidEvent()
        {
            int expected = 1;

            setup();
            eventToEdit.EventItemID = 9999;
            int actual = EventAccessor.DeleteEventItem(eventToEdit);

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void DeleteEvent_ValidEvent()
        {
            int expected = 1;

            setup();
            EventAccessor.AddEvent(eventToTest);
            eventToTest = getEventObjectID(list);
            int actual = EventAccessor.DeleteEventItem(eventToTest);

            EventAccessor.DeleteEventTestItem(eventToTest);
            Assert.AreEqual(expected, actual);
        }
示例#3
0
 /// <summary>
 /// Matt Lapka
 /// Created:  2015/01/31
 /// "Delete" a single Event object (make inactive)
 /// </summary>
 /// <param name="eventToDelete">The Event object to be deleted/made inactive</param>
 /// <returns>An enumerated result depicting success or fail</returns>
 public EventResult ArchiveAnEvent(Event eventToDelete)
 {
     try
     {
         if (EventAccessor.DeleteEventItem(eventToDelete) == 1)
         {
             //update cache
             DataCache._currentEventList = EventAccessor.GetEventList();
             DataCache._EventListTime    = DateTime.Now;
             return(EventResult.Success);
         }
         return(EventResult.NotChanged);
     }
     catch (ApplicationException ex)
     {
         return(ex.Message == "Concurrency Violation" ? EventResult.ChangedByOtherUser : EventResult.DatabaseError);
     }
     catch (Exception)
     {
         return(EventResult.DatabaseError);
     }
 }