/// <summary>
        /// Justin Pennington
        /// Created:  2015/02/14
        /// Adds a new event item in the database, using an event object that is passed in
        /// </summary>
        /// <param name="newEvent">The Event object to be added</param>
        /// <returns>number of rows updated in db</returns>
        public static int AddEvent(Event newEvent)
        {
            //Connect To Database
            var conn = DatabaseConnection.GetDatabaseConnection();
            var cmdText = "spInsertEventItem";
            var cmd = new SqlCommand(cmdText, conn);
            var rowsAffected = 0;
            cmd.CommandType = CommandType.StoredProcedure;

            //Set up Parameters For the Stored Procedure
            cmd.Parameters.AddWithValue("@EventItemName", newEvent.EventItemName);
            cmd.Parameters.AddWithValue("@EventTypeID", newEvent.EventTypeID);
            cmd.Parameters.AddWithValue("@EventOnsite", newEvent.OnSite);
            cmd.Parameters.AddWithValue("@Transportation", newEvent.Transportation);
            cmd.Parameters.AddWithValue("@EventDescription", newEvent.Description);

            try
            {
                conn.Open();
                rowsAffected = cmd.ExecuteNonQuery();
                if (rowsAffected == 0)
                {
                    throw new ApplicationException("Concurrency Violation");
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }
            return rowsAffected;
        }
        /// <summary>
        /// Justin Pennington
        /// Created:  2015/02/14
        /// Changes the event from active to inactive
        /// </summary>
        /// <param name="eventToBeDeleted">The Event to be set inactive</param>
        /// <returns>returns number of rows affected</returns>
        public static int DeleteEventItem(Event eventToBeDeleted)
        {
            var conn = DatabaseConnection.GetDatabaseConnection();
            var cmdText = "spDeleteEventItem";
            var cmd = new SqlCommand(cmdText, conn);
            var rowsAffected = 0;

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@EventItemName", eventToBeDeleted.EventItemName);
            cmd.Parameters.AddWithValue("@EventItemID", eventToBeDeleted.EventItemID);
            cmd.Parameters.AddWithValue("@EventTypeID", eventToBeDeleted.EventTypeID);
            cmd.Parameters.AddWithValue("@Transportation", eventToBeDeleted.Transportation);
            cmd.Parameters.AddWithValue("@EventDescription", eventToBeDeleted.Description);
            cmd.Parameters.AddWithValue("@EventOnsite", eventToBeDeleted.OnSite);
            try
            {
                conn.Open();
                rowsAffected = cmd.ExecuteNonQuery();
                if (rowsAffected == 0)
                {
                    throw new ApplicationException("Concurrency Violation");
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }
            return rowsAffected;  // needs to be rows affected
        }
        //creates a new event item in the database, using an event object that is passed in
        public static int addEvent(Event newEvent)
        {
            var conn = DatabaseConnection.GetDBConnection();
            string query = "INSERT INTO EventItem (EventItemName, EventStartTime, EventEndTime, MaxNumberOfGuests," +
            "CurrentNumberOfGuests, EventTypeID, PricePerPerson, EventOnsite, Transportation, EventDescription, Active) " +
                                 "VALUES(@EventItemName, EventStartTime, EventEndTime, MaxNumberOfGuests, CurrentNumberOfGuests, EventTypeID" +
                                 ", PricePerPerson, EventOnsite, Transportation, EventDescription, Active)";
            var cmd = new SqlCommand(query, conn);

            cmd.Parameters.AddWithValue("@EventItemName", newEvent.EventItemName);
            cmd.Parameters.AddWithValue("@EventStartTime", newEvent.EventStartDate);
            cmd.Parameters.AddWithValue("@EventEndTime", newEvent.EventEndDate);
            cmd.Parameters.AddWithValue("@MaxNumberOfGuests", newEvent.MaxNumGuests);
            cmd.Parameters.AddWithValue("@EventTypeID", newEvent.EventTypeID);
            cmd.Parameters.AddWithValue("@PricePerPerson", newEvent.PricePerPerson);
            cmd.Parameters.AddWithValue("@EventOnsite", newEvent.OnSite);
            cmd.Parameters.AddWithValue("@Transportation", newEvent.Transportation);
            cmd.Parameters.AddWithValue("@EventDescription", newEvent.Description);
            cmd.Parameters.AddWithValue("@Active", newEvent.Active);

            try
            {
                conn.Open();
                return cmd.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }
        }
 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);
 }
        /// <summary>
        /// Matt Lapka
        /// Created: 2015/04/12
        /// Sends event update information to BLL and validates data
        /// </summary>
        /// <param name="eventItemID">event ID to update</param>
        public void UpdateEvent(int eventItemID)
        {
            int errorCount = 0;
            try
            {
                Event myEvent = _listedEvents
                .Where(ev => ev.EventItemID == eventItemID).FirstOrDefault();

                Event newEvent = new Event(myEvent.EventItemID, myEvent.EventItemName, myEvent.Transportation, myEvent.EventTypeID, myEvent.OnSite, myEvent.ProductID, myEvent.Description, myEvent.Active);

                if (String.Format("{0}", Request.Form["name"]).Trim().ValidateAlphaNumeric(1, 255))
                {
                    newEvent.EventItemName = String.Format("{0}", Request.Form["name"]).Trim();
                }
                else
                {
                    errorCount++;
                    showError("You must enter a valid Event Name!");
                    return;
                }
                //Created programatically so don't need to be validated
                newEvent.EventTypeID = int.Parse(Request.Form["type"]);
                newEvent.Transportation = bool.Parse(Request.Form["transport"]);
                newEvent.OnSite = bool.Parse(Request.Form["onsite"]);
                if (String.Format("{0}", Request.Form["description"]).Trim().ValidateCompanyName(1, 255))
                {
                    newEvent.Description = String.Format("{0}", Request.Form["description"]).Trim();
                }
                else
                {
                    errorCount++;
                    showError("You must enter a valid Description!" + String.Format("{0}", Request.Form["description"]).Trim());
                    return;
                }

                lblError.Text = "";
                EventManager.EventResult result;
                if (myEvent != null)
                {
                    result = _myManager.EditEvent(myEvent, newEvent);
                    return;
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Event Updating Event: " + ex.Message;
                Page.ClientScript.RegisterStartupScript(this.GetType(), "showit", "showMessage()", true);
            }
        }
        /// <summary>
        /// Hunter Lind
        /// Created:  2015/2/23
        /// Fills out our form with information from NewEvent.
        /// Also saves an Unrevised version of NewEvent.
        /// </summary>
        /// <param name="eventToEdit">The Event we are going to edit</param>
        /// <param name="readOnly">Make the form ReadOnly.</param>
        /// <exception cref="WanderingTurtleException">Occurrs making components readonly</exception>
        public AddEditEvent(Event eventToEdit, bool readOnly = false)
        {
            OriginalEvent = eventToEdit;

            _eventToSubmit.Active = eventToEdit.Active;
            _eventToSubmit.Description = eventToEdit.Description;
            _eventToSubmit.EventTypeID = eventToEdit.EventTypeID;
            _eventToSubmit.OnSite = eventToEdit.OnSite;
            _eventToSubmit.Transportation = eventToEdit.Transportation;
            _eventToSubmit.EventItemName = eventToEdit.EventItemName;
            _eventToSubmit.EventItemID = eventToEdit.EventItemID;

            Setup();

            Title = "Editing Event: " + OriginalEvent.EventItemName;

            if (readOnly) { (Content as Panel).MakeReadOnly(BtnCancel); }
        }
 /// <summary>
 /// Matt Lapka
 /// Created: 2015/01/31
 /// Add a single Event object
 /// </summary>
 /// <param name="newEvent">The Event object to be added to the database</param>
 /// <returns>An enumerated result depicting success or failure</returns>
 public EventResult AddNewEvent(Event newEvent)
 {
     try
     {
         if (EventAccessor.AddEvent(newEvent) == 1)
         {
             //refresh cache
             DataCache._currentEventList = EventAccessor.GetEventList();
             DataCache._EventListTime = DateTime.Now;
             return EventResult.Success;
         }
         return EventResult.NotAdded;
     }
     catch (ApplicationException ex)
     {
         return ex.Message == "Concurrency Violation" ? EventResult.ChangedByOtherUser : EventResult.DatabaseError;
     }
     catch (Exception)
     {
         return EventResult.DatabaseError;
     }
 }
        //requires: Event object, Boolean value for active/inactive
        //returns number of rows affected
        public static int deleteEvent(Event newEvent)
        {
            var conn = DatabaseConnection.GetDBConnection();
            var cmdText = "spDeleteEvent";
            var cmd = new SqlCommand(cmdText, conn);
            var rowsAffected = 0;

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@Active", 0);

            cmd.Parameters.AddWithValue("@original_EventItemName", newEvent.EventItemName);
            cmd.Parameters.AddWithValue("@original_EventID", newEvent.EventItemID);
            cmd.Parameters.AddWithValue("@original_EventStartTime", newEvent.EventStartDate);
            cmd.Parameters.AddWithValue("@original_EventEndTime", newEvent.EventEndDate);
            cmd.Parameters.AddWithValue("@original_MaxNumberOfGuests", newEvent.MaxNumGuests);
            cmd.Parameters.AddWithValue("@original_PricePerPerson", newEvent.PricePerPerson);
            cmd.Parameters.AddWithValue("@original_Transportation", newEvent.Transportation);
            cmd.Parameters.AddWithValue("@original_EventDescription", newEvent.Description);
            cmd.Parameters.AddWithValue("@original_Active", newEvent.Active);
            try
            {
                conn.Open();
                rowsAffected = cmd.ExecuteNonQuery();
                if (rowsAffected == 0)
                {
                    throw new ApplicationException("Concurrency Violation");
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }
            return rowsAffected;  // needs to be rows affected
        }
        /// <summary>
        /// Justin Pennington 
        /// Created:  2015/02/14
        /// Retrieve data for an Event, create an object using data with retrieved data, and return the object that is created
        /// </summary>
        /// <remarks>
        /// Bryan Hurst
        /// Updated: 2015/04/24
        /// 
        /// Added while loop and CommandType.StoredProcedure setting
        /// </remarks>
        /// <param name="eventID">The EventID matching the Event to be retrieved</param>
        /// <returns>The Event requested via the EventID</returns>
        public static Event GetEvent(string eventID)
        {
            var theEvent = new Event();
            // set up the database call
            var conn = DatabaseConnection.GetDatabaseConnection();
            string cmdText = "spSelectEventItem";
            var cmd = new SqlCommand(cmdText, conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@EventItemID", eventID);
            try
            {
                conn.Open();
                var reader = cmd.ExecuteReader();
                if (reader.HasRows == true)
                {
                    while (reader.Read())
                    {
                        theEvent.EventItemID = reader.GetInt32(0);
                        theEvent.EventItemName = reader.GetString(1);
                        theEvent.EventTypeID = reader.GetInt32(2);
                        theEvent.OnSite = reader.GetBoolean(3);
                        theEvent.Transportation = reader.GetBoolean(4);
                        theEvent.Description = reader.GetString(5);
                        theEvent.Active = reader.GetBoolean(6);
                    }

                }
                else
                {
                    var ax = new ApplicationException("Data not found!");
                    throw ax;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }
            return theEvent;
        }
        /// <summary>
        /// Matt Lapka
        /// Created: 2015/03/26
        /// Sends event information to BLL and validates data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmitEvent_Click(object sender, EventArgs e)
        {
            bool stop = false;
            int errorCount = 0;
            //validate!
            if (!txtEventName.Text.ValidateAlphaNumeric(1))
            {
                txtEventName.ToolTip = "You must enter a valid event name!";
                txtEventName.BorderColor = Color.Red;
                stop = true;
                errorCount++;
            }
            if (comboEventTypeList.SelectedIndex < 1)
            {
                comboEventTypeList.ToolTip = "You must select an event type!";
                comboEventTypeList.BorderColor = Color.Red;
                stop = true;
                errorCount++;
            }
            if (String.IsNullOrEmpty(txtDescription.Text))
            {
                txtDescription.ToolTip = "Please enter a brief description";
                txtDescription.BorderColor = Color.Red;
                stop = true;
                errorCount++;
            }
            if (radOnSite.SelectedIndex < 0)
            {
                radOnSite.ToolTip = "Please select if this will be an on site event.";
                radOnSite.BorderColor = Color.Red;
                stop = true;
                errorCount++;
            }
            if (radTransportation.SelectedIndex < 0)
            {
                radTransportation.ToolTip = "Please indicate whether or not you will provide transportation to the event.";
                radTransportation.BorderColor = Color.Red;
                stop = true;
                //only add error count if this questions is visible
                if (radTransportation.Visible)
                {
                    errorCount++;
                }
            }
            if (stop)
            {
                showError("You have " + errorCount + " errors that need to be fixed.");
                return;
            }
            else
            {
                //reset border colors
                txtEventName.BorderColor = Color.Black;
                txtDescription.BorderColor = Color.Black;
                comboEventTypeList.BorderColor = Color.Black;
                radTransportation.BorderColor = Color.Black;
                radOnSite.BorderColor = Color.Black;

                try
                {
                    //create new Event
                    Event currentEvent = new Event();

                    currentEvent.EventItemName = txtEventName.Text;
                    currentEvent.Description = txtDescription.Text;
                    int typeID = 0;
                    //we know that the selected value (event type id) is an int so no need to validate
                    int.TryParse(comboEventTypeList.SelectedValue, out typeID);
                    currentEvent.EventTypeID = typeID;
                    bool onsite;
                    bool transportation;
                    bool.TryParse(radOnSite.SelectedValue, out onsite);
                    bool.TryParse(radTransportation.SelectedValue, out transportation);
                    currentEvent.OnSite = onsite;
                    currentEvent.Transportation = transportation;

                    EventManager.EventResult result = _myEventManager.AddNewEvent(currentEvent);
                    if (result == EventManager.EventResult.Success)
                    {
                        lblMessage.Text = "Event Successfully Added!";
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "showit", "showMessage()", true);
                    }
                    clearForm();
                }
                catch (Exception ex)
                {
                    showError(ex.Message);
                }
            }
        }
        public void GetEvent_Valid()
        {
            setup();

            string expected = eventToTest.EventItemName;

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

            Event actual = EventAccessor.GetEvent(eventToEdit.EventItemID.ToString());

            EventAccessor.DeleteEventTestItem(eventToTest);

            Assert.AreEqual(expected, actual.EventItemName);
        }
 /// <summary>
 /// Miguel Santana
 /// Created:  2015/04/09
 /// Opens the addevent ui with a record to edit or a blank screen
 /// </summary>
 /// <param name="selectedEvent"></param>
 /// <param name="readOnly"></param>
 private void OpenEvent(Event selectedEvent = null, bool readOnly = false)
 {
     try
     {
         if (selectedEvent == null)
         {
             if (new AddEditEvent().ShowDialog() == false) return;
             Refresh();
         }
         else
         {
             if (new AddEditEvent(selectedEvent, readOnly).ShowDialog() == false) return;
             if (readOnly) return;
             Refresh();
         }
     }
     catch (Exception ex)
     {
         throw new WanderingTurtleException(this, ex);
     }
 }
 /// <summary>
 /// Bryan Hurst
 /// Created: 2015/04/03
 /// Deletes information concerning the test event
 /// </summary>
 /// <param name="testEvent"></param>
 /// <returns></returns>
 public int DeleteTestEvent(Event testEvent)
 {
     try
     {
         return EventAccessor.DeleteEventTestItem(testEvent);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 /// <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;
     }
 }
        /// <summary>
        /// Hunter Lind
        /// Created: 2015/2/23
        /// Creates an event to replace the old version of itself.
        /// </summary>
        private async void AddNewEvent()
        {
            var newEvent = new Event();

            try
            {
                newEvent.EventItemName = TxtEventName.Text;
                // On-site //
                if (RadOnSiteYes.IsChecked == true)
                {
                    newEvent.OnSite = true;
                }
                else if (RadOnSiteNo.IsChecked == true)
                {
                    newEvent.OnSite = false;
                }
                else
                {
                    throw new InputValidationException(RadOnSite, "Please fill in the on site field");
                }

                // Provided transport //
                if (RadTranspNo.IsChecked == true)
                {
                    newEvent.Transportation = false;
                }
                else if (RadTranspYes.IsChecked == true)
                {
                    newEvent.Transportation = true;
                }
                else
                {
                    throw new InputValidationException(RadTransp, "Please fill out the Transportation field");
                }

                newEvent.Description = TxtDescrip.Text;

                if (CboxType.SelectedItem != null)
                {
                    newEvent.EventTypeID = ((EventType)CboxType.SelectedItem).EventTypeID;
                }
                else
                {
                    throw new InputValidationException(CboxType, "Please select an event type!");
                }
                if (String.IsNullOrEmpty(TxtEventName.Text))
                {
                    throw new InputValidationException(TxtEventName, "Please enter an event name.");
                }
                EventManager.EventResult result = _eventManager.AddNewEvent(newEvent);
                if (result == EventManager.EventResult.Success)
                {
                    await this.ShowMessageDialog("Successfully Added Event");
                    DialogResult = true;
                    Close();
                }
            }
            catch (Exception ex)
            {
                if (ex is InputValidationException) { throw new InputValidationException((InputValidationException)ex); }
                throw new WanderingTurtleException(this, ex, "Error adding new event");
            }
        }
        /// <summary>
        /// Justin Pennington 
        /// Created:  2015/02/14 
        /// Retrieves all Active Events and returns a List of Event objects
        /// </summary>
        /// <returns>List object containing Event objects returned by the database</returns>
        public static List<Event> GetEventList()
        {
            var EventList = new List<Event>();

            // set up the database call
            var conn = DatabaseConnection.GetDatabaseConnection();
            string cmdText = "spSelectAllEventItems";
            var cmd = new SqlCommand(cmdText, conn);

            try
            {
                conn.Open();
                var reader = cmd.ExecuteReader();
                if (reader.HasRows == true)
                {
                    while (reader.Read())
                    {
                        var currentEvent = new Event();

                        currentEvent.EventItemID = reader.GetInt32(0);
                        currentEvent.EventItemName = reader.GetString(1);
                        currentEvent.EventTypeID = reader.GetInt32(2);
                        currentEvent.OnSite = reader.GetBoolean(3);
                        currentEvent.Transportation = reader.GetBoolean(4);
                        currentEvent.Description = reader.GetString(5);
                        currentEvent.Active = reader.GetBoolean(6);
                        currentEvent.EventTypeName = reader.GetString(7);
                        EventList.Add(currentEvent);
                    }
                }
                else
                {
                    var ax = new ApplicationException("Data not found!");
                    throw ax;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }
            return EventList;
        }
        /// <summary>
        /// Justin Pennington 
        /// Created:  2015/02/04
        /// 
        /// Updates an Event object/record
        /// </summary>
        /// <param name="oldEvent">The Event object to be updated</param>
        /// <param name="newEvent">The Event object with the updated information</param>
        /// <returns>Returns the number of rows affected (should be 1)</returns>
        public static int UpdateEvent(Event oldEvent, Event newEvent)
        {
            var conn = DatabaseConnection.GetDatabaseConnection();
            var cmdText = "spUpdateEventItem";
            var cmd = new SqlCommand(cmdText, conn);
            var rowsAffected = 0;

            // set command type to stored procedure and add parameters
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@EventItemName", newEvent.EventItemName);
            cmd.Parameters.AddWithValue("@EventTypeID", newEvent.EventTypeID);
            cmd.Parameters.AddWithValue("@EventOnsite", newEvent.OnSite);
            cmd.Parameters.AddWithValue("@Transportation", newEvent.Transportation);
            cmd.Parameters.AddWithValue("@EventDescription", newEvent.Description);

            cmd.Parameters.AddWithValue("@EventItemID", oldEvent.EventItemID);
            cmd.Parameters.AddWithValue("@originalEventItemName", oldEvent.EventItemName);
            cmd.Parameters.AddWithValue("@originalEventTypeID", oldEvent.EventTypeID);
            cmd.Parameters.AddWithValue("@originalEventOnsite", oldEvent.OnSite);
            cmd.Parameters.AddWithValue("@originalTransportation", oldEvent.Transportation);
            cmd.Parameters.AddWithValue("@originalEventDescription", oldEvent.Description);
            try
            {
                conn.Open();
                rowsAffected = cmd.ExecuteNonQuery();
                if (rowsAffected == 0)
                {
                    throw new ApplicationException("Concurrency Violation");
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }
            return rowsAffected;  // needs to be rows affected
        }
        public static Event getEvent(String eventID)
        {
            var theEvent = new Event();
            // set up the database call
            var conn = DatabaseConnection.GetDBConnection();
            string query = "SELECT EventItemID, EventItemName, EventStartTime, EventEndTime, MaxNumberOfGuests," +
            "CurrentNumberOfGuests, MinNumberOfGuests, EventTypeID, PricePerPerson, EventOnsite, Transportation, EventDescription, Active " +
            "FROM EventItem WHERE EventItemID = " + eventID;
            var cmd = new SqlCommand(query, conn);

            try
            {
                conn.Open();
                var reader = cmd.ExecuteReader();
                if (reader.HasRows == true)
                {

                        theEvent.EventItemID = reader.GetInt32(0);
                        theEvent.EventItemName = reader.GetString(1);
                        theEvent.EventEndDate = (DateTime)reader.GetValue(3);
                        theEvent.MaxNumGuests = reader.GetInt32(4);
                        theEvent.CurrentNumGuests = reader.GetInt32(5);
                        theEvent.MinNumGuests = reader.GetInt32(6);
                        theEvent.EventTypeID = reader.GetInt32(7);
                        theEvent.PricePerPerson = reader.GetDecimal(8);
                        theEvent.OnSite = reader.GetBoolean(9);
                        theEvent.Transportation = reader.GetBoolean(10);
                        theEvent.Description = reader.GetString(11);
                        theEvent.Active = reader.GetBoolean(12);

                }
                else
                {
                    var ax = new ApplicationException("Data not found!");
                    throw ax;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                conn.Close();
            }
            return theEvent;
        }
 private void toTestUpdate()
 {
     var myList = myMan.RetrieveEventList();
     foreach (var item in myList)
     {
         if (item.Description == "This is a test descrip")
         {
             toTest = item;
         }
     }
 }
        /// <summary>
        /// Hunter Lind
        /// Created:  2015/2/23
        /// Opens a dialog to confirm archival of an event record
        /// List is refreshed after archival
        /// </summary>
        /// <param name="selectedEvent"></param>
        private async void ArchiveEvent(Event selectedEvent)
        {
            ResultsArchive results = _myProductManager.CheckToArchiveEvent(selectedEvent.EventItemID);

            if (results == ResultsArchive.OkToArchive)
            {
                // Configure the message box to be displayed
                string messageBoxText = "Are you sure you want to delete this event?";
                string caption = "Delete Event?";

                // Display message box
                MessageDialogResult result = await this.ShowMessageDialog(messageBoxText, caption, MessageDialogStyle.AffirmativeAndNegative);
                // Process message box results
                switch (result)
                {
                    case MessageDialogResult.Affirmative:
                        try
                        {
                            _myEventManager.ArchiveAnEvent(selectedEvent);
                            Refresh();
                        }
                        catch (Exception ex)
                        {
                            throw new WanderingTurtleException(this, ex);
                        }
                        break;

                    case MessageDialogResult.Negative:
                        // User pressed No button
                        // ...
                        break;
                }
            }
            else
            {
                throw new WanderingTurtleException(this, "Event cannot be archive because it has active listings associated.");
            }
        }