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);
        }
Exemple #2
0
        public void SaveClimberProfilePartnerStatus(ClimberProfile profile, byte partnerStatusID)
        {
            profile.PartnerStatusID = partnerStatusID;
            ClimberProfileDA da = new ClimberProfileDA();

            da.Update(profile);
        }
Exemple #3
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);
        }
Exemple #4
0
        public void TakeUserModeratorRights(Guid userID)
        {
            if (!IsAdmin)
            {
                throw new Exception("Only admin can take moderator rights");
            }

            ClimberProfile cp = new ClimberProfileDA().GetByID(userID);

            cp.IsModerator = false;
            new ClimberProfileDA().Update(cp);
        }
Exemple #5
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 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);
        }
        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);
        }
Exemple #8
0
        public static void SaveFeedback(Guid userID, string comment)
        {
            ClimberProfile climberProfile = new ClimberProfileDA().GetByID(userID);

            new FeedbackDA().Insert(new Feedback
            {
                DateTimePosted    = DateTime.Now,
                UserID            = userID,
                FeedbackFromUser  = comment,
                ResponseFromAdmin = ""
            });

            MailMan.SendFeedbackAlertEmail(climberProfile.Email, climberProfile.FullName, comment);
        }
Exemple #9
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);
                }
            }
        }
Exemple #10
0
        /// <summary>
        /// User the users' messageboardID as theverification mechanism
        /// </summary>
        public bool VerifyUsersEmailAddress(Guid userID, Guid messageBoardID)
        {
            ClimberProfile cp = new ClimberProfileDA().GetByID(userID);

            if (cp.MessageBoardID == messageBoardID)
            {
                cp.EmailVerified = true;
                new ClimberProfileDA().Update(cp);
                return(true);
            }
            else
            {
                throw new UserEmailVerificationFailedException(string.Format("User[{0}] failed verification with code[{1}]", cp.Email, messageBoardID));
            }
        }
        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);
        }
Exemple #12
0
        public ClimberProfile CreateClimberProfile(Guid userID, string email, string fullName, string nickName, bool isMale,
                                                   Nation nationality, string climbingLevel)
        {
            ClimberProfileDA da = new ClimberProfileDA();

            return(da.Insert(new ClimberProfile
            {
                ID = userID,
                Email = email,
                FullName = fullName,
                NickName = nickName,
                IsMale = isMale,
                Nationality = (byte)nationality,
                ClimbingLevel = climbingLevel,
                ProfilePictureFile = "Default.jpg",
                MessageBoardID = InsertNewMessageBoard()
            }));
        }
Exemple #13
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);
        }
Exemple #14
0
        /// <summary>
        /// User stuff
        /// </summary>

        public ClimberProfile GetClimberProfile(Guid userID)
        {
            ClimberProfileDA da = new ClimberProfileDA();

            ClimberProfile profile = da.GetByID(userID);

            if (profile != null)
            {
                return(profile);
            }
            else
            {
                MembershipUser u = Membership.GetUser(userID);
                if (u == null)
                {
                    return(null);
                }
                else
                {
                    return(da.CreateDefaultClimberProfile(userID, User.Name, InsertNewMessageBoard()));
                }
            }
        }
Exemple #15
0
        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);
                }
            }
        }
        public static void SaveFeedback(Guid userID, string comment)
        {
            ClimberProfile climberProfile = new ClimberProfileDA().GetByID(userID);

            new FeedbackDA().Insert(new Feedback
            {
                DateTimePosted = DateTime.Now,
                UserID = userID,
                FeedbackFromUser = comment,
                ResponseFromAdmin = ""
            });

            MailMan.SendFeedbackAlertEmail(climberProfile.Email, climberProfile.FullName, comment);
        }
        public List<ClimberProfile> GetClubMembers(int clubID)
        {
            ClimberProfileDA da = new ClimberProfileDA();

            return da.GetClubMembers(clubID);
        }
        public List <ClimberProfile> GetClubMembers(int clubID)
        {
            ClimberProfileDA da = new ClimberProfileDA();

            return(da.GetClubMembers(clubID));
        }
        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);
                }
            }
        }
        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);
        }
        public void TakeUserModeratorRights(Guid userID)
        {
            if (!IsAdmin) { throw new Exception("Only admin can take moderator rights"); }

            ClimberProfile cp = new ClimberProfileDA().GetByID(userID);
            cp.IsModerator = false;
            new ClimberProfileDA().Update(cp);
        }