private static int DoRegisterNewEventInDb(EventInfo eventDetails)
        {
            int returnVal = 0;
            MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection();

            try
            {
                //define the command reference
                MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();

                //define the connection used by the command object
                msqlCommand.Connection = msqlConnection;

                msqlCommand.CommandText = "INSERT INTO Event(event_id,event_title,event_doe,event_venue,event_goal) "
                                                   + "VALUES(@event_id,@event_title,@event_doe,@event_venue,@event_goal)";

                msqlCommand.Parameters.AddWithValue("@event_id", eventDetails.id);
                msqlCommand.Parameters.AddWithValue("@event_title", eventDetails.eventTitle);
                msqlCommand.Parameters.AddWithValue("@event_doe", eventDetails.eventDoe);
                msqlCommand.Parameters.AddWithValue("@event_venue", eventDetails.eventVenue);
                msqlCommand.Parameters.AddWithValue("@event_goal", eventDetails.eventGoal);

                msqlCommand.ExecuteNonQuery();

                returnVal = 1;
            }
            catch (Exception er)
            {
                returnVal = 0;
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }
            return returnVal;
        }
 public static int DoRegisterNewEvent(EventInfo EventDetails)
 {
     return DoRegisterNewEventInDb(EventDetails);
 }
        public static void EditEvent(EventInfo eventToEdit)
        {
            MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection();

            try
            {   //define the command reference
                MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();
                msqlCommand.Connection = msqlConnection;

                msqlCommand.CommandText = "UPDATE event SET event_id=@event_id,event_title=@event_title,event_doe=@event_doe,event_venue=@event_venue,event_goal=@event_goal WHERE event_id= @eventIdToDelete";
                msqlCommand.Parameters.AddWithValue("@event_id", eventToEdit.id);
                msqlCommand.Parameters.AddWithValue("@event_title", eventToEdit.eventTitle);
                msqlCommand.Parameters.AddWithValue("@event_doe", eventToEdit.eventDoe);
                msqlCommand.Parameters.AddWithValue("@event_venue", eventToEdit.eventVenue);
                msqlCommand.Parameters.AddWithValue("@event_goal", eventToEdit.eventGoal);
                msqlCommand.Parameters.AddWithValue("@eventIdToDelete", eventToEdit.id);

                msqlCommand.ExecuteNonQuery();

            }
            catch (Exception er)
            {
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }
        }
        private static List<EventInfo> QueryAllEventList()
        {
            List<EventInfo> EventList = new List<EventInfo>();
            MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection();

            try
            {   //define the command reference
                MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();
                msqlCommand.Connection = msqlConnection;

                msqlCommand.CommandText = "Select * From event;";
                MySql.Data.MySqlClient.MySqlDataReader msqlReader = msqlCommand.ExecuteReader();

                while (msqlReader.Read())
                {
                    EventInfo Event = new EventInfo();

                    Event.id = msqlReader.GetString("event_id");
                    Event.eventTitle = msqlReader.GetString("event_title");
                    Event.eventDoe = msqlReader.GetDateTime("event_doe");
                    Event.eventVenue = msqlReader.GetString("event_venue");
                    Event.eventGoal = msqlReader.GetString("event_goal");

                    EventList.Add(Event);
                }

            }
            catch (Exception er)
            {
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }

            return EventList;
        }