public string GetPlaceLink(int placeID)
 {
     return(string.Format("<img src='{0}' /><a href='{1}'>{2}</a>",
                          CFDataCache.GetPlaceProp <string>(c => c.FlagImageUrl2, placeID),
                          CFDataCache.GetPlaceProp <string>(c => c.ClimbfindUrl, placeID),
                          CFDataCache.GetPlaceProp <string>(c => c.Name, placeID)));
 }
示例#2
0
        public string RenderHTMLPostTopDetailsForPartnerPage()
        {
            Place place = CFDataCache.GetPlace(PlaceID);

            return(string.Format(@"<label>{0}</label><br /><i>climbing</i> {1}",
                                 TagString, ClimbingDateTime.ToCFDateString()));
        }
        public FeedClimbingPost SaveFeedIntroductionPost(FeedClimbingPost newPost)
        {
            //-- Add that place to user's profile
            List <int> placeIDs = (from c in GetPlacesUserClimbs(newPost.UserID) select c.ID).ToList();

            if (!placeIDs.Contains(newPost.PlaceID))
            {
                SavePlaceUserClimbsAt(newPost.UserID, newPost.PlaceID);
            }

            //-- Save the post
            newPost.PostedDateTime   = DateTime.Now;
            newPost.ClimbingDateTime = DateTime.Now;
            newPost.TagID            = 52;
            FeedClimbingPost post = new FeedClimbingPostDA().Insert(newPost);

            //-- Send off notifications
            List <ClimberProfile> usersSubscribedToPlace
                = new ClimberProfileDA().GetPartnerEmailSubscribedUsers(newPost.PlaceID);

            Place          place  = CFDataCache.GetPlace(newPost.PlaceID);
            ClimberProfile poster = CFDataCache.GetClimberFromCache(newPost.UserID);

            foreach (ClimberProfile cp in usersSubscribedToPlace)
            {
                MailMan.SendFeedPostIntroductionNotificationEmail(cp, poster, post, place.Name);
            }

            //-- Subscribe them to this place too
            SubscribeToPartnerCallsByEmail(newPost.UserID, place.ID);

            return(post);
        }
示例#4
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);
        }
        public string RenderHTMLPostTopDetails()
        {
            Place place = CFDataCache.GetPlace(PlaceID);

            return(string.Format(@"<br /><b>{0}</b><br /><i>taken</i> @ <img src='{1}' /><a href='{2}'>{3}</a>",
                                 PlaceMedia.Name, place.FlagImageUrl2, place.ClimbfindUrl, place.Name));
        }
        public FeedPostComment SaveFeedPostComment(FeedPostComment comment)
        {
            comment.PostedDateTime = DateTime.Now;
            FeedPostComment  newComment = new FeedPostCommentDA().Insert(comment);
            FeedClimbingPost post       = new FeedClimbingPostDA().GetByID(comment.FeedPostID);

            //-- Send notification to the poster
            FeedSettings postersFeedSettings = GetUsersFeedViewSettings(post.UserID);

            if (postersFeedSettings.NotifyOnPostComment && comment.UserID != post.UserID)
            {
                MailMan.SendCommentOnMyFeedPostNotification(post.ID, comment.User, post.User, comment.Message);
            }

            List <Guid> uniqueCommentingUserIDs = (from c in post.Comments where c.UserID != post.UserID select c.UserID).Distinct().ToList();

            //-- Send notifications to other commentors
            foreach (Guid userID in uniqueCommentingUserIDs)
            {
                FeedSettings commentorsFeedSettings = GetUsersFeedViewSettings(userID);
                if (commentorsFeedSettings.NotifyOnPostsICommentedOn && comment.UserID != userID)
                {
                    MailMan.SendCommentOnAFeedPostICommentedOnNotification(post.ID, comment.User, post.User,
                                                                           CFDataCache.GetClimberFromCache(userID), comment.Message);
                }
            }

            return(newComment);
        }
示例#7
0
        protected void Page_Init(Object s, EventArgs e)
        {
            mapPlace  = CFDataCache.GetPlace(ViewData.Model.ID);
            FeedPosts = cfController.GetPlacesLatestFeedActivity(place.ID);
            if (!UserLoggedIn)
            {
                UserClimbsHere = false;
            }
            else
            {
                UserClimbsHere = cfController.UserClimbAtPlace(UserID, place.ID);
            }

            Crags          = (from c in cfController.GetCragsAtPlace(place.ID) orderby c.Name select c).ToList();
            AuthoritySites = cfController.GetOutdoorPlacesAuthoriySites(place.ID);

            //-- Get contributing users
            if (place.DescriptionByUserID != null)
            {
                descriptionLastUpdatedByUser = CFDataCache.GetClimberFromCache(place.DescriptionByUserID.Value);
            }
            if (place.DescriptionImageFileByUserID != null)
            {
                descriptionImageFile1ByUser = CFDataCache.GetClimberFromCache(place.DescriptionImageFileByUserID.Value);
            }
            if (place.DescriptionImageFile2 != null)
            {
                descriptionImageFile2ByUser = CFDataCache.GetClimberFromCache(place.DescriptionImageFile2ByUserID.Value);
            }
            if (place.DescriptionImageFile3 != null)
            {
                descriptionImageFile3ByUser = CFDataCache.GetClimberFromCache(place.DescriptionImageFile3ByUserID.Value);
            }
        }
示例#8
0
        public string RenderHTMLPostTopDetails()
        {
            Place place = CFDataCache.GetPlace(PlaceID);

            return(string.Format(@"<label>{0}</label><br /><i>climbing</i> {1} @ <img src='{2}' /><a href='{3}'>{4}</a>",
                                 TagString, ClimbingDateTime.ToCFDateString(), place.FlagImageUrl2, place.ClimbfindUrl, place.Name));
        }
示例#9
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);
        }
示例#10
0
        protected void Application_Start()
        {
            var god = new ClimberProfileDA().GetByID(new Guid("a9646cc3-18cb-4a62-8402-5263ba8b3476"));

            CFDataCache.Initialize();

            PeterBlum.VAM.Globals.Suite_LicenseKey = ConfigurationManager.AppSettings.Get("VAMSuite_LicenseKey");

            RegisterRoutes(RouteTable.Routes);
        }
示例#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);
        }
示例#12
0
        public void DeleteUserCompletely(Guid userID)
        {
            if (!IsAdmin)
            {
                throw new Exception("Only admin can delete users");
            }

            new ClimberProfileDA().DeleteUserCompletely(userID);

            CFDataCache.FlushClimberFromCache(userID);
        }
示例#13
0
        public void DeleteClub(int clubID)
        {
            if (!IsAdmin)
            {
                throw new Exception("Only admin can delete clubs");
            }

            new ClubDA().Delete(clubID);

            CFDataCache.CacheAllClubs();
        }
示例#14
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);
        }
        public List <Club> GetClubsUserBelongsTo(Guid userID)
        {
            List <Club> clubs   = new List <Club>();
            List <int>  clubIDs = new ClubDA().GetClubsUserBelongsTo(userID);

            foreach (int id in clubIDs)
            {
                clubs.Add(CFDataCache.GetClub(id));
            }
            return(clubs);
        }
        /// <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);
        }
示例#17
0
        public void SaveClimberProfilePicture(ClimberProfile profile, string imageFileName, byte[] imageBytes)
        {
            ClimberProfileDA da = new ClimberProfileDA();

            string newImageName = ImageManager.SaveRawTypeImage(imageFileName, imageBytes, profile.ID, ImageType.CP);

            profile.ProfilePictureFile = newImageName;

            da.Update(profile);

            CFDataCache.FlushClimberFromCache(profile.ID);
        }
        public void SendClimberWatchRequest(Guid watchedUserID, Guid watchingUserID)
        {
            FeedClimberChannelRequest watchedClimberEntry = new FeedClimberChannelRequestDA().Insert(
                new FeedClimberChannelRequest()
            {
                WatchedUserID  = watchedUserID,
                WatchingUserID = watchingUserID, RequestedDateTime = DateTime.Now
            });

            MailMan.SendWatchRequestEmail(watchedClimberEntry.ID, CFDataCache.GetClimberFromCache(watchingUserID),
                                          CFDataCache.GetClimberFromCache(watchedUserID));
        }
示例#19
0
        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();
        }
 protected void Page_Init(Object s, EventArgs e)
 {
     mapPlace  = CFDataCache.GetPlace(ViewData.Model.ID);
     FeedPosts = cfController.GetPlacesLatestFeedActivity(place.ID);
     if (!UserLoggedIn)
     {
         UserClimbsHere = false;
     }
     else
     {
         UserClimbsHere = cfController.UserClimbAtPlace(UserID, place.ID);
     }
 }
示例#21
0
        private void SendPartnerCallNotificationEmails(PartnerCall call, List <int> placeIDs)
        {
            Dictionary <ClimberProfile, int> usersSubscribedToAtLeastOnePlace
                = new ClimberProfileDA().GetPartnerCallEmailSubscribedUsers(placeIDs);

            foreach (ClimberProfile cp in usersSubscribedToAtLeastOnePlace.Keys)
            {
                if (cp.Email != User.Name)
                {
                    Place place = CFDataCache.GetPlace(usersSubscribedToAtLeastOnePlace[cp]);
                    MailMan.SendPartnerCallNotificationEmail(cp, call, place.Name, call.PlacesNamesString, cp.Email);
                }
            }
        }
示例#22
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);
        }
        public static SyndicationItem GetSyndicationItem(this FeedClimbingPost p)
        {
            Place  place     = CFDataCache.GetPlace(p.PlaceID);
            string placeLink = string.Format("{0}{1}", CFSettings.WebAddress, place.ClimbfindUrl);

            return(new SyndicationItem(
                       string.Format("{0} wants to climb {1} @ {2}, {3}", p.User.FullName, p.ClimbingDateTime.ToString("dd MMM"),
                                     place.ShortName, FlagList.GetCountryName((Nation)place.CountryID), placeLink),
                       string.Format("{0}", p.Message),
                       new Uri(placeLink),
                       string.Format("ClimbingPost[{0}]", p.ID),
                       p.PostedDateTime)
            {
                PublishDate = p.PostedDateTime
            });
        }
        public void Page_Load(Object o, EventArgs e)
        {
            Settings = new CFController().GetUsersFeedViewSettings(UserID);

            if ((FeedChannel)Settings.CurrentChannelType == FeedChannel.Area)
            {
                CurrentCountry = (Nation)CFDataCache.GetAreaTag(Settings.AreaID.Value).CountryID;
            }
            else if ((FeedChannel)Settings.CurrentChannelType == FeedChannel.Place)
            {
                CurrentCountry = (Nation)CFDataCache.GetPlace(Settings.PlaceID.Value).CountryID;
            }
            else
            {
                CurrentCountry = Nation.Afghanistan;
            }
        }
        public FeedClimbingPost SaveFeedPost(FeedClimbingPost newPost)
        {
            newPost.PostedDateTime = DateTime.Now;
            FeedClimbingPost post = new FeedClimbingPostDA().Insert(newPost);

            List <ClimberProfile> usersSubscribedToPlace
                = new ClimberProfileDA().GetPartnerEmailSubscribedUsers(newPost.PlaceID);

            Place          place  = CFDataCache.GetPlace(newPost.PlaceID);
            ClimberProfile poster = CFDataCache.GetClimberFromCache(newPost.UserID);

            foreach (ClimberProfile cp in usersSubscribedToPlace)
            {
                MailMan.SendPartnerFeedPostNotificationEmail(cp, poster, post, place.Name);
            }

            return(post);
        }
示例#26
0
        public void SaveClimberProfile(ClimberProfile profile, string fullName, string nickName, bool isMale,
                                       Nation nationality, string climbingLevel, string contactPhoneNumber, bool showMessageBoard)
        {
            ClimberProfileDA da = new ClimberProfileDA();

            profile.FullName            = fullName;
            profile.NickName            = nickName;
            profile.IsMale              = isMale;
            profile.Nationality         = (byte)nationality;
            profile.ClimbingLevel       = climbingLevel;
            profile.ContractPhoneNumber = contactPhoneNumber;
            profile.ClimbingGradeLower  = 1;
            profile.ClimbingGradeUpper  = 2;

            da.Update(profile);

            UpdateMessageBoardVisibility(profile.MessageBoardID, showMessageBoard);

            CFDataCache.FlushClimberFromCache(profile.ID);
        }
示例#27
0
        //public List<OutdoorCrag> Crags { get { return ; } }

        protected void Page_Init(Object s, EventArgs e)
        {
            place = cfController.GetOutdoorPlace(Crag.PlaceID);
            MessageBoardUC.RenderMessageBoard(cfController.GetMessageBoard(Crag.MessageBoardID));

            ////-- Get contributing users
            if (Crag.DescriptionImageFile1ByUserID != null)
            {
                descriptionImageFile1ByUser = CFDataCache.GetClimberFromCache(Crag.DescriptionImageFile1ByUserID.Value);
            }
            if (Crag.DescriptionImageFile2ByUserID != null)
            {
                descriptionImageFile2ByUser = CFDataCache.GetClimberFromCache(Crag.DescriptionImageFile2ByUserID.Value);
            }
            if (Crag.DescriptionImageFile3ByUserID != null)
            {
                descriptionImageFile3ByUser = CFDataCache.GetClimberFromCache(Crag.DescriptionImageFile3ByUserID.Value);
            }

            OtherCrags = (from c in cfController.GetCragsAtPlace(place.ID) where c.ID != Crag.ID select c).ToList();
        }
示例#28
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);
        }
 public string GetPlaceLink(int placeID)
 {
     return(string.Format("<a href='{0}'>{1}</a>",
                          CFDataCache.GetPlaceProp <string>(c => c.ClimbfindUrl, placeID),
                          CFDataCache.GetPlaceProp <string>(c => c.Name, placeID)));
 }
 protected ClimberProfile GetC(FeedClimberChannelRequest c)
 {
     return(CFDataCache.GetClimberFromCache(c.WatchedUserID));
 }