Exemplo n.º 1
0
        public tbl_POI SavePOI(string title, string description, int categoryID, string latitude, string longitude, string phone, int addressID,
                               string address1, string address2, string address3, string town, string postcode, string county, string country, int[] tagsIDs, int?sitemapID, int poiID)
        {
            if (String.IsNullOrEmpty(title) || categoryID < 1 || String.IsNullOrEmpty(latitude) || String.IsNullOrEmpty(longitude) || tagsIDs == null ||
                String.IsNullOrEmpty(address1) || String.IsNullOrEmpty(town) || String.IsNullOrEmpty(postcode) || String.IsNullOrEmpty(country))
            {
                return(null);
            }

            var address = AddressRepository.SaveAddress((int?)null, country, (int?)null, county, String.Empty, String.Empty, String.Empty, address1, address2, address3, postcode, String.Empty, town, addressID);

            if (address == null)
            {
                return(null);
            }

            var poi = POIRepository.Save(title, description, categoryID, address.AddressID, latitude.Replace(',', '.'), longitude.Replace(',', '.'), phone, sitemapID, poiID);

            if (poi == null)
            {
                return(null);
            }

            poi = POIRepository.SaveTags(tagsIDs, poi.POIID);
            return(poi);
        }
Exemplo n.º 2
0
        public tbl_POI SaveTagsForPOI(int[] tagsIDs, int poiID)
        {
            if (poiID < 1 || tagsIDs == null)
            {
                return(null);
            }

            return(POIRepository.SaveTags(tagsIDs, poiID));
        }
Exemplo n.º 3
0
        public List <tbl_POI> SearchPOIs(string search, int?categoryID, int[] tagIDs)
        {
            if (!String.IsNullOrEmpty(search))
            {
                search = search.ToLower();
            }
            var pois = POIRepository.GetAll().ToList().Where(p =>
                                                             (String.IsNullOrEmpty(search) || (p.POI_Title ?? String.Empty).ToLower().Contains(search) || (p.tbl_Address.A_County ?? String.Empty).ToLower().Contains(search) || (p.tbl_Address.A_Town ?? String.Empty).ToLower().Contains(search)) &&
                                                             (!categoryID.HasValue || categoryID.Value == 0 || p.POI_CategoryID == categoryID.Value) &&
                                                             (tagIDs == null || tagIDs.Count() == 0 || p.tbl_POITags.Any(t => tagIDs.Contains(t.POITagID)))
                                                             ).ToList();

            return(pois);
        }
Exemplo n.º 4
0
 public tbl_POI GetPOIByID(int poiID)
 {
     return(POIRepository.GetByID(poiID));
 }
Exemplo n.º 5
0
 public List <tbl_POI> GetAllPOIs()
 {
     return(POIRepository.GetAll().ToList());
 }
Exemplo n.º 6
0
 public bool DeletePOI(int poiID)
 {
     return(POIRepository.Delete(poiID));
 }