public bool CreateEvent(string name, decimal price, string description, DateTime startPeriod,
     DateTime endPeriod, int maxNumberOfParticipants)
 {
     IEvent thisEvent = new Event(0, name, price, description, startPeriod, endPeriod, maxNumberOfParticipants, true);
     thisEvent = EventPersistence.CreateEvent(thisEvent);
     if (thisEvent != null)
     {
         eventList.Add(thisEvent);
         return true;
     }
     return false;
 }
        public bool UpdateEvent(int activityId, string name, decimal price, string description, DateTime startPeriod,
            DateTime endPeriod, int maxNumberOfParticipants, bool activated)
        {
            IEvent thisEvent = new Event(activityId, name, price, description, startPeriod, endPeriod, maxNumberOfParticipants, activated);

            if (EventPersistence.UpdateEvent(thisEvent))
            {
                IEvent oldEvent = RetrieveSingleEvent(thisEvent.ActivityId);
                updateEventProperties(oldEvent, thisEvent);
                return true;
            }
            return false;
        }
        public static List<IEvent> RetrieveEvents()
        {
            List<IEvent> eventEntityList = new List<IEvent>();

            if (Connect())
            {
                try
                {
                    SqlCommand Command = Connection.CreateCommand();
                    Command.CommandType = CommandType.StoredProcedure;
                    Command.CommandText = "fif_event_retrieve";

                    SqlDataReader dataReader = Command.ExecuteReader();

                    while (dataReader.Read())
                    {
                        int activityId = int.Parse(dataReader["activity_id"].ToString());

                        decimal price = decimal.Parse(dataReader["price"].ToString());
                        string description = dataReader["description"].ToString();
                        DateTime startPeriod = DateTime.Parse(dataReader["start_period"].ToString());
                        DateTime endPeriod = DateTime.Parse(dataReader["end_period"].ToString());
                        int maxNumberOfParticipants = int.Parse(dataReader["max_number_of_participants"].ToString());
                        string name = dataReader["name"].ToString();

                        IEvent thisEvent = new Event(activityId, name, price, description, startPeriod, endPeriod, maxNumberOfParticipants);
                        eventEntityList.Add(thisEvent);
                    }
                    Disconnect();
                    return eventEntityList;
                }
                catch
                {
                    Disconnect();
                    return null;
                }
            }
            return null;
        }