public List <Accommodation> Search(string searchTerm)
        {
            List <Accommodation> accommodationList = new List <Accommodation>();

            searchTerm = CustomFormat(searchTerm);
            try
            {
                string sql = "SELECT [AccommodationID], [Title], [Description], [Image], [Country] FROM Accommodation WHERE [Title] LIKE @SearchTerm OR [Description] LIKE @SearchTerm";

                List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("@SearchTerm", "%" + searchTerm + "%")
                };

                DataSet results = ExecuteSql(sql, parameters);

                for (int x = 0; x < results.Tables[0].Rows.Count; x++)
                {
                    Accommodation a = DataSetParser.DataSetToAccommodation(results, x);
                    accommodationList.Add(GetPrices(a));
                }

                return(accommodationList);
            }
            catch
            {
                throw;
            }
        }
        public List <Accommodation> QuickSearch(SearchVm sm)
        {
            List <Accommodation> result = new List <Accommodation>();

            if (!string.IsNullOrEmpty(sm.Search))
            {
                sm.Search = CustomFormat(sm.Search);
            }

            string sql =
                "SELECT [AccommodationId], [Title], [Description], [Image], " +
                "[Country] FROM [Accommodation]";

            List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >();


            if (sm.Country != null)
            {
                sql += "WHERE [Country] = @country";
                parameters.Add(new KeyValuePair <string, string>("@country", Convert.ToInt32(sm.Country).ToString()));
            }


            DataSet results = ExecuteSql(sql, parameters);

            for (int x = 0; x < results.Tables[0].Rows.Count; x++)
            {
                Accommodation a = DataSetParser.DataSetToAccommodation(results, x);
                result.Add(GetPrices(a));
            }

            if (sm.TravelType == TravelTypes.Zomer)
            {
                result = result.Where(n => n.DatePrices.Count(m => m.Date.Month >= 3 || m.Date.Month <= 9) != 0).ToList();
            }
            else if (sm.TravelType == TravelTypes.Winter)
            {
                result = result.Where(n => n.DatePrices.Count(m => m.Date.Month <= 2 || m.Date.Month >= 10) != 0)
                         .ToList();
            }

            if (sm.Month != null)
            {
                result = result.Where(n => n.DatePrices.Count(m => m.Date.Month == (int)(Months)sm.Month + 1) != 0).ToList();
            }

            return(result);
        }
        public Accommodation GetById(int id)
        {
            try
            {
                string sql = "SELECT AccommodationID, Title, [Description], [Image], [Country] FROM [Accommodation] WHERE AccommodationID = @AccommodationID";

                List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("@AccommodationID", id.ToString())
                };

                DataSet       results = ExecuteSql(sql, parameters);
                Accommodation a       = DataSetParser.DataSetToAccommodation(results, 0);

                return(GetPrices(a));
            }
            catch
            {
                return(null);
            }
        }
        public List <Accommodation> GetAll()
        {
            List <Accommodation> accommodationList = new List <Accommodation>();

            try
            {
                string sql = "SELECT AccommodationID, Title, Description, Image, Country FROM [Accommodation]";

                DataSet results = ExecuteSql(sql, new List <KeyValuePair <string, string> >());

                for (int x = 0; x < results.Tables[0].Rows.Count; x++)
                {
                    Accommodation a = DataSetParser.DataSetToAccommodation(results, x);
                    accommodationList.Add(GetPrices(a));
                }
                return(accommodationList);
            }
            catch
            {
                throw;
            }
        }