public static bool Insert(BookingVenue bookVenue)
        {
            bool status = false;

            try
            {
                using (SqlConnection con = new SqlConnection(conString))
                {
                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }
                    string qyery = "Insert into BookingVenue(VenueId,EventTypeId,GuestCount,BookDate,CustomerId) " +
                                   "Values(@VenueId,@EventTypeId,@GuestCount,@BookDate,@CustomerId)";
                    SqlCommand cmd = new SqlCommand(qyery, con);
                    cmd.Parameters.Add(new SqlParameter("@VenueId", bookVenue.VenueId));
                    cmd.Parameters.Add(new SqlParameter("@EventTypeId", bookVenue.EventTypeId));
                    cmd.Parameters.Add(new SqlParameter("@GuestCount", bookVenue.GuestCount));
                    cmd.Parameters.Add(new SqlParameter("@BookDate", bookVenue.BookDate));
                    cmd.Parameters.Add(new SqlParameter("@CustomerId", bookVenue.CustomerId));
                    cmd.ExecuteNonQuery();
                    if (con.State == ConnectionState.Open)
                    {
                        con.Close();
                    }
                    status = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(status);
        }
        public static List <BookingVenue> GetAll()
        {
            List <BookingVenue> bookVenuesList = new List <BookingVenue>();

            try
            {
                using (SqlConnection con = new SqlConnection(conString))
                {
                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }
                    string     query = "SELECT * FROM BookingVenue";
                    SqlCommand cmd   = new SqlCommand(query, con);

                    SqlDataReader reader = cmd.ExecuteReader();
                    if (reader != null)
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                BookingVenue bookvenue = new BookingVenue()
                                {
                                    VenueId     = reader["VenueId"].ToString(),
                                    EventTypeId = int.Parse(reader["EventTypeId"].ToString()),
                                    GuestCount  = int.Parse(reader["GuestCount"].ToString()),
                                    BookDate    = DateTime.Parse(reader["BookDate"].ToString()),
                                    CustomerId  = int.Parse(reader["CustomerId"].ToString())
                                };
                                bookVenuesList.Add(bookvenue);
                            }
                            reader.Close();
                        }
                    }
                    if (con.State == ConnectionState.Open)
                    {
                        con.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(bookVenuesList);
        }
        public static bool Update(string CustomerId, BookingVenue bookVenue)
        {
            bool status = false;

            try
            {
                using (SqlConnection con = new SqlConnection(conString))
                {
                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }
                    string query = "UPDATE BookingVenue SET VenueId=@VenueId, EventTypeId=@EventTypeId, " +
                                   "GuestCount=@GuestCount, CreatedBy=@CreatedBy, " +
                                   "WHERE CustomerId=@CustomerId";
                    SqlCommand cmd = new SqlCommand(query, con);
                    cmd.Parameters.Add(new SqlParameter("@VenueId", bookVenue.VenueId));
                    cmd.Parameters.Add(new SqlParameter("@EventTypeId", bookVenue.EventTypeId));
                    cmd.Parameters.Add(new SqlParameter("@GuestCount", bookVenue.GuestCount));
                    cmd.Parameters.Add(new SqlParameter("@BookDate", bookVenue.BookDate));
                    cmd.Parameters.Add(new SqlParameter("@CustomerId", bookVenue.CustomerId));
                    cmd.ExecuteNonQuery();
                    if (con.State == ConnectionState.Open)
                    {
                        con.Close();
                    }
                    status = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(status);
        }