Example #1
0
        public void UpdateEvent_ValidEvent()
        {
            int expected = 1;

            setup();
            EventAccessor.AddEvent(eventToTest);
            eventToTest = getEventObjectID(list);

            int actual = EventAccessor.UpdateEvent(eventToTest, eventToEdit);

            EventAccessor.DeleteEventTestItem(eventToEdit);

            Assert.AreEqual(expected, actual);
        }
Example #2
0
 /// <summary>
 /// Matt Lapka
 /// Created:  2015/01/31
 /// Edit an Event object
 /// </summary>
 /// <param name="oldEvent">The Event object to be updated</param>
 /// <param name="newEvent">The Event object with the updated information</param>
 /// <returns>An enumerated result depicting success or failure</returns>
 public EventResult EditEvent(Event oldEvent, Event newEvent)
 {
     try
     {
         if (EventAccessor.UpdateEvent(oldEvent, newEvent) == 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);
     }
 }
Example #3
0
        public bool EditEvent(Event oldEvent, Event newEvent)
        {
            // update an event in the system
            bool edited  = false;
            int  oldTime = stringTimeToInt(oldEvent);
            int  newTime = stringTimeToInt(newEvent);

            try
            {
                if (1 == EventAccessor.UpdateEvent(oldEvent.EventID, oldEvent.Name, oldEvent.Description, oldEvent.Date, oldTime,
                                                   oldEvent.Location, oldEvent.MaxSeats, oldEvent.Price, oldEvent.AddedBy, oldEvent.Active,
                                                   newEvent.Name, newEvent.Description, newEvent.Date, newTime, newEvent.Location, newEvent.MaxSeats,
                                                   newEvent.Price, newEvent.AddedBy, newEvent.Active))
                {
                    edited = true;
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(edited);
        }
Example #4
0
 public void UpdateEvent_InvalidEvent()
 {
     setup();
     eventToTest.EventItemID = 9999;
     EventAccessor.UpdateEvent(eventToTest, eventToEdit);
 }