Ejemplo n.º 1
0
        public Ad GetAdAndRecordImpression(int adID, string adUnitID)
        {
            AdDA da = new AdDA();
            
            Ad currentAd = da.GetByID(adID);

            if (currentAd.SrcAdUnitID != adUnitID) { 
                throw new Exception(string.Format("AdUnitID[{0}] for ad[{1}] on page [{2}] does not match", 
                    adUnitID, adID, HttpContext.Current.Request.Url)); }

            if (User.IsAuthenticated)
            {
                if (Climbfindians.Contains(User.Name)) { return currentAd; }
            }

            try
            {
                da.AddOneImpression(adID); 
            }
            catch (Exception ex)
            {
                CFLogger.RecordException(ex);
            }

            return currentAd;            
        }
Ejemplo n.º 2
0
        public void ReplyToPartnerCall(Guid partnerCallID, Guid replyingUserID, string message)
        {
            PartnerCall call = new PartnerCallDA().GetByID(partnerCallID);

            if (call.CreatorUserID == replyingUserID)
            {
                throw new Exception(string.Format("You cannot reply to your own partner call. call[{0}]", call.ID));
            }

            PartnerCallReply reply = new PartnerCallReplyDA().Insert(new PartnerCallReply
            {
                ID             = Guid.NewGuid(),
                ReplyDateTime  = DateTime.Now,
                ReplyingUserID = replyingUserID,
                PartnerCallID  = partnerCallID,
                Message        = message
            });

            ClimberProfile poster  = CFDataCache.GetClimberFromCache(call.ClimberProfileID);
            ClimberProfile replyer = CFDataCache.GetClimberFromCache(replyingUserID);

            MailMan.SendReplyToPartnerCall(call, reply, replyer, replyer.Email, poster.Email);

            CFLogger.RecordPartnerCallReply(replyingUserID, partnerCallID);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public void DeleteOutdoorCragCompletely(Guid cragID)
        {
            OutdoorCrag crag = new OutdoorCragDA().GetByID(cragID);

            new OutdoorCragDA().Delete(cragID);
            CFLogger.RecordModerateDeleteCrag(CurrentClimber.ID, crag.Name, crag.ClimbfindUrl);
        }
Ejemplo n.º 5
0
        private void SaveOutdoorCragPicture(OutdoorCrag crag)
        {
            OutdoorCragDA da = new OutdoorCragDA();

            da.Update(crag);
            CFLogger.RecordModerateEdit(CurrentClimber.ID, string.Format("Changed picture for outdoor crag {0}[{1}]", crag.Name, crag.ID));
        }
Ejemplo n.º 6
0
        private void SaveOutdoorPlacePicture(OutdoorPlace place)
        {
            OutdoorPlaceDA da = new OutdoorPlaceDA();

            da.Update(place);
            CFLogger.RecordModerateEdit(CurrentClimber.ID, string.Format("Changed picture for outdoor place {0}[{1}]", place.Name, place.ID));
        }
Ejemplo n.º 7
0
        public void DeletePartnerCallByUserAndSaveSurvery(PartnerCall call, string reason, int numberWhoContacted)
        {
            call.Deleted = true;
            CFLogger.RecordPartnerCallDelete(call.CreatorUserID, call.ID, reason, numberWhoContacted);

            new PartnerCallDA().DeleteByUserAndSaveSurvey(call, reason, numberWhoContacted);
        }
Ejemplo n.º 8
0
        public void SubscribeToPartnerCallsByEmail(Guid userID, int placeID)
        {
            PartnerCallSubscription subscription = pcsDA.Get(userID, placeID);

            subscription.Email = true;
            pcsDA.Update(subscription);
            CFLogger.RecordPartnerCallEmailSubscription(userID, placeID, "SubscribeToPartnerCallsByEmail");
        }
Ejemplo n.º 9
0
        public void UnSubscribeToPartnerCallsByRSS(Guid userID, int placeID)
        {
            PartnerCallSubscription subscription = pcsDA.Get(userID, placeID);

            subscription.RSS = false;
            pcsDA.Update(subscription);
            CFLogger.RecordPartnerCallUnSubscribe(userID, placeID, "UnSubscribeToPartnerCallsByRSS");
        }
Ejemplo n.º 10
0
        public Place UpdatePlaceCoordinates(Place place)
        {
            //-- Send app notification email
            CFLogger.RecordModerateEdit(CurrentClimber.ID, string.Format("{0} updated {1}[c{2}] coordinates at {3}",
                                                                         CurrentClimber.Email, place.Name, place.CountryID, place.ClimbfindUrl));

            return(new PlaceDA().Update(place));
        }
Ejemplo n.º 11
0
        public AreaTag UpdateAreaTag(AreaTag tag)
        {
            //-- Send app notification email
            CFLogger.RecordModerateEditAreaTag(CurrentClimber.ID, tag.Name, tag.CountryID);

            AreaTag newTag = new AreaTagDA().Update(tag);

            CFDataCache.CacheAllAreaTags();

            return(newTag);
        }
Ejemplo n.º 12
0
        public void DeleteMeCompletely(Guid userID, string fullName, string email)
        {
            if (CurrentClimber.ID != userID)
            {
                throw new Exception("You can only delete your own account");
            }
            new ClimberProfileDA().DeleteUserCompletely(userID);
            CFLogger.RecordDeleteAccount(userID, fullName, email);

            CFDataCache.FlushClimberFromCache(userID);
        }
        /// <summary>
        /// Group stuff
        /// </summary>

        public Club CreateClub(Club club)
        {
            Club newClub = new ClubDA().Insert(club);

            AddClubAreaTag(newClub.ID, GetAreaTagForCountry((Nation)newClub.CountryID).ID);

            CFLogger.RecordClubCreate(CurrentClimber.ID, club.Name, club.ID);

            CFDataCache.CacheAllClubs();

            return(club);
        }
        public void JoinClub(int clubID, string clubName, Guid userID, string usersEmail)
        {
            ClimberProfileDA cpDA = new ClimberProfileDA();

            if (cpDA.GetClimberProfile(usersEmail) == null)
            {
                cpDA.CreateDefaultClimberProfile(userID, usersEmail, InsertNewMessageBoard());
            }

            CFLogger.RecordClubJoin(userID, clubName, clubID);

            new ClubDA().InsertMemeber(clubID, userID);
        }
Ejemplo n.º 15
0
        public OutdoorCrag AddOutdoorCrag(OutdoorCrag crag, OutdoorPlace place)
        {
            crag.MessageBoardID = InsertNewMessageBoard();
            crag.ID             = Guid.NewGuid();

            OutdoorCragDA da = new OutdoorCragDA();

            OutdoorCrag newCrag = da.Insert(crag);

            //-- Send app notification email
            CFLogger.RecordModerateAddCrag(CurrentClimber.ID, newCrag.Name, place.CountryID, newCrag.ClimbfindUrl);

            return(newCrag);
        }
Ejemplo n.º 16
0
        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);
        }
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Setters
        /// </summary>

        public PartnerCall CreatePartnerCall(PartnerCall call)
        {
            call.ID             = Guid.NewGuid();
            call.PostedDateTime = DateTime.Now;
            if (call.IsIndoor)
            {
                call.ToTrad = false; call.ToAlpine = false;
            }

            //-- Check call has places
            if (call.PlaceIDs.Count == 0)
            {
                throw new Exception("Cannot post a partner call without any places");
            }

            //-- Check user does not have an existing same parnter call
            List <PartnerCall> usersCalls = GetUsersPartnerCalls(call.CreatorUserID);

            foreach (PartnerCall c in usersCalls)
            {
                if (call.HasSamePlaces(c))
                {
                    throw new UserPartnerCallWithSamePlacesExistsException("Duplicate calls for the same places.");
                }
            }

            pcDA.Insert(call);
            foreach (int placeID in call.PlaceIDs)
            {
                pcDA.InsertPlaceUserWantToClimbsAt(call.ID, placeID);
            }

            //Thread sendEmailsThread = new Thread(SendPartnerCallNotificatioonEmails);
            //-- TODO IMPORTANT START THIS ON A NEW THREAD
            //sendEmailsThread.Start(placeIDs, call);
            SendPartnerCallNotificationEmails(call, call.PlaceIDs);

            CFLogger.RecordPartnerCallCreate(call.CreatorUserID, call.PlaceIDs);

            return(call);
        }
Ejemplo n.º 20
0
        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);
        }
Ejemplo n.º 21
0
 public void DeleteLogExceptionEvent(int id)
 {
     CFLogger.DeleteException(id);
 }
Ejemplo n.º 22
0
 public void DeleteLogEvent(int id)
 {
     CFLogger.Delete(id);
 }
        public void LeaveClub(string clubName, int clubID, Guid userID)
        {
            CFLogger.RecordClubLeave(userID, clubName, clubID);

            new ClubDA().RemoveMemeber(clubID, userID);
        }