public Place AddIndoorPlace(Place indoorPlace, string address, string contactNumber, string website, bool hasBoulder, bool hasLead, bool hasTopRope) { indoorPlace.MessageBoardID = InsertNewMessageBoard(); indoorPlace.FriendlyUrlName = indoorPlace.Name.GetFriendlyUrlName(); PlaceDA placeDA = new PlaceDA(); Place place = placeDA.Insert(indoorPlace); IndoorPlaceDA indoorPlaceDA = new IndoorPlaceDA(); indoorPlaceDA.Insert(new IndoorPlace { ID = place.ID, Address = address, MapAddress = address, Contact = contactNumber, HasBoulder = hasBoulder, HasLead = hasLead, HasTopRope = hasTopRope, LogoImageFile = "Default.jpg", Latitude = 0, Longitude = 0, Website = website }); AddPlaceAreaTag(place.ID, GetAreaTagForCountry((Nation)place.CountryID).ID); //-- Send app notification email CFLogger.RecordModerateAddPlace(CurrentClimber.ID, indoorPlace.Name, indoorPlace.CountryID, indoorPlace.ClimbfindUrl); //-- Refresh the cache CFDataCache.CacheAllIndoorPlaces(); return(place); }
static void Main(string[] args) { var da = new PlaceDA(); var entities = da.GetAll(); foreach (var entity in entities) { Console.WriteLine(entity.Name); } Console.ReadLine(); }
public void SaveOutdoorPlacePicture1(OutdoorPlace place, string imageFileName, byte[] imageBytes) { place.DescriptionImageFile = ImageManager.SaveOutdoorPlaceImage(imageFileName, imageBytes, place.ID, place.FriendlyUrlName); place.DescriptionImageFileByUserID = CurrentClimber.ID; SaveOutdoorPlacePicture(place); Place basePlace = new PlaceDA().GetByID(place.ID); basePlace.PrimaryImageFile = place.DescriptionImageFile; new PlaceDA().Update(basePlace); }
public void DeleteIndoorPlaceCompletely(int ID) { if (!IsAdmin) { throw new Exception("Only admin can delete places"); } Place place = new PlaceDA().GetByID(ID); new IndoorPlaceDA().Delete(ID); new PlaceDA().Delete(ID); CFDataCache.CacheAllIndoorPlaces(); CFLogger.RecordModerateDeletePlace(CurrentClimber.ID, place.Name, place.CountryID, place.ClimbfindUrl); }
public void SaveIndoorPlaceLogo(IndoorPlace place, string imageFileName, byte[] imageBytes) { place.LogoImageFile = ImageManager.SaveIndoorPlaceLogo(imageFileName, imageBytes, place.ID, place.FriendlyUrlName); new IndoorPlaceDA().Update(place); Place basePlace = new PlaceDA().GetByID(place.ID); basePlace.PrimaryImageFile = place.LogoImageFile; new PlaceDA().Update(basePlace); //-- Refresh the cache CFDataCache.CacheAllIndoorPlaces(); }
public IndoorPlace UpdateIndoorPlace(IndoorPlace place) { IndoorPlaceDA indoorPlaceDA = new IndoorPlaceDA(); place.FriendlyUrlName = place.Name.GetFriendlyUrlName(); indoorPlaceDA.Update(place); PlaceDA placeDA = new PlaceDA(); placeDA.Update(place); //-- Send app notification email CFLogger.RecordModerateEdit(CurrentClimber.ID, string.Format("{0} updated {1}[c{2}] details at {3}", CurrentClimber.Email, place.Name, place.CountryID, place.ClimbfindUrl)); return(place); }
public OutdoorPlace UpdateOutdoorPlace(OutdoorPlace outdoorPlace) { OutdoorPlaceDA outdoorPlaceDA = new OutdoorPlaceDA(); outdoorPlace.DescriptionLastUpdated = DateTime.Now; outdoorPlace.DescriptionByUserID = CurrentClimber.ID; outdoorPlace.FriendlyUrlName = outdoorPlace.Name.GetFriendlyUrlName(); outdoorPlaceDA.Update(outdoorPlace); PlaceDA placeDA = new PlaceDA(); placeDA.Update(outdoorPlace); //-- Send app notification email CFLogger.RecordModerateEdit(CurrentClimber.ID, string.Format("{0} updated {1}[c{2}] details at {3}", CurrentClimber.Email, outdoorPlace.Name, outdoorPlace.CountryID, outdoorPlace.ClimbfindUrl)); return(outdoorPlace); }
public Place AddOutdoorPlace(Place outdoorPlace) { outdoorPlace.MessageBoardID = InsertNewMessageBoard(); outdoorPlace.FriendlyUrlName = outdoorPlace.Name.GetFriendlyUrlName(); PlaceDA placeDA = new PlaceDA(); Place place = placeDA.Insert(outdoorPlace); OutdoorPlaceDA outdoorPlaceDA = new OutdoorPlaceDA(); outdoorPlaceDA.Insert(new OutdoorPlace { ID = place.ID, DescriptionImageFile = "default.jpg" }); AddPlaceAreaTag(place.ID, GetAreaTagForCountry((Nation)place.CountryID).ID); //-- Send app notification email CFLogger.RecordModerateAddPlace(CurrentClimber.ID, outdoorPlace.Name, outdoorPlace.CountryID, outdoorPlace.ClimbfindUrl); //-- Refresh the cache CFDataCache.CacheAllPlaces(); //-- Not sure why outdoor places isn't cached? return(place); }
public void SavePlacesUserClimbsAt(Guid userID, List <int> newPlaceIDs) { List <int> previousPlaceIDs = new PlaceDA().GetPlacesUserClimbsAt(userID).Select(c => c.ID).ToList(); ClimberProfileDA cpDA = new ClimberProfileDA(); //-- Delete places user no longer climbs at foreach (int pid in previousPlaceIDs) { if (!newPlaceIDs.Contains(pid)) { cpDA.DeletePlaceUserClimbsAt(userID, pid); } } //-- Insert places user now climbs at that they didn't before foreach (int pid in newPlaceIDs) { if (!previousPlaceIDs.Contains(pid)) { cpDA.InsertPlaceUserClimbsAt(userID, pid); } } }